TeX font errors: Cheat sheet

I was recently confronted with the task to use a Truetype (read: native Microsoft) font in pdflatex. Although it is not anymore necessary to actually convert the TTF file into one of LaTeX's native font formats (such as PFM), installing the font can be quite cumbersome. There are some nice guidelines around; see, for example, Damir Rakityansky's page or Christophe Caignaert's step-by-step guide.

However, I bumped into a number of error messages which did not immediately provide me with information of how to get rid of them. For one, this is because LaTeX is quite complex, and it would probably require a book or two to properly describe what you would have to do to debug.

Well, this is not going to be a book here, but I still hope you'll find it useful: I compiled the (according to my very own empiricism) most frequent error messages and – here comes the good part – means of how to tackle them.

I also put some effort into a PDF describing TeX's failflow; it's a rather compact document. Everything that you can find here is also in the PDF, so you might want to think about getting the file here. (This is the actual cheat sheet.)

I'd like to keep this up-to-date, so if you feel something is missing or not really well explained, don't hesitate to poke me!

Anyway, here we go.

All the error messages were generated while installing the infamous MS Comic Sans font with T1 encoding. According to Karl Berry's font name scheme, TeX refers to is as jcs.

  1. LaTeX Font Warning: Font shape `OT1/jcs/m/n' undefined
    (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 My 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

    \DeclareFontShape {T1}{jcs}{m}{n} {<-> jcsr8t }{}
    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


  2. 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
    ! 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.


    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.

  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.

  4. 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.

    !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,

    rjcsr8t Comic-Sans "T1Encoding ReEncodeFont"
    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

  5. !pdfTeX error: pdflatex (file T1-WGL4.enc): cannot open encoding file for reading
    ==> 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

  6. !pdfTeX error: pdflatex (file Comic-Sans.ttf): cannot open TrueType font file
    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).