1

I don't have e.g. Helvetica, yet would like to use its clone that can be used with pdflatex, but instead use it with xelatex. I have tried

\usepackage{fontspec}
\usepackage{helvet}
\newfontfamily{\phv}{Helvetica}

Which tells me fontspec can't find Helvetica.

\usepackage{fontspec}
\newfontfamily{\arial}{Arial}
\usepackage{sectsty}
\allsectionsfont{\arial}

Which works, since I'm on a windows machine and arial is installed.

%\usepackage{fontspec}
\usepackage{helvet}
\newfontfamily{\phv}{Helvetica}

Which works with pdflatex. Switching back

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\usepackage{helvet}
\setsansfont{Helvetica} % <-- doesn't work, since I don't have the font installed on my system
%\newfontfamily{\phv}{Helvetica}
\renewcommand{\familydefault}{\sfdefault}

\section{first section}

some text which should be in helvetica

\end{document}

MWE that I wish to be working:

\documentclass{article}
\usepackage{fontspec}
\usepackage{helvet}
\newfontfamily{\phv}{Helvetica}
\usepackage{sectsty}
\allsectionsfont{\phv}

\begin{document}

\section{first section}

some text which should not be in helvetica

\end{document}

I'm sorry, but I won't take the time to get into LuaTeX atm. I'm at a loss as to what I should try, and how, and in which order.

1 Answer 1

5

Use the clone TeX Gyre Heros:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\setsansfont{TeX Gyre Heros}

\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\section{first section}

some text which should be in helvetica

\end{document}

enter image description here

3
  • So it isn't possible to use fonts installed in the texmf tree with xelatex? Only fonts installed system-wise?
    – thymaro
    May 15, 2018 at 14:26
  • I'm sorry, the question is way too complicated for what I want to achieve. I'm just insterested in accessing fonts not installed on my machine, but in the tex distro, using xelatex. Is that possible?
    – thymaro
    May 15, 2018 at 14:27
  • 1
    tex gyre heros is in the texmf tree. One my system in texlive/2018/texmf-dist/fonts/opentype/public/tex-gyre/texgyreheros-regular.otf. If you are on linux you need to enable the name search for xetex (tug.org/texlive/doc/texlive-en/texlive-en.html#x1-340003.4.4), or use file names instead. Or simply use lualatex which will work out-of-box. May 15, 2018 at 14:37

You must log in to answer this question.

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