# texlive: How to determine which package a font is contained in?

I've written a script that repeatedly runs lualatex file.tex to install missing packages, but I'm having a hard time doing the same with missing fonts. When an error message like

! Font \OT1/ppl/m/n/9=pplr7t at 9pt not loadable: metric data not found or bad.

comes up, I would like to determine the package containing ppl. Is there a way to do this algorithmically?

(For example, when there were missing x.sty or x.cls files, I was able to run tlmgr search --file x.sty and parse out the package it was in. If there is a ppl.some_extension file that every font has and that tlmgr could search for, that would be perfect.)

The script can be found here.

-

Well your message says that pplr7t.tfm is missing, so if tlmgr is able to find single files in packages tlmgr search --file pplr7t.tfm should work (I have miktex so I can't know).

-
I think this may be it (at least for the above class of error). Can anyone confirm that all fonts have a .tfm file like the above? –  scallops Sep 18 '11 at 14:56
All fonts which you can use with pdflatex must have a tfm. With luatex/xetex they are no longer needed: both engines are able to extract the tfm informations on-the-fly from various font types. But with font names like the above (a short mix of numbers and chars) you can safely assume that a real tfm file is needed. –  Ulrike Fischer Sep 18 '11 at 15:31
Thanks! I've added this algorithm to the script. –  scallops Sep 19 '11 at 1:03

The message relates to a particular make, style, face and size of font for which the font metric information is not available. The name (in this case pplr7t) is a shortform of the longer name and is referred to as a 'Berry name'. You can find how the name is constructed in the file fontname.pdf' (texdoc fontname.pdf on a TeX Live system). In this case the request is for an Adobe Palatino font ('p'=adobe, 'pl'=Palatino, 'r'=regular Roman).

The Berry name is formed by (quoting from fontname.pdf

Here is the basic scheme (the spaces here are merely for readability):

S TT W [V...] [N] [E] [DD] where

S represents the supplier of the font.

TT represents the typeface name.

W represents the weight.

V. . . represents the variant(s), and is omitted if both it and the width are normal. Many fonts have more than one variant.

N represents the encoding, and is omitted if the encoding is nonstandard. Encodings are subsumed in the section on variants (see Section 2.4 [Variants], page 20).

E represents the width (“expansion”), and is omitted if it is normal.

DD represents the design size (in decimal), and is omitted if the font is linearly scaled.

The lack of the font can be because it is not installed on your system but requested (either by a package or by your own commands) or because the font is installed but the particular combination of face, weight, size, etc. is not available (e.g. many fonts do not support semi-bold and hardly any support italic small capitals) or because what is looked for is installed but there is a problem with the TeX font metrics file (.tfm) or the font map file (.map), or because the commands mktexlsr (texhash) and updmap-sys were not run or not run correctly when the font was installed (these are needed to correctly set up a updmap.cfg file that lists all the font maps available to the user or on the system). There are many questions and answers on the site covering these specific points in detail.

-
This is very enlightening, thanks. However, assuming that the error is simply due to our not having installed the font before, is there an algorithmic way to go from the error message and do so? I suppose looking up "pl" ==> "palatino" could be automated, but after that I don't know how I would find its package (I currently have to search for packages with promising descriptions - and that's clearly out of the question for a script.) –  scallops Sep 18 '11 at 9:13
There may not be a package for the font and, even when there is, there may be a need to install both the package and the font (for example, there may be a package in CTAN to allow use of a commercial font so you could install the package but would also need to licence and install the font. Adobe Minion is such a commercial font with a CTAN package.) –  mas Sep 18 '11 at 16:20
Aye, I ended up realizing that the font situation was a lot messier than I'd thought. My script tries to be smart, but just ends up "brute forcing" if all else fails. –  scallops Sep 18 '11 at 16:49

ppl is the abbreviation of Palatino. I suppose that you are missing the lines

\usepackage{tgpagella}
\usepackage{fontspec}


or alternetively for LuaLaTeX (the better choice)

\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\begin{document}
Text in Palatino
\end{document}
`
-
While I was asking about a more general issue, thank you for the in-document instructions! –  scallops Sep 18 '11 at 9:36