0
\documentclass{article}
\usepackage{fontspec}
\setmainfont{/local/path/to/cienfuegos}[ Extension=.ttf ] \begin{document}
\begin{itemize} \item HellO \end{itemize}
\end{document}

/tex/latex/fontspec/fontspec.cfg)))


LaTeX Font Warning: Font shape TU//home/r' undefined
(Font)              using TU/lmr/m/n' instead on input line 11.

! Illegal unit of measure (pt inserted).

t
l.11 ^^I]

Advice of changes to make please?

7
  • 1
    That's the default fontspec.cfg file. You don't need to copy it anywhere. But the error has nothing to do with it. Please, add some code that shows the issue.
    – egreg
    Jul 1, 2023 at 21:19
  • 3
    as I said in github when you posted there, you have shown no information to allow anyone to help. You need to show an example Jul 1, 2023 at 21:36
  • Do you actually have the words “line 11:” in your file, not commented out with a %?
    – Thérèse
    Jul 1, 2023 at 21:47
  • 2
    You can edit your post using the edit link at the bottom left to add the example.
    – cfr
    Jul 2, 2023 at 0:49
  • 1
    "line 11' added manually" don't do that. (a) it means no one can use the file to reproduce the error (b) the small fragment of log you show showed the error was not in fontspec.cfg but line 11 of some code you had not shown. Jul 2, 2023 at 9:07

1 Answer 1

2

When you do

\setmainfont{<fontname>}[<options>]

TeX (either XeTeX or LuaTeX) wants in the mandatory argument something it can fully interpret. It can be a file name (but not with a path) or the PostScript name of a font present on your system.

For instance, on my system I can do

\setmainfont{Times New Roman}

because it is known as an internal font name to the OS; interaction with the system libraries also makes it possible for TeX to guess also the fonts to associate with italics and boldface.

The mandatory argument can als be a file name with extension and in this case TeX will look for it in the relevant directories of the TeX trees.

If you want to load a font in a nonstandard directory, use the Path key:

\setmainfont{cienfuegos}[
  Path=/path/to/,
  Extension=.ttf
]

Suppose your font files follow nonstandard naming conventions, so you have bizarre.ttf for upright medium shape, bizarrei.ttf for italic, bizarreb.ttf for boldface and bizarrebi.ttf for bold italic. You can do

\setmainfont{bizarre}[
  Path=/path/to/,
  Extension=.ttf,
  UprightFont=*,
  ItalicFont=*i,
  BoldFont=*b,
  BoldItalicFont=*bi,
]

where the * will be replaced by the mandatory argument.

You must log in to answer this question.

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