Is there any downside of using file names with \setmainfont, except for the fact that it takes more typing?

I ask because I am experiencing problems with using names for TeX Gyre fonts on my Linux Mint box: as explained here, XeLaTeX on Linux will not find TeX-installed fonts by name. Hence, I installed the fonts also system-wide (Ubuntu package tex-gyre), but the font names are different from my Windows box: the spaces are gone, so "Tex Gyre Termes" becomes "TeXGyreTermes" etc. This means that using names, the code becomes system-dependent :-( (By the way, should this be considered a bug and reported to the maintainers of the tex-gyre package?)

On the other hand, calling the font by file name should work as long as the font file names are the same - can one trusts that? And is there any other potential problem with using file names?


  • 1
    Similarly to the C/C++ #ifdef _WIN32, you can use ifplatform to detect the operating system.
    – marczellm
    Oct 28, 2013 at 11:20
  • @marczellm Thanks, I did not know about ifplatform. But it does not really help, as I do not have any guarantee that the font names are constant across all linuxes, for example. Oct 28, 2013 at 14:22
  • 2
    The disappearing spaces sound like a bug, where do you see that? But to answer your question, there is no downsides of calling fonts by file name. Oct 28, 2013 at 14:30
  • 1
    OK, I see now. That package installs only the Type1 versions of the fonts, so them not being found is actually a good thing. Oct 28, 2013 at 23:27
  • 1
    It might be an old package, but the OTF versions of the fonts are exactly the same as I get from freshly updated texlive. Anyway, I have now removed the package and instead made the TeX OTF files visible system-wide, following this guide. Strangely enough, when I open Writer, the only TeX Gyre fonts with spaces in names are Bonum and the two math versions, the rest is without spaces ... which suggests that using file names is indeed a safer option. Oct 29, 2013 at 21:12

1 Answer 1


I discussed some of the problems and choices in my article in TUGboat 117 (vol 37 no 3, 2016) at http://tug.org/TUGboat/tb37-3/tb117inn.pdf — it's basically down to how you work, what your workflow is, and how much you wish to trade off the conveniences of one against the inconveniences of the other. Basically, using filenames (and paths) ties your document to one directory structure, but it's more likely to be accurate for you. Using font names is supposed to be more system-independent, but they are sometimes weird and not always obvious.

You must log in to answer this question.

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