6

I'm writing a Dutch / French document, so I defined

\usepackage[dutch,french,british]{babel} 

in my headers, but my french é is being shown as a weird Ãl’.

I tried changing the encoding in Texmaker from UTF-8 to UTF-16 and UTF-32BE but it doesn't do a whole lot.

Can anyone tell me what to do?

  • 12
    Use UTF-8, but add \usepackage[utf8]{inputenc} to your document. – egreg Oct 18 '11 at 16:17
  • 2
    or add \usepackage[utf8x]{inputenc} – Alain Matthes Oct 18 '11 at 16:22
  • Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. – doncherry Oct 18 '11 at 16:22
  • I wonder how you are creating your é? are you just using the symbol as is? – aghsmith Oct 18 '11 at 16:44
  • 1
    egreg if you post it as answer I will mark it :) – Lucas Kauffman Oct 18 '11 at 17:10
9

It's not only a question of selecting the correct UTF-8 encoding in the editor; this choice must be told also to LaTeX, which knows nothing about the editor program:

\usepackage[utf8]{inputenc}

should be declared. For best result in all circumstances, it is recommended to use the following pattern

\usepackage[<encodings>]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[<languages>]{babel}

particularly if among the <encodings> there is a cyrillic one (T2A, T2B or T2C). In your case only T1 is necessary:

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dutch,french,british]{babel}

While the Font guide seems to say that font loading packages should be loaded before fontenc (see this answer) in my experiments it does not happen that LaTeX tries to load other fonts if the pattern is, say,

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dutch,french,british]{babel}
\usepackage{lmodern}

Of course, if some text is typeset before loading lmodern (for instance, some length is set with \settowidth or similar commands), then the relevant .fd files will be loaded (and the measurement might be wrong if, instead of lmodern one loads kpfonts).

I recommend to follow this pattern (also adding other needed encodings) because in the case of languages written in the cyrillic font inputenc has to know what encodings are loaded. But this is justified also on other bases.

Let's look at the typesetting process as if it were carried on in an old typographer's shop. When a manuscript comes in, the typographer looks at it and goes to fetch the necessary cases: say T1 for the latin alphabet, T2A for the cyrillic letters and T3 for the IPA symbols. This is the fontenc step. Only after having put the cases on the working desk the typographer will start to examine the manuscript letter by letter and chose from one case or the other as told by the found letter (inputenc step). Then the letters will be put on the composition stick following the rules given by the current language (babel step).

0

I have spent a considerable amount of time to find why I suddenly get errors with TeXshop 2014 when mixing English, French and Romanian text. Romanian text was OK but French accents always gave errors. The reason was that I have put {inputenc} before {fontenc}.

The following order ensures it works as expected and I can type French and Romanian accents directly in the text.

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,french,romanian]{babel}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.