I'd like to achieve the following: a user should be able to grab a copy of a given directory, place that anywhere in his home directory, and run make to build LaTeX documents in that tree without modifying his own configuration. The documents in that tree depend on custom truetype fonts, and the provider of these fonts suggests using updmap-sys to install these. But requiring users to install these fonts system-wide is unacceptable, and even having to install them locally should be avoided.

The best I could find so far are the following rules, added to my Makefile:

export TEXMFHOME=$(CURDIR)/texmf
export TEXINPUTS=$(CURDIR)/styles:$(CURDIR)/texmf:

texmf/web2c/updmap.cnf: texmf/fonts/map/dvips/tumhelv/tumhelv.map
    @mkdir -p $(@D)
    @echo -n "" > $@
    updmap --cnffile $(TEXMFHOME)/web2c/updmap.cnf \
        --dvipdfmxoutputdir $(TEXMFHOME)/fonts/map/dvipdfmx/updmap \
        --dvipsoutputdir $(TEXMFHOME)/fonts/map/dvips/updmap \
        --pdftexoutputdir $(TEXMFHOME)/fonts/map/pdftex/updmap \
        --pxdvioutputdir $(TEXMFHOME)/fonts/map/pxdvi/updmap \
        --setoption dvipsPreferOutline=true \
        --setoption pdftexDownloadBase14=true \
        --enable Map=customFont.map

This apparently does install the fonts in the texmf subtree of the directory where my Makefile resides. I haven't even begun checking whether the font is actually available, because suddenly my pdflatex starts using bitmap font instead of outline fonts. I added the two --setoption lines above, copied from the updmap.cnf of my main TeXlive texmf tree, but they changed nothing.

I also noticed that updmap will create a file ~/Library/texlive/2012/texmf-var/web2c/updmap.log (on OS X), but I guess a single additional environment variable should take care of that.

How can I use environment variables to install a font without modifying the user's configuration, and still use outline fonts in my PDF files?

  • Well if you call updmap you will (ove)rwrite map-files and so change the configuration of the users - and you will disable the working of updmap-sys and so actually confuse the configuration of quite a number of users. – Ulrike Fischer Oct 22 '13 at 10:42

I believe I found an answer to this problem. The most useful resource to this was Font installation the shallow way by Siep Kroonenberg (which is also available as a TUGboat article).

That article describes how you can simply drop font related files into the current directory, and use \pdfmapfile{=myFont.map} to add a single map file to the list of map files used by pdflatex. No call to updmap involved. The article also goes to some lengths about how to obtain metric files (*.tfm) and map files, but since both of these were provided in my case, \pdfmapfile was the most useful hint there.

Now in my case, I wanted files in a separate texmf tree instead of the current directory. In the end, I had to override five different environment variables to achieve this goal:

export TEXINPUTS=$(CURDIR)/styles:$(CURDIR)/texmf//:
export TFMFONTS=$(CURDIR)/texmf/fonts/tfm//:
export TEXFONTMAPS=$(CURDIR)/texmf/fonts/map//:
export TTFONTS=$(CURDIR)/texmf/fonts/truetype//:
export ENCFONTS=$(CURDIR)/texmf/fonts/enc//:

Looking at the texmf/web2c/texmf.cnf file of my TeXlive distribution (see kpsewhich --all texmf.cnf to find yours), as well as the output of pdflatex -kpathsea-debug=-1 (also read about Kpathsea debugging), was extremely helpful in figuring out which settings to override. Notice the colon at the end of each variable, which means prepending the stated value to the default value. Also note the double slashes, which means recursively searching the whole tree. So far this texmf tree is small enough that I don't bother maintaining a ls-R database for it. If I did, I'd probably have to export TEXMFDBS as well.

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.