15

I usually use xelatex, but I'm exploring pdflatex now. When loading specific fonts in xelatex, I can always know what characters the font has available, since I can inspect the font file in any font viewing program, or I can find out the hard way by just entering the unicode and see if the character is displayed in the output. But how does this work with a font package?

Say, for instance, that I would like to use phonetic symbols in the gentium font. How do I know whether the font has phonetic symbols (I assume it does), and how do I know what command I need to type in order to make them appear? My only resource is the comprehensive LaTeX symbols list, but this only tells me what characters/commands there are available in LaTeX2e by default (depending on the font encoding), and what symbols I can find in specific packages. Phonetic symbols, for instance, are said to be in the tipa package. Does that mean I am locked to tipa if I want to use phonetic symbols with pdflatex?

Here's a pointless MWE:

\documentclass{article}
\usepackage{gentium}
\begin{document}
Please give me some phonetic symbols here?
\end{document}
Sverre
  • 20,729
  • fonts for pdflatex have at most 256 characters, texdoc gentium lists the supported encodings, I don't see phonetic symbols listed. – David Carlisle Sep 01 '13 at 12:02
  • If you want to know if a font has symbols you must look into the font itself in the same way you are doing it with xelatex. But even if a font has symbols it doesn't mean that someone created the necessary support files (tfm, fd etc) to use the symbols. In the case of tipa e.g. you would need a T3gentium.fd and other files. – Ulrike Fischer Sep 01 '13 at 12:14
  • Where can I then find a list of the available characters and their commands in all the encodings? I've found the encguide (http://www.ctan.org/pkg/encguide), but this only lists the commands for the encodings OT1 and T1. – Sverre Sep 01 '13 at 12:17
  • @UlrikeFischer How do I do that? There are 149 files/folders in my texlive tree with the word gentium in their name. What file should I look at to see what the available characters in the gentium font are? – Sverre Sep 01 '13 at 12:20
  • @Sverre you are referring to "font" in the singular, T1 is a complete encoding there is no room for any other symbols in an 8 bit font. So the phonetic symbols can not be in the T1 encoded font used for text you would have to have a separate font encoded differently. As I noted in the first comment the package documentation lists encodings currently supported, which is basically latin, cyrillic and greek (in separate fonts) T3 (phonetic alphabet) is not listed. – David Carlisle Sep 01 '13 at 16:07
  • @DavidCarlisle I understood your initial comment, which is why I asked for "a list of the available characters and their commands in all the encodings" (i.e. T1, T3, T5 etc.). I didn't use the word "font" in my comment to you, so you might be referring to my original question (which I wrote before I understood the points you're raising). I'll edit my original question once we've gotten somewhat closer to an answer (cf. that Ulrike says I can look up the available glyphs in the font). – Sverre Sep 01 '13 at 18:37

2 Answers2

10

The fonttable package can show the character table of a given font. The basic command \fonttable wants the name of a TFM file (for instance \fonttable{cmr10}); the extended command \xfonttable wants four arguments: encoding, family, series and shape.

\documentclass{article}
\usepackage[T2A,T1]{fontenc} % load the desired encodings
\usepackage{fonttable}

\begin{document}

\xfonttable{T2A}{cmr}{m}{n}

%\clearpage

%\fonttable{cmr10} % the basic command
\end{document}

enter image description here

egreg
  • 1,121,712
  • In what way doesn't it behave well with other encodings? I tried \xfonttable{T5}{gentium-tug}{}{} and that seemed to work fine? – Sverre Sep 02 '13 at 17:48
  • @Sverre It has possibly been fixed since I had to use that trick, I'll remove the code (but it will be in the history, just in case). – egreg Sep 02 '13 at 17:56
  • Could you use the gentium (gentium-tug) font as an example with \xfonttable? When I look in my log, I see that it never recognizes the "Font shape" of any font I use \xfonttable with, so it always substitutes with cmr. – Sverre Sep 02 '13 at 18:12
  • 1
    @Sverre The TeX Live package is called gentium-tug, but the family name is gentium; with \xfonttable{T5}{gentium}{m}{n} I get the expected output. – egreg Sep 02 '13 at 18:16
  • Then last stupid question. How can I find out what the "family names" are? I've tried to use \xfonttable with common fonts such as libertine and tipa, but I get the same errors (I can't imagine what their family names would be other than libertine and tipa). – Sverre Sep 02 '13 at 18:19
  • 1
    @Sverre I'm pretty sure there's a question about this on the site. Not easy, I should say. For Linux Libertine it is LinuxLibertineT-LF (for lining figures) or LinuxLibertineT-OsF (for oldstyle figures). For the Tipa fonts, just cmr, cmss, cmtt, ptm or phv. – egreg Sep 02 '13 at 18:24
  • Ok. It's baffling to me that this needs to be this hard, but ... :) – Sverre Sep 02 '13 at 18:34
4

If you know the specific font you want to check then the base TeX installation contains Knuth's testfont document which prompts for the font file and then can print several samples or tables in the style of the TeX and MetaFont books.

enter image description here

was made by this interactive session:

pdftex testfont
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
 restricted \write18 enabled.
entering extended mode
(/usr/local/texlive/2013/texmf-dist/tex/plain/base/testfont.tex

Name of the font to test = cmr10
Now type a test command (\help for help):)
*\table

*\bye
[1{/usr/local/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]</usr/
local/texlive/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/lo
cal/texlive/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/local
/texlive/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb></usr/local/
texlive/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on testfont.pdf (1 page, 67122 bytes).
David Carlisle
  • 757,742
  • 1
    Also pdflatex nfssfont that can accept specifications for encoding/family/series/shape; or the fonttable package. – egreg Sep 02 '13 at 16:22
  • @David Carlisle: How about the 'gentium' font mentioned in my question? I'm afraid I didn't understand your example. What exactly do I type into the document I compile? – Sverre Sep 02 '13 at 17:25
  • @egreg The fonttable package provides an easy way to see the available glyphs in a font. If you care to make that an answer, I'll accept it. – Sverre Sep 02 '13 at 17:25
  • @Sverre where I typed cmr10 you could type any filename from /usr/local/texlive/2013/texmf-dist/fonts/tfm/public/gentium-tug/ or wherever the fonts are on your system. Note I suggested this one rather than the latex versions mentioned by egreg as this allows you to see the fonts you have installed rather then the fonts for which you have latex NFSS definitions set up, which may only be a subset of that. – David Carlisle Sep 02 '13 at 18:03
  • @DavidCarlisle Sorry, I don't understand. I believe you're compiling in a console environment or something? I sadly have no idea how to do that. I use TeXworks. – Sverre Sep 02 '13 at 18:15