I was playing around in metafont with some symbols I needed and now I got a result that I'd like to use.

But I have two problem: I just need one, maybe two symbols, which are compiled right now using

mf filename.mf

and since I won't probably use this again for quite a long time (and I do not have much time right now), I am unable to read 99+ pages of tutorials of how to use metafont. Also, the Metafont-book (I just have to admit it, sorry), bored me to death (the TeXbook was way better I find).

Well, there are then 3 files:

filename.2602gf  filename.log  filename.mf

Now, I do not know how to continue. How can I use the one letter I created there (filename.2602gf) in my LaTeX-Document? Please, if anyone knows, tell me the shortest and easiest way since I really do not have much time left before I need to finish this.


Love the Metafontbook myself; and you likely won't be able to get very far with Metafont without reading it, as unlike the TeXbook, very few broad tutorials have been written about Metafont. Still, if you're only trying for one character, you can probably get away with it.

First, you need to put Metafont into font-making mode, rather than proof-making mode, so that it will produce a tfm file letting TeX know the dimensions of the character. Metafont will take any possible excuse to go back to proof-making mode; so I find the best way to do this is on the command line:

mf "\mode=localfont; input myfont.mf"

This will give you a tfm file (which TeX needs to set the character properly) and a gf file. Most drivers these days use compressed pk fonts rather than generic font files (gf), so you'll need to convert your gf; fortunately, this is a simple matter:

gftopk myfont.???gf myfont.pk

Now you've got myfont.tfm and myfont.pk; now TeX can use your font. The most direct way to do this is the old-school plain TeX way:


This creates a font-changing command \myfont; so when you're ready to use your character, issue that command followed by whatever character you used for your glyph. Say the character you've created is in position "a" of your font:

\myfont a

will put your character into your document. It's probably easier to write a macro to do this, so you don't have to worry about switching back to your default font every time you use the character:

    {\myfont a}%

You need the extra pair of braces on the second line or you'll permanently change the font to myfont, which only has one character in it, so you'll get a whole lot of nothing in your output.

This process will let you use your font as long as the font is in the same directory as your document; if you need to use it elsewhere, you can either copy the files, or install it the way you'd install another font in your texmf-local tree.

Hope that helps. Happy Metafonting!

  • Thank you very, very much. Maybe some later time, I will really start metafonting. Aug 23 '14 at 19:02
  • @dgoodmaniii, I follow your instructions. I use the metafont file in the example of en.wikipedia.org/wiki/Metafont and I create a TEX file in the same directory. However after compiling the TEX file the DVI viewer (Evince) said that it cannot found the referred font. Thus, I copied myfont.tmf to /usr/share/texlive/texmf-dist/fonts/tfm/urw35vf/myfont/myfont.tmf. Now the error is not displayed, but instead of the glyph I see the letter B (used to identify the character). Dec 12 '15 at 20:59
  • I'd need to see the output of your TeX and Metafont run to say anything meaningful about this. Dec 13 '15 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.