Tex Font Cheatsheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

TEX font errors: Cheatsheet

LATEX TEX2

An output le with a fallback


font (usually cmr) will be gener-
ated . 1
0 1 2 3 4 5 6 7 9 yes no
Font TFM file3
a b c d e f g h i j k l m no declared?1
2
found?
n o p q r s t u v wx y z
ABCDE F GHI J KL M
N O P Q R S T U V WX Y Z yes 3
no

Notes VF file3 yes Raw TFM


1 found? file3 found?
To use a font in LATEX, you need to connect LATEX’s
font definition – given as fontfamily (e.g., Com-
puter Modern Roman, cmr), fontseries (e.g., bold, yes
no4
b), and fontsshape (e.g, upright, n) – with an ac-
tual TEX font. This happens most commonly in an
FD file, but can also be accomplished in the LATEX
source file itself. Font info
2 sufficient?
Even if you’re not fluent in TEX, it’s quite easy to ac-
tually test a font with it, and that’s what you should no
do if things are not working as expected in LATEX. On yes
the command line, just go pdftex testfont, then
give your font’s (TEX) name, ask TEX to \sample,
and say \bye. What you’ll get is a nice prototype
document of your font. Map file in no
3
TEX’s 4
Your font definition declares a TEX font name and cache?
TEX looks for [r]TeX-font-name.{tfm,vf}.
4
If no further errors occur, your document will prob-
yes
ably compile fine without a font-related warning
message at all. However, you appear to use the raw
TFM directly without the VF detour. This way, TEX
will not have access to kerning and ligature infor- ENC file no
mation; hence, for example, “---” and “Ta” will be 5
found?
rendered as “---” and “Ta” instead of the correct
“—” and “Ta”.
yes

Done! PFM/TTF no
6
         file found?
a b c d e f g h i j k l m yes
n o p q r s t u v w x y z
A B C DE F GHI J K L M
N O P Q R S T U V WX Y Z
Depending on whether or not your TFM/VF
file contains kerning and ligature tables, the
quality of your document might vary (see
note 4 ). Compare, for example,

Table Table
ffi ffi
— ---
¿ ?‘
Errors and warnings as given by TEX
The following error messages were generated with the TTF font Comic Sans in LATEX. The TEX font name was chosen to be
jcs and T1 encoding was used.

LaTeX Font Warning: Font shape ‘OT1/jcs/m/n’ undefined


1
(Font) using ‘OT1/jcs/m/n’ instead on input line 23.

If you select the font explicitly by


\ fontfamily { jcs }\ fontseries { m }\ fontshape { n }\ selectfont Sample text .

you might run into the same issue. The problem is that LATEX can’t find a definition (in an FD file or in
the source file itself) that links the font family jcs with series m and shape n and the current encoding
to a specific internal TEX font.
That said, the problem is mostly the encoding. Are you using
\ Decla reFont Family { T 1}{ jcs }{}
\ DeclareFontShape { T 1}{ jcs }{ m }{ n } { < - > jcsr 8 t } {}

that is, T1 encoding? Well, LATEX’s default is OT1, so it’s probably just enough to force T1 encoding in
your source file with
\ usepackage [ T 1]{ fontenc }

kpathsea: Running mktextfm jcsr8t


mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode;
input jcsr8t
This is METAFONT, Version 2.718281 (Web2C 7.5.7)

kpathsea: Running mktexmf jcsr8t


! I can’t find file jcsr8t’.
<*> ...=ljfour; mag:=1; nonstopmode; input jcsr8t

Please type another input file name


2 ! Emergency stop.
<*> ...=ljfour; mag:=1; nonstopmode; input jcsr8t

Transcript written on mfput.log.


grep: jcsr8t.log: No such file or directory
mktextfm: ‘mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input jcsr8t’
failed to make jcsr8t.tfm.
kpathsea: Appending font creation commands to missfont.log.

! Font T1/jcs/m/n/10=jcsr8t at 10.0pt not loadable: Metric (TFM) file not found.
<to be read again>
relax

Now, somewhere in TEX’s data (in an FD file corresponding to your font or in the source file), one of
TEX’s internal font names is specified, (like jcsr8t here). Unfortunately, TEX can’t find a file named
jcsr8t.tfm now; you can verify this with
$ > kpsewhich jcsr8t . tfm

which doesn’t give any location. This file is needed to use the font. If you are sure that the file is there,
update TEX’s cache (texhash).
3 ! TeX capacity exceeded, sorry [max level recursion of virtual fonts=10].

This error message arises when there is a TFM file and a VF file that points to a raw TFM file that
happens to be the original TFM file itself. From there, TEX finds the corresponding VF file again and so
on: happy looping until TEX is tired.
There probably was an error when creating the font files which resulted in not distinguishing raw TFM
and TFM file. If you created the font files yourself, make sure that these are actually different files.

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+420/600 --dpi 420 rjcsr8t
mktexpk: don’t know how to create bitmap font for rjcsr8t.
kpathsea: Appending font creation commands to missfont.log.
4
!pdfTeX error: pdflatex (file rjcsr8t): Font rjcsr8t at 420 not found
==> Fatal error occurred, no output PDF file produced!

Probably the most common error message in LATEX fonts.


It’s being triggered when the information in the (raw) TFM file is not sufficient to create the actual
font, and thus again is a font installation error.
• Check that you did not interchange raw TFM and TFM font file (the raw TFM file should be a
lot smaller).
• Check that TEX finds your VF file if there is one.
Another possible cause is that the raw TFM is declared in no MAP file, or that TEX’s map cache isn’t
updated. Look for a map file with an entry starting with the raw TFM name, for example,
rjcsr 8 t Comic - Sans " T 1 Encoding ReEncodeFont " < Comic - Sans . ttf
<T 1 - WGL 4. enc

In Linux, this could for example be done by


$ > find / path / to / mapfiles | xargs grep rjcsr8t

If you can’t find it, create a proper map file, and update TEX’s map cache:
$ > updmap -- enable Map =/ path / to / mapfile . map

!pdfTeX error: pdflatex (file T1-WGL4.enc): cannot open encoding file for reading
5
==> Fatal error occurred, no output PDF file produced!

Probably easy: LATEX can’t find the encoding file. Can you? In this case, you probably forgot to update
TEX’s cache:
$ > texhash

!pdfTeX error: pdflatex (file Comic-Sans.ttf): cannot open TrueType font file
6 for reading
==> Fatal error occurred, no output PDF file produced!

The actual font file appears to be missing. Again, this might be a matter of updating TEX’s cache; also
make sure that the user can actually access the font file (read: get file permissions right).

You might also like