This is a XeLaTeX question. It seems really silly to ask after many years of using fontspec
and XeLaTeX. I suppose I have always found a workaround. This time, I'd like a definitive answer.
Situation
A server (compiler/build system) is running in the background, generating documents (among other operations) from version control repositories around the clock. Documents are edited on several clients by humans. It cannot be assumed that the system fonts are the same on any of machines. There are two things that are the the same on all machines (or at least should be): 1. the TeX Live version/MikTeX. 2. The repository files. This implies that any fonts I load should either be in:
- TeX Live build-in Fonts (assuming same as MikTeX)
- Fonts files in the repository
NOT system fonts as listed by fc-list -f "%{family}\n" | sort -u
on unix-based machines.
Loading Fonts with fontspec
In fontspec, fonts are loaded several ways:
- File name with extension
e.g.
\setmainfont{texgyrepagella-regular.otf}
\let\texgyrepagellaregular\normalfont % create semantically relevant macro (name+font) to be consistent with other \newfontfamily macros
- Filename without extension but with path construction expressions given as parameters:
e.g.
\setmainfont{texgyrepagella}[
Path = /Users/will/Fonts/ ,
UprightFont = *-regular ,
BoldFont = *-bold ,]
I'd like to avoid loading fonts by typing /usr/local/texlive/<YEAR>/
[...] because they may not be located in the same location.
Attempt
\documentclass{article}
\usepackage{fontspec}
\setmonofont{Inconsolata}
\newcommand\escapedlog[1]{\par\ttfamily #1\par}
\begin{document}
Keep it simple.
\escapedlog{Hello}
\end{document}
Log Output (error)
I think I know what is happening here. fontspec
is checking the list of system fonts only fc-list -f "%{family}\n" | sort -u
.
kpathsea: Running mktextfm inconsolata
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input inconsolata
This is METAFONT, Version 2.7182818 (TeX Live 2015) (preloaded base=mf)
kpathsea: Running mktexmf inconsolata
! I can't find file `inconsolata'.
<*> ...our; mag:=1; nonstopmode; input inconsolata
Please type another input file name
! Emergency stop.
<*> ...our; mag:=1; nonstopmode; input inconsolata
Transcript written on mfput.log.
grep: inconsolata.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input inconsolata' failed to make inconsolata.tfm.
kpathsea: Appending font creation commands to missfont.log.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "inconsolata" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.3 \setmonofont{inconsolata}
?
Traditional Packages
According to this list, I should have that font installed.