[metapost] Umlaute in labels
Stephan Hennig
mailing_list at arcor.de
Wed Nov 22 00:33:43 CET 2006
[I've sent this to Klaus Jantzen on 2006-11-19, but forgot to copy to
this list. Resending it now, since Taco's statement about raw font
encodings is not true as soon as LaTeX comes into play.]
Klaus Jantzen schrieb:
> how can I get umlate in to a label?
> As shown in the example I write the label as I do it in all my LaTeX
> documents, but I get only a space instead of the appropriate character.
You're on the right track already, but went only half the way.
Previewing MetaPost output is an issue on its own, since MetaPost
doesn't output standalone eps files. I think the situation will change
with the upcoming MetaPost version 1.0.
But let's stick to the old behaviour. It is possible to use 8 bit
encoded characters, both, (i) with ordinary MetaPost strings or (ii) in
TeX generated text labels.
(i) With this method input encoding has to match output encoding of the
font used.
> Can I use only a specific font? Which one?
Since I've never tried that approach, I can't tell which font
specification you had to pass to defaultfont to use umlauts this route.
(I remember statements that, e.g., ptmr8y could be a magic string for
the Times font. In contrast to ptmr8r, which I use for 7 bit labels
sometimes. In fact, ptmr8r /is/ an 8 bit encoded font, but I don't know
a matching input encoding.)
(ii) But you've already chosen to let LaTeX generate your text labels.
Here the situation is much better. You can use virtually any font LaTeX
can handle and since input encoding is handled by LaTeX 8 bit characters
can be specified in any notation LaTeX can handle. So \"o, "o (with
packages babel or ngerman) and ö (with package inputenc) are all fine.
The missing umlauts are due to the fact that MetaPost output isn't
self-contained. That is, font resources are missing and have to be
provided by the viewer application. (See the notes on variable
prologues in a recent MetaPost manual.) When the viewer doesn't know a
properly encoded font variant you may see wrong glyphs or blank space
for certain characters.
The solution is simple. As soon as you insert your MetaPost file in a
LaTeX file and process that through pdflatex or latex+dvips umlauts will
become visible. Alternative solutions are mptopdf shipped with ConTeXt
or mpstoeps which is a perl script available on CTAN. But keep sure to
set variable prologues to zero before inserting mps files in the final
LaTeX document to avoid multiple inclusion of fonts in the LaTeX run.
One additional note: Your file already contains a line
prologues:=2;
What was your intention when setting prologues to two? AFAIK, this
setting will only become useful with MetaPost v1.0.
Best regards,
Stephan Hennig
More information about the metapost
mailing list