# How to get Latex accents to work

Getting Latex accents and other special characters to work can sure give one a headache. In this article you'll see how easy it is to get your accents working once you know exactly what you're doing.

As explained here, Latex uses the ASCII character set by default. ASCII has only 128 characters which are not enough for languages other than English. This means Latex does not recognize accents, tildes, the circumflex, diaeresis, cedilla and others by default.

However two short lines are enough to add support. UTF8 encoding supports all these special characters and many more. To change the encoding used in compilation to UTF8 insert the following line at the beggining of your document (after the rest of your \addpackage lines):

`\usepackage[utf8]{inputenc}`

This tells Latex to read your .tex file as UTF8, allowing Latex to understand the special characters you type. Because Latex compiler will read your source as UTF8, you have to actually write your source in UTF8. To save your source .tex file in UTF8 set your text editor encoding to UTF8 to match the Latex setting. For Notepad++ go to Encoding > Encode in UTF-8; for Texmaker to Options > Configure Texmaker > Editor > Editor Encoding > UTF-8 and restart the program.

The input encoding may be changed at any part of the document using, for example `\inputencoding{utf8}`. Be sure not to have a line such as `\inputencoding{latin1}` that would change back to latin1 encoding from there on, wrecking your special characters.

That's enough for the Latex compiler to understand special characters. However Latex uses another independent encoding, called font encoding, to output characters to the resulting PDF file. Latex default font encoding allows accents, but not automatic hyphenation of accented words. To fix this issue, it's recommended to add the line:

`\usepackage[T1]{fontenc}`

In short, to completely fix your Latex accents:

1. Add `\usepackage[utf8]{inputenc}` and `\usepackage[T1]{fontenc}` lines after your \usepackage commands.
2. Set your text editor to use UTF8 encoding.
3. Erase any \inputencoding instructions that undesirably change the input encoding away from UTF8 (to latin1, for example).