2

The following problem is appearing in TeX Live, not in MiKTeX.

The structure of my MWE project directory:

articles 
  - article1.tex
main.tex
style.sty
fontfilename.ttf       % For example: Patrick Hand.ttf (https://fonts.google.com/specimen/Patrick+Hand)

article1.tex

% !TEX program = xelatex
\documentclass[12pt]{article}
\usepackage{../style}
\begin{document}
\qtext{Lorem ipsum dolor sit amet, consectetur adipiscing elit.}
\end{document}

main.tex

% !TEX program = xelatex
\documentclass[12pt]{book}
\usepackage{style}
\begin{document}
\input{articles/article1}                           
\end{document}

style.sty

\RequirePackage{docmute}
\RequirePackage{fontspec}
\newfontfamily\quotefont{[fontfilename]} 
% \newfontfamily\quotefont{[Patrick Hand]}  % https://fonts.google.com/specimen/Patrick+Hand
\newcommand\qtext[1]{ \quotefont #1 }

The error "Package fontspec Error: The font "[fontfilename]" cannot be found." is appearing when I compile the article1.tex with texlive. But the compilation of the main.tex doesn't give the error. On the other hand, no error shows up in miktex.

I have kept this MWE as a Overleaf project too. You can check it here: https://www.overleaf.com/read/twqghjmybnxm

What do I need to configure and fix so that my project's article1.tex and main.tex can be properly compiled both on miktex and texlive?

8
  • 1
    You shouldn't have brackets around fontfilename. You could try \newfontfamily\quotefont{fontfilename.sty}, and if that doesn't work, add [Path=./].
    – Davislor
    Jul 12, 2021 at 5:54
  • 1
    this shouldn't work in miktex either, not if you start the compilation in the article folder. Add \XeTeXtracingfonts=1 to your article1.tex, compile with miktex and then show the log-file. Jul 12, 2021 at 9:50
  • 1
    the article1.log shows that miktex gets the font from your user font folder: C:/Users/koutu/AppData/Local/Microsoft/Windows/Fonts/Patrick Hand.ttf. Probably texlive can't find fonts there. Install it in your system font instead (typically that means to install "as admin"). Or use luaotfload, there we added support for user font folders. Jul 12, 2021 at 11:57
  • 2
    if you want a file, may it be your style.sty or a font file to be found from various other files in various locations then put it into the standard search path. This means either into a texmf-tree or in the case of fonts in the system font folder. Then you don't have to do convoluted things with Path and ../ syntax. Jul 12, 2021 at 12:15
  • 1
    @UlrikeFischer is right. You can find your TEXMFLOCAL tree with kpsewhich --var-value=TEXMFLOCAL. In some cases, you might want to use your TEXMFHOME tree instead. Then you can put it in a suitable subdirectory of that, such as fonts/truetype/.
    – Davislor
    Jul 12, 2021 at 18:52

1 Answer 1

1

I am facing the similar issue, you can try to load fonts like this:

\setmainfont[
    Path = /your/font/path/,
  Extension = .otf ,
  BoldFont = HelveticaNeueLTPro-Md.otf ,
]{HelveticaNeueLTPro-Roman.otf}

You must log in to answer this question.

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