I have a LaTeX document that uses font (and fontmap) files not available among the standard packages. It is compiled with pdflatex and biber.

If all the relevant font files are in the same directory as the main .tex file, then LaTeX correctly uses all fonts during compilation.

I know that the optimal way to do this would be to set all these files in an appropriate directory in the texmf tree and then set various environment variables etc. (which I do for documents I don't need to share). But the "incorrect" way above allows me to quickly share my document with other (maybe not so latex-savvy) people: I send them the directory, and they can also compile the tex file without changing their environment variables etc. For example, they can upload everything on their Overleaf account, which does the rest.

The only problem is that the directory ends up having many confusing files. I'd prefer putting all font-related files in a subdirectory instead, say "fontfiles", and if possible let LaTeX search there for them - somehow how it's done with the \graphicspath command for picture files.

I tried using putting this at the beginning of the document:


taking a hint from the answer to this question. But it doesn't work.

How could I solve this?

  • Which TeX engine you are using, e.g., LaTeX, PDFLaTeX, XeLaTeX, etc.?
    – MadyYuvi
    Commented Jun 3, 2022 at 15:05
  • @MadyYuvi pdflatex and biber. Sorry for forgetting this important info.
    – pglpm
    Commented Jun 3, 2022 at 16:10

1 Answer 1


If the purpose of this is for other people to be able to compile the files for themselves, no publisher is forcing you to use legacy file formats from last century. You can cut the Gordian knot, use OpenType font files, and load them with the fontspec option, for example:

  Ligatures={Common, TeX},
  Path = {./fonts/},
  UprightFont = {*-Regular},
  BoldFont = {*-Bold},
  ItalicFont = (*-Italic},
  BoldItalicFont = {*-BoldItalic},
  Extension = {.otf} }


This wouldn’t necessarily solve your problem, though, as you say in your other questions that you also want to put your graphics in subdirectories. However, you seem to have found other workarounds for that.

Therefore, what you want is to set your TEXINPUTS environment variable (David Carlisle suggested that you set it to the current working directory in the answer you link). TeX will then search this directory for input files, recursively.

Although you undoubtedly know this, for the sake of completeness: on Linux/Unix, the command to add to your makefile or shell script is export TEXINPUTS=graphicspath, and in a Windows batch file, it’s set TEXINPUTS=graphics\path. (Either a slash or backslash will work on Windows.)

You don’t give a MWE or say how the approach in the answer you link doesn’t work, but the answer suggests that it is supposed to work only with certain specific commands from the graphics package.

  • Thank you, I'll try the command that you list at the beginning. Does it work with pdflatex too?
    – pglpm
    Commented Jun 3, 2022 at 16:11
  • @pglpm No, it requires LuaLaTeX (or XeLaTeX, but why would anyone use that...). Commented Jun 3, 2022 at 16:24
  • @MarcelKrüger Unfortunately sometimes there are constraints, especially when collaborations are involved or publishing in some places :/
    – pglpm
    Commented Jun 3, 2022 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .