0

I am using XeLatex to compile one document with new font. I use following simple code

%!TEX TS-program = xelatex

\documentclass[10pt,a4paper]{article}
\usepackage{fontspec} 
\setmainfont[Path = /home/dex/.local/share/fonts/IBMPlex/ ]{IBMPlexSans-regular.otf}

\newfontfamily\lightFont{/home/dex/.local/share/fonts/IBMPlex/IBMPlexSans-Light.otf}

\begin{document}
    Regular Text \\
    {\lightFont Lighter Text}
\end{document}

However, this is giving me following error

line 11: Illegal unit of measure (pt inserted). ^^I{\lightFont
line 11: Missing = inserted for ifdim. ^^I{\lightFont
line 11: Missing number, treated as zero. ^^I{\lightFont
line 11: Illegal unit of measure (pt inserted). ^^I{\lightFont
line 11: Missing number, treated as zero. ^^I{\lightFont
line 11: Illegal unit of measure (pt inserted). ^^I{\lightFont
..
.. [Same as above lines repeating]
..
line 11: Font shape `TU//home/dex' undefined(Font) using `TU/lmr/m/n' instead

I can compile properly with my desired font if I comment out {\lightFont Lighter Text}. What is going on here?

I am using TexLive in Debian Buster and my TexStudio is compiling it with following command

"/home/dex/texlive/2019/bin/x86_64-linux/xelatex" -synctex=1 -interaction=nonstopmode "test".tex

I have tried compiling it with directly with terminal but no luck. Surprisingly, this file compiles properly in Windows 10 with MikTex 2.9 and TexStudio. It seems to me that something was not properly installed while installing TexLive. Any Idea what?

  • 2
    don't use an absolute path in the \lightFont definition, use an optional argument and a Path option like you did in \setmainfont. – Ulrike Fischer Jul 18 '19 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.