Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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:

\font\myfont=myfont

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:

\def\myglyph{%
    {\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!

share|improve this answer
    
Thank you very, very much. Maybe some later time, I will really start metafonting. –  clueless_me Aug 23 at 19:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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