While editing a LaTeX file in Vim with the LaTeX-Box and syntastic plugins and compiling using XeLaTeX, I got this warning:

Don't use "\font" in LaTeX documents

for these two lines:

\font\ttfstandard Ubuntu at12pt
\font\ttfbold "Ubuntu Bold" at12pt

Is \font deprecated or otherwise harmful? If not, why would I have got this message? What should I use instead?

  • Yes, it's deprecated. Load fontspec instead. – egreg Jul 17 '15 at 20:03

Yes, using \font in LaTeX is deprecated. The reason is very simple: try the following sample file.


\font\ttfstandard="Ubuntu" at 12pt
\font\ttfbold="Ubuntu Bold" at 12pt


\section{A title with an {\ttfstandard Ubuntu} word}

Some text and an {\ttfstandard Ubuntu} word.


enter image description here

As you clearly see, the font doesn't honor the size changing commands.

Try instead the following example:





\section{A title with an \textsf{Ubuntu} word}

Some text and an \textsf{Ubuntu} word.


enter image description here

You can see that the size is honored and also that boldface is automatically selected in the section title.

You may want to have Scale=MatchUppercase, which would give

enter image description here

The choice depends much on how you want to use the sans serif type. If in isolation, MatchUppercase may be preferable; if interspersed with serif type, I'd go with MatchLowercase.

  • Thanks. Do fontenc and fontspec work well together? Or does that warrant a different question? – muru Jul 17 '15 at 20:34
  • 2
    You do not need fontenc nor inputenc with xelatex. Just load fontspec – MaxNoe Jul 17 '15 at 20:37

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.