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 have a document which I render with pdflatex that uses some various "weird" (i.e., not generally included in a standard TeX distribution) fonts. It would be convenient for me to be able to bundle these fonts with the document, so it could be easily rendered on other machines, without installing these extra packages. Say my directory structure looks like this:

mydocument.tex
texmf/
    doc/
    enc/
    map/
    opentype/
    tex/
    tfm/
    type1/
    vf/

Is there perhaps a command I can add to my document's header which instructs pdflatex to search inside the texmf directory next to the document for fonts? This would be much more convenient than having to copy the contents of that directory into ~/texmf or /usr/share/texmf or wherever on each machine I'd like to render my document on.

Edit:

As a test, I'm trying to load the font Gillius. For what it's worth, here's my TeX code which is instructing my document to use this font:

\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[default]{gillius}

I have tried running pdflatex with the command: TEXMFHOME=./texmf pdflatex invoice.tex, which seems to mostly work - at the very least, the gillius.sty file is properly located for the font. However, it seems unable to locate the font's files in texmf/tfm/ - namely, this is the error I get:

$ TEXMFHOME=./texmf pdflatex invoice.tex 

[... omitted for brevity ...]

(./texmf/tex/T1GilliusADF-LF.fd)
kpathsea: Running mktextfm GilliusADF-Regular-lf-t1
/usr/share/texmf/web2c/mktexnam: Could not map source abbreviation G for GilliusADF-Regular-lf-t1.
/usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-dist/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input GilliusADF-Regular-lf-t1
This is METAFONT, Version 2.718281 (TeX Live 2012)


kpathsea: Running mktexmf GilliusADF-Regular-lf-t1
! I can't find file `GilliusADF-Regular-lf-t1'.
<*> ...nonstopmode; input GilliusADF-Regular-lf-t1

Please type another input file name
! Emergency stop.
<*> ...nonstopmode; input GilliusADF-Regular-lf-t1

Transcript written on mfput.log.
grep: GilliusADF-Regular-lf-t1.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input GilliusADF-Regular-lf-t1' failed to make GilliusADF-Regular-lf-t1.tfm.
kpathsea: Appending font creation commands to missfont.log.

! Font T1/GilliusADF-LF/m/n/10=GilliusADF-Regular-lf-t1 at 10.0pt not loadable:
 Metric (TFM) file not found.
<to be read again> 
                   relax 
l.91 \begin{document}

?

I have verified that the file pdflatex mentions does indeed exist, at ./texmf/tfm/GilliusADF-Regular-lf-t1.tfm. Is there perhaps some other environment variable that controls where pdflatex searches for *.tfm files?

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

Generally, TEXMFHOME is expected to follow the TDS (Texmf Directory Standard). If you put the various font directories (enc, map, opentype, tfm, type1, and vf) under texmf/fonts/, then what you did should work.

You might be able to modify the standard variables TFMFONTS, T1FONTS, OPENTYPEFONTS, etc., so as to leave your directory structure as it is. But it is not so obvious what they should be set to (you want to keep the usual directories still accessible). And it would be a pain to change them all. There is one for each type of font file (search texmf.cnf for all the possibilities) and the name is not always obvious (TEXFONTMAPS for the map files, ENCFONTS for encoding files).

share|improve this answer
    
+1 oops I hadn't spotted the local structure was wrong. –  David Carlisle Jun 18 at 18:48
    
This was exactly the issue. After moving those folders into the proper location, it works perfectly. Thanks! :) –  CmdrMoozy Jun 18 at 19:03
add comment

assuming bash or a similar shell:

TEXMFHOME=./texmf pdflatex mydocument

ought to work

share|improve this answer
    
Thanks for such a quick answer! This seems to very nearly work. However, pdflatex still can't find some of the font's files. See my edited OP. –  CmdrMoozy Jun 18 at 18:02
    
ah I hadn't noticed that your local structure wasn't matching TDS, see @Dan's answer. –  David Carlisle Jun 18 at 18:47
    
With that small correction, this works perfectly. For some reason that particular font, Gillius, isn't packaged according to the TDS - I looked at some other fonts at random, and they are all packaged correctly. Anyway, thanks again! :) –  CmdrMoozy Jun 18 at 19:10
1  
@CmdrMoozy CTAN don't want them packaged according to TDS unless the TDS is an additional archive. You can make them more-TDS-ish but if you make them completely TDS-ish, the package gets rejected. The idea of this is that for online browsing, full TDS is a pain because everything you want to see is buried in layer upon layer of sub-directories. Since most packages get installed by package managers rather than people, I guess this makes sense. –  cfr Jun 19 at 0:03
add comment

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.