5

My company provides a pdflatex template for documents I edit. In particular, certain headings use a font that Adobe Reader calls URWGroteskT-Bold. That effect is produced as follows (standalone document that can be compiled by pdflatex):

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\newcommand{\fontcommand}[1]{{\fontfamily{ugq}\selectfont #1}} % command taken from company's style sheet, not sure what it actually does
\begin{document}
\fontcommand{The quick brown fox jumps over the lazy dog.}
\end{document}

I wish to reproduce the same behaviour while compiling with lualatex. Having read How do I use a particular font for a small section of text in my document? I tried as follows:

\documentclass{standalone}
\usepackage{fontspec}
\newfontfamily\specialfont{Grotesk T}
\begin{document}
{\specialfont The quick brown fox jumps over the lazy dog.}
\end{document}

which fails because ! Package fontspec Error: The font "GroteskT" cannot be found. I think I tried all possible variants of font name (Grotesk/Grotesque, with or without T, with or without URW, etc.)

I believe this is due to the fact that the font is not installed at the OS level, but:

  • where does pdflatex fetch the files it uses for the font?
  • is it possible to force lualatex to fetch the same files, and how?
2
  • 1
    You could load the 8bit font using exactly the same code as you use in pdftex, but usually it's better. if you have the font available as truetype or opentype to load it via fontspec. It is not clear from what you say what versions of the font you have. – David Carlisle Nov 29 '19 at 14:13
  • 1
    With the .pfb and .afm files contained in TeX Live, FontForge can produce an OpenType file. – Thérèse Nov 29 '19 at 17:52
7

The URW Grotesk font is only available as PostScript Type 1 font and can therefore not used via fontspec. However, the old font switching commands still work, when you also change the font encoding:

\newcommand{\fontcommand}[1]{{\fontencoding{T1}\fontfamily{ugq}\selectfont #1}}

This can be used with pdflatex and lualatex, e.g.:

\documentclass{standalone}
\usepackage{fontspec}
\newcommand{\fontcommand}[1]{{\fontencoding{T1}\fontfamily{ugq}\selectfont #1}}

\begin{document}
\fontcommand{The quick brown fox jumps over the lazy dog.}
\end{document}
3

Since you already have the Type 1 fonts, Ralf Stubner’s answer is likely to be more practical for you. However, URW Grotesk is a commercial font also available in TrueType and OpenType formats. Your company might have purchased the OpenType font, which you can use through the simple (but deprecated) commands

\usepackage{fontspec}

\defaultfontfeatures{Scale = MatchLowercase}
\setsansfont{URW Grotesk}

In this case, you would replace \fontfamily{ugq} with \sffamily. If this doesn’t work, you could use the newer interface:

\setsansfont{URWGrotesk}[
  UprightFont = *-Reg ,
  BoldFont = *-Bol ,
  ItalicFont = *-RegIta ,
  BoldItalicFont = *-BolIta ,
  Extension = .otf
]

Since the original template and perhaps other legacy documents refer to the NFSS font family, you could keep compatibility by adding the option, inside the square brackets, NFSSFamily = ugq. That should enable the command you gave to continue to work. You also could save a similar definition to a file named URWGrotesk.fontspec and use that to keep your source documents nice and simple. In this case, be sure to add Ligatures = Common inside the square brackets. This was the default for \setmainfont and \setsansfont, but needs to be specified for \newfontfamily.

Failing that, the closest free substitutes would be Helvetica clones such as Geneva, Arial, TeX Gyre Heros or Nimbus Sans.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.