# Type accented letters directly in tex file, not working

I would like to type accented letters directly in my tex file, and I would like them to be displayed correctly in the output. Neither of the solutions that I found online with inputenc / fontenc work. Please find enclosed a minimal example:

\documentclass{article}

\begin{document}

\title{Title}
\author{Author}
\maketitle

à

\end{document}


What lines of code shall I insert on the top of the document for "à" to be displayed correctly?

• \usepackage[<encoding>[inputenc} should work fine here, provided you choose the right encoding. For most modern files it is utf8 but perhaps you've saved in some other form ... – Joseph Wright Jun 15 '16 at 9:38
• Michael, notice that how the file is encoded depends on your editor configuration, not on LaTeX or TeX. So you have to tell it exactly which encoding your are using. As a personal suggestion, your best bet is using usepackage[utf8]{inputenc} and change the editor to use utf8 --- will save you a lot of problems in the future. – Rmano Jun 15 '16 at 9:55
• This works, indeed: I added % !TEX encoding = UTF-8 Unicode at the beginning of the document to set the encoding in TexShop, and then \usepackage[utf8]{inputenc}. Thank you. – James Jun 15 '16 at 10:31
• @Rmano An answer? – cfr Jun 16 '16 at 1:58

Unfortunately, there is no standard way to say which encoding a file is using - you have to know it. And the package inputenc is the way to tell LaTeX which encoding you are using.
Unicode utf8 is a de-facto standard nowadays, so the beat option is to convince your editor to use it, and add
\usepackage[utf8]{inputenc}

to your input file. And if you use a modern engine like xelatex or luatex the encoding must be utf8 and you do not even have a choice (so you shouldn't use inputenc there).