8

Suppose that I have T1 as font encoding (and therefore I will have no copy, search and hyphenation problems, etc).
Is there any difference between typing, for example, \^e and ê in the output?
My pratical experiences tell me that I have no problem with copy&paste or searching, both seem to work in the same way.

-- EDIT: 'font' encoding where it read 'input' and typo correction ty @David Carlisle

  • No, in general there is no difference. ê is a command and is mapped to \^e. But naturally your document could redefine ê to do something different. – Ulrike Fischer Jan 21 '14 at 16:33
  • 2
    T1 is a font (not input) encoding, assuming you have latin1 or utf8 as input encoding, and T1 as font encoding, those inputs are equivalent. – David Carlisle Jan 21 '14 at 16:33
  • 1
    @UlrikeFischer If you don't load inputenc, ê is not translated into \^e at all. – egreg Jan 21 '14 at 16:49
10

You're confusing between input and output encoding.

An input encoding is selected with a line such as

\usepackage[utf8]{inputenc}

and this allows using accented letters in the LaTeX document, such as ê. The option used must reflect the encoding used for saving the file.

An output encoding is selected with

\usepackage[T1]{fontenc}

The two calls are not linked. All inputenc does is translating input such as ê into a lower level command, which is precisely \^{e}, by the way. It's a job for the output encoding transforming this “LaTeX Internal Character Representation” (LICR) into an instruction of the form “select the character in slot 0xEA (decimal 234) in the current font”.

A main source for misunderstanding is the fact that if

  1. the file encoding is Latin-1 (known also as ISO 8859-1) and
  2. the output encoding is T1

a document such as

\documentclass{article}
\usepackage[T1]{fontenc}

\begin{document}
ê
\end{document}

seems to compile correctly. Tell it to your German friends: a big surprise is in stock for them when they try

\documentclass{article}
\usepackage[T1]{fontenc}

\begin{document}
Straße
\end{document}

that will be incorrectly typeset as “StraSSe”. This is because Latin-1 and T1 coincide in several slots, but not all of them.

German or not, both ê and ß will give unpredictable results if the file encoding is UTF-8 and \usepackage[utf8]{inputenc} is not included in the preamble like in the example just above. Here's a document that witness it; save it as UTF-8 and compile:

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
êß
\end{document}

Here's the output

enter image description here

Final recommendation

Load both packages, if you intend to use accented letters. And, possibly, switch to UTF-8. You'll be ready for XeLaTeX and LuaLaTeX, if you want to try them.

  • Refering to your last sentence: Do you think XeTeX and LuaTeX are worth mentioning? – Johannes_B Jan 21 '14 at 17:09
  • @GonzaloMedina No, a document without \usepackage[utf8]{inputenc} would. I added some words for clarifying the matter. – egreg Jan 21 '14 at 17:10
  • I said 'input' encoding instead of 'font'. It was a mistake, I already corrected it. Thank you for the explanation, it is very clear, I understood everything except for the mention of XeLaTex and LuaLaTeX. So, inputenc turns all 'ê' and '\^e' into '\{e}' (with utf8) and this means 'yes' to my question. Then fontenc selects the correct glyph for output. :-) – brita_ Jan 21 '14 at 17:29

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.