Font encoding
Because of deficiencies of the OT1
encoding I also recommend T1
font encoding:
\usepackage[T1]{fontenc}
For example OT1
contains inconsistencies in the encoding for different families, typewriter is different, …
Also
\usepackage{textcomp}
is useful for getting other symbols (Euro, …). Instead of Computer Modern/EC
I would use the new Latin Modern
fonts that are a further development of the former:
\usepackage{lmodern}
Input encoding
Of course there are advantages using plain ASCII for the texts and using commands for the other characters. This way the text is quite independent from the encoding and can be more easily be used in different environments with different encodings.
But sometimes characters outside of ASCII might slip through. In case of OT1
the file compiles fine, but the characters are missing:
\documentclass{article}
% Default font encoding: OT1
\begin{document}
Umlauts via LICR: \"a\"o\"u\ss
Umlauts directly: äöüß
\end{document}
There is no warning or error, only the .log
file says:
Missing character: There is no ä in font cmr10!
Missing character: There is no ö in font cmr10!
Missing character: There is no ü in font cmr10!
Missing character: There is no ß in font cmr10!
Switching to T1
encoding helps to make more characters available. However I do not know an editor that supports T1
encoding. Some positions match the slots in latin1
, for example. But other characters are different or have other positions. The following example uses the ^^-notation to avoid problems with editing and copy&pasting, because the example uses two different encodings at the same time:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}
\begin{document}
% Umlauts/Euro: äöüß/€
Umlauts/Euro via LICR: \"a\"o\"u\ss/\texteuro
Umlauts/Euro directly (latin9): ^^e4^^f6^^fc^^df/^^a4
Umlauts/Euro directly (UTF-8): ^^c3^^a4^^c3^^b6^^c3^^bc^^c3^^9f/^^e2^^82^^ac
\end{document}
This time, there is no hint even in the .log
file.
Therefore I recommend using package inputenc
with encoding ascii
:
\usepackage[ascii]{inputenc}
Then non-ASCII input characters generate errors:
! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `ascii'.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.10 Umlauts/Euro directly (latin9): ä
öüß/€
After fixing the input lines this helps to ensure that the file is indeed ASCII.
inputenc
. But you should use\usepackage[T1]{fontenc}
. The default OT1 encoding has only 128 positions and this leads to deficiencies.fontenc
is necessary, at least to a non-expert like myself.fontenc
is necessary butT1
encoding (or some other font encoding with at least 256 char positions). 128 positions are simply not enough. The answers below (and the answers they link to) gives some examples of chars missing inOT1
.