# Using a Local Font for a Few Maths Symbols

To be compatible with my publisher, I had to make my own font (using fontforge) for a few math symbols. However, I could not figure out how to get latex to use my font, so I ended up just making a pdf/eps with just one symbol for each symbol and including the pdf/eps as a graphic. This works, but now compilation takes forever even when there's only a few pages.

So, how do I get latex to use my font directly rather than include graphics? I need a solution that lets my coauthors simply check out our directory and compile (possible with special flags and stiff) via both latex and pdflatex on both Windows and Linux (assuming they have appropriate packages in the miktex and texlive suites installed). That is, any solution that requires me to put files anywhere besides the directory with my latex files or subdirectories thereof unfortunately does not suffice.

Any help would be most appreciated (if there is a solution at all). I'm not an advanced user, so detailed instructions would be desirable. I have access to both Windows and Linux (specifically Ubuntu) machines for creating any necessary files. Thank you!

-
What format is the font? Type 1? OpenType? –  Caramdir Apr 4 '11 at 21:12
Possible duplicate: How to make an exotic font the default through the whole document –  Emre Apr 4 '11 at 21:14
@Caramdir Type 1 would be best, although I have it in FontForge so I can export to whatever format. Type 3 is not allowed by my publisher though. –  Ross Tate Apr 4 '11 at 21:31
@Emre That is not a duplicate. I do not want to replace the default fonts for the whole document. I only need to be able access a few glyphs for use as custom mathematical symbols. –  Ross Tate Apr 4 '11 at 21:32
I think there was a question here about packaging Type 1 fonts (which are what TeX uses), but I can't find it anymore. Maybe I misremember. –  Caramdir Apr 4 '11 at 21:40

You need at first a tfm-files with the metrics. (If you have an afm-file it is easy to generate the tfm with afm2tfm.) Put at first the tfm and the pfb in the same folder as your test document to test the font. In a small latex document add the line \pdfmapline{=tfm-name fontname type1.pfb} (with the correct names) and then try the positions where your symbols should be. Here an example how such a test looks like with the wasy font:

\documentclass{article}
\pdfmapline{=wasy10 wasy10 <wasy10.pfb}

\begin{document}
\font\test=wasy10 \test \char62 \char63
\end{document}

When this works make a list of all symbols, their positions, the command names you would want to use, the name of the tfm and the pfb, so that someone can make a you a small sty and a map-file.

Edit: Next step: The map file. As you could see pdflatex can load the mapping information simply with \pdfmapline (or \pdfmapfile), but dvips, dvidpfmx etc need the informations in their maps.

Make a wpl.map which contains the line from the \pdfmapline (without the equal sign). Save it in a local texmf tree in somewhere below /fonts/map/.... While you are at it move also the other files to the local texmf tree. Update the FNDB/run texhash. Then add the map file with updmap-sys (normally) or updmap (miktex and in special cases with texlive). See also the TeX-FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instt1font.

Then test again. At first with pdflatex. When it works try with dvips. If it works with pdflatex but not with dvips then the "font name" (the middle entry) in the map line is wrong (dvips is more picky). Check the correct name in the afm, correct in the map and regenerate the maps with udpmap(-sys)

-
I put wld.pfb and wld.tfm in the same folder as my .tex files. I added "\pdfmapline{=wld wld <wld.pfb} \DeclareSymbolFont{wld}{T1}{wld}{m}{n} \DeclareMathSymbol{\bbDelta}{\mathord}{wld}{68} \DeclareMathSymbol{\bbGamma}{\mathord}{wld}{71}" to my preamble. I also added t1wld.fd to the same folder as my .tex files with the following contents: "\ProvidesFile{t1wld.fd}[2011/03/31 FontInst v1.933 font definitions for T1/wld.] \DeclareFontFamily{T1}{wld}{} \DeclareFontShape{T1}{wld}{m}{n}{<-> wld} \endinput" and then pdflatex worked! Now it seems the next step is to get it to use a local .map file... –  Ross Tate Apr 5 '11 at 22:30
@Ross I edited the answer to add instruction how to make a map file. –  Ulrike Fischer Apr 6 '11 at 7:49
Awesome, I've got both latex and pdflatex working now (at least for my Ubuntu computer). However, this still doesn't solve my original problem. I had to move files into folders outside my project folder. This means every coauthor or other computer working on this project has to manually do all this file and folder manipulation when they check out the project. It also means that every time I make an update to the font everyone has to manually repeat the process. Is there a way to fix this? –  Ross Tate Apr 6 '11 at 22:13
If your font is free you could upload your work to CTAN so that texlive and miktex can make packages from it which can be installed with their package managers. Or you package the files in a tds-compliant zip-file. Then your colleges will only have to unzip it in the local texmf-tree and call updmap(-sy). Apart from this: After the initial installation there is not much do to. Updating means in general only to copy some changed files to the correct location. (And you can leave in a lot of the files in the project folder. But using a local tree is much cleaner.) –  Ulrike Fischer Apr 7 '11 at 7:25
Bummer. Well, since we only rarely need to make a ps file, I'll use your \pdfmapline trick as the general purpose solution and tell everyone to only use pdflatex. I'll just keep my Ubuntu computer set up with a local texmf tree for when we actually need a ps file. Thanks for all the help! –  Ross Tate Apr 7 '11 at 21:12