Setting the Document's Encoding
Prev
Next

Chapter 10. Setting the Document's Encoding

The Kile editor allows you to read, convert and set the text to the encoding your document needs. This allows you to use non-standard letters and symbols; you can use, for example, accented characters for Italian or French. Selecting the encoding for your document can be done in three ways:

LATEX itself understands only ASCII, a very limited set of characters, so you couldn't use accented or special letters directly. To use accented letters, a special syntax was created: such as for example \"e for ë. There is a package to help you with this, called inputenc, and is included in the preamble using \usepackage[latin1]{inputenc}, where the optional argument is the encoding you would like to use (in most cases latin1). This tells LATEX to translate all of the ë's you wrote to \"e's before compiling. Please refer to the inputenc documents directly for more information on inputenc. Last but not least: remember to make sure that your file is actually encoded in the same encoding you told inputenc!


Choosing the source file's encoding

This host of different character coding tables has been creating problems on many applications: for example, you cannot write a course of Turkish in French without losing one language's special characters. There is general agreement that, sooner or later, everybody will switch to Unicode. There are many implementations of Unicode, and utf-8 is the most successful in Linux; Windows(R) relies instead on the more cumbersome and less flexible ucs-2. Some distributions, as RedHat, have already begun setting their default encoding to utf-8, and therefore you may be very interested in using a utf-8 argument to the inputenc package.

The bad news is, it's not yet included in teTEX at the time of writing this document; the good news is, there is a LATEX package that can do just that, and you can install it yourself.

The ucs Package

You can get the ucs package from the home page of Unicode support for LATEX, by Dominique Unruh from the university of Karlsruhe.

To install it, unpack the downloaded file and move the uncompressed contents to a directory that TEX can see; you could for instance use /usr/share/texmf/tex/latex/ucs/ (make sure this is actually your $TEXMF path, as it sometimes change depending on the distribution you use!). Make the directory globally readable if it is not already, and the subdirectories executable, using chmod. You have to perform all these actions as root, so be careful.

When you have finished, launch the texhash command to make TEX review its files, and hopefully find the new package. Refer to the package documentation for details, but generally you will need little more than setting the following in your preamble:


		\usepackage{ucs}
		\usepackage[utf8x]{inputenc}

Prev
Next
Home