Although I've found a way to install fonts, I would like to distribute a .tex document along with any font it's using and be able to compile it without having to install these fonts.

For instance, I would distribute the .tex file along with the .afm, .dvi or whatever format, in such a way that another author could edit the document and compile it with texlive or miktex (or any other under any platform) without having to install the fonts, just use the local redistributed ones.

Is this possible? How?

Thanks in advance.

  • 1
    There is if nothing else a significant legal hurdle here. If we are talking about commercial fonts then you can't redistribute the files unless you have appropriate permission. – Joseph Wright Dec 22 '11 at 16:56
  • It's for internal documentation of a privately-held company. I'm not thinking in redistributing copyrighted fonts... at all. In this company some authors use MS Windows and other use Linux. I want to avoid having to install fonts everywhere. – mschonaker Dec 22 '11 at 17:45

Assuming the font redistribution is legal, I would suggest that using XeLaTeX is the easiest way to ensure the portability. There are two possibilities:

Have users install the font

Since XeLaTeX can use any system font, and installing fonts on most systems is quite simple, the most robust solution would be to distribute the font, and have users install it using the regular methods for font installation (which I think on most systems involves dragging the file to the main Fonts folder.) If the font in question is already installed as a system font, all the better.

The advantages of this method are:

  1. It doesn't matter where in the system the document is, it will still compile correctly.
  2. Subsequent documents don't need to be distributed with the font.
  3. The font is loaded by its regular name.
  4. Different weights/faces of the font will automatically be available.

See the XeLaTeX answer to this question: How do I use a particular font for a small section of text in my document? for more details of font loading in XeLaTeX.

Load the font locally

If you really don't want users to have to install anything (or for administrative reasons they can't) it is possible for XeLaTeX to load fonts by filename. In this way the font can be in the same folder as the document (or some subfolder within it).

This method has the following disadvantages:

  1. The source file must remain in the same folder as the font (folder).
  2. The font must be distributed with each document.
  3. The font is loaded by filename, which may be different across platforms.
  4. Different weights/faces must be loaded separately.

A compromise solution if users have access to shared disk space would be to use this method but have the fonts in a shared location.

See Load fonts that are in a ./fonts directory for details on how to implement these solutions.

| improve this answer | |

You could use the perl script mkjobtexmf (on CTAN) to generate a small texmf-tree which contains all necessary files (you should exclude at least the format files with e.g. --exclude-ext=fmt).

Then the user needs only to know how to add a texmf-tree to their system. For miktex this is easy: They can add it with miktex-settings or with initexmf --register-root. TeXLive users must add the path e.g. to TEXMFHOME or TEXMFLOCAL.

If you don't want that you users must run updmap you should add necessary map-files directly in the document with \pdfmapfile{...} (if you use pdftex).

| improve this answer | |

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.