0

The header is

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,left=4cm,right=3cm]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\begin{document}
MÈRE
\end{document}

In the TeX file, for example when I write é it is well displayed in the pdf output file, but É is displayed as "?". Why? Yet the character É is well supported by the encoding T1 (for fontenc). The problem seems to be only with uppercase accented characters.

The problem also seems to be from latin1 of the package inputenc. I tried utf8 instead of latin1 but it does not match.

NB: I know the alternative \'E and it work well, but I want to write the character directly as É.

EDIT: with the above header everything works fine on my Windows 7 PC, the problem only on my Windows XP one.

  • 1
    What do you mean when you say that it does not match? Please provide a complete minimal working example (MWE) that illustrates your problem. It is very difficult to help otherwise. However, the best will certainly be to switch to using utf8 but you need to resave your file in the correct encoding as well. The encoding of your file needs to match the option you feed inputenc. So if you use latin1, your file must use that encoding as well. If you use utf8, your file must use that. I suspect that your file encoding does not match. – cfr Sep 8 '14 at 1:42
  • What is your editor and how is it configured, as regards the font encoding? – Bernard Sep 8 '14 at 2:40
  • 2
    @seinus the operating system is not relevant but your editor may be configured to use different default encodings (utf8 or iso-8859-1) in the two systems. You can use either encoding but the encoding specified to inputenc needs to match the encoding actually used. – David Carlisle Sep 8 '14 at 8:45
  • 1
    @seinus ANSI is a misnaming (by microsoft) the encoding is not specified by ansi. ANSI is (was) the US arm of ISO and it's an international encoding iso-8859-1 informally known by everyone except microsoft as latin1, so if windows says the file encoding is ansi then declare it to inputenc as latin1 – David Carlisle Sep 8 '14 at 21:44
  • 1
    @seinus you still have not provided an example file, every question should include a complete document from \documentclass to \end{document} that demonstrates the problem. In this case you should be able to cut your file down to just a few lines that print a ? and also include the full log in code ({}) sections in the question. – David Carlisle Sep 9 '14 at 7:29
2

As David Carlisle said, it must work with pdflatex as well. Probably you editor uses utf8 by default, and the declared input encoding and the real one must coincide. So declareutf8 encoding and use the Latin Modern fonts (don't load fontenc in that case, since the lmodern package does it for you):

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,left=4cm,right=3cm]{geometry}
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[francais]{babel}

\begin{document}
MÈRE
\end{document} 

enter image description here

  • @Seinus/ As far as I know, TeXnic Center encodes in utf8 by default, so you should declare utf8, not latin 1. Anyway, it's better for portability. See my answer. – Bernard Oct 9 '14 at 10:58
1

You need to use XeTeX.

you can compile this MWE with xelatex command:

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,left=4cm,right=3cm]{geometry}
\usepackage{fontspec}
\usepackage[francais]{babel}

\begin{document}

ALLONS MANGER GRAND-MÈRE.

ALLONS MANGER, GRAND-MÈRE.

\end{document}

So you will get a fine output.

  • 1
    Thank you for this response. If the Tex file is ANSI coded then all accented characters will not be displayed on the pdf. Your proposal seems to be valid only for UTF-8 coded source file. Thanks again. – Sofiane Sep 8 '14 at 6:43
  • 1
    xetex is a possibility but of course you don't need to use xetex you can type accented letters with classic tex and pdftex as well! – David Carlisle Sep 8 '14 at 8:43
  • @DavidCarlisle "you can type accented letters with classic tex and pdftex as well": only while using UTF-8 encoder, right ? – Sofiane Sep 8 '14 at 16:21
  • @seinus not just utf8, any encoding supported by inputenc eg latin1 (is0-8859-1) – David Carlisle Sep 8 '14 at 17:40
  • @DavidCarlisle But latin1 doesn't work, uppercase accented character like "É" is not displayed (without any reported error or warning). This is the main problem. – Sofiane Sep 8 '14 at 21:23

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.