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}
6
  • fonts for pdflatex have at most 256 characters, texdoc gentium lists the supported encodings, I don't see phonetic symbols listed. Commented Sep 1, 2013 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. Commented Sep 1, 2013 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 (ctan.org/pkg/encguide), but this only lists the commands for the encodings OT1 and T1.
    – Sverre
    Commented Sep 1, 2013 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
    Commented Sep 1, 2013 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. Commented Sep 1, 2013 at 16:07

2 Answers 2

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

7
  • In what way doesn't it behave well with other encodings? I tried \xfonttable{T5}{gentium-tug}{}{} and that seemed to work fine?
    – Sverre
    Commented Sep 2, 2013 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
    Commented Sep 2, 2013 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
    Commented Sep 2, 2013 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
    Commented Sep 2, 2013 at 18:16
  • 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
    Commented Sep 2, 2013 at 18:24
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).
5
  • 1
    Also pdflatex nfssfont that can accept specifications for encoding/family/series/shape; or the fonttable package.
    – egreg
    Commented Sep 2, 2013 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
    Commented Sep 2, 2013 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
    Commented Sep 2, 2013 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. Commented Sep 2, 2013 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
    Commented Sep 2, 2013 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .