Chapter 12. Document Encoding

The Kile editor allows you to read, convert and save text in the character encoding your document needs. With this it is possible, for example, to use accented characters such as they are commonly used in Italian or French directly in LATEX documents. Selecting the encoding for your document can be done in two ways:

  • One way to set the document encoding is by using the submenu SettingsConfigure Kile...Editor, where you can set the default character encoding for all files.


    Set the default character encoding
  • A second way to set the encoding for a document is to choose the desired encoding within the wizard to create a new document.

LATEX itself only understands ASCII, which represents a very limited set of characters. Hence, it is not possible to use accented characters directly. To use them nevertheless, a special syntax was invented: such as for example \"e for ë. The inputenc package is available to help you with this. It is included in the preamble using \usepackage[latin1]{inputenc}, where the optional argument specifies the encoding you would like to use (nowadays in most cases utf8). This tells LATEX to translate all of the ë's you wrote to \"e's before compiling. Please refer to the inputenc documentation directly for more information. Last but not least: remember to make sure that your file is actually saved in the same encoding you specified for the inputenc package!

This multitude of different character coding tables has created numerous problems: 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. Most distributions have already begun setting their default encoding to UTF-8, and therefore you may be very interested in using of the utf8 argument to the inputenc package.

The ucs Package

If you don't have the ucs package installed, you can proceed as follows:

  • Get the ucs package from CTAN.

  • To install it, unpack the downloaded file and place it in a folder listed in your $TEXINPUTS environment variable. This can also be set inside kile.

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