12

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!

Emre
  • 6,337
Ross Tate
  • 123
  • What format is the font? Type 1? OpenType? – Caramdir Apr 04 '11 at 21:12
  • @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 04 '11 at 21:31
  • 3
    @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 04 '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 04 '11 at 21:40
  • Have you read Philipp Lehman's Font Installation Guide? It should be part of your distribution. This outlines a lot, if not all of what you need. – Alan Munn Apr 05 '11 at 01:31
  • @AlanMunn Thanks for the link. While I've not read that guide, it looks like many of the other guides I've looked over. The problem is I can't figure out how to get latex to use the folder containing my .tex files for fonts. At least none of the examples do this, and I'm unfortunately not experienced enough to identify helpful hooks (if they exist). – Ross Tate Apr 05 '11 at 22:39
  • @Ross So, just for clarification, if you install the fonts into your local texmf folder using the installation guide, they work? And the problem is how to get tex to see them when they are in the folder of the source document rather than in the texmf folder? Or have you not managed to get the fonts to work no matter what? – Alan Munn Apr 06 '11 at 03:39
  • @AlanMunn Thanks to @UlrichFischer and your link I've got it working for my Ubuntu computer (I haven't tried my Windows computer yet) but only by using a texmf folder outside of my project folder. However, like you said, I still can't get tex to see them when they are in the same folder (or subfolder thereof) as my source document. I've even tried recreating the texmf directory structure in my source folder, but it seemed to make no difference. – Ross Tate Apr 06 '11 at 22:24

1 Answers1

5

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: https://texfaq.org/FAQ-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)

David Carlisle
  • 757,742
Ulrike Fischer
  • 327,261
  • 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 05 '11 at 22:30
  • @Ross I edited the answer to add instruction how to make a map file. – Ulrike Fischer Apr 06 '11 at 07: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 06 '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 07 '11 at 07: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 07 '11 at 21:12