0

How can I set the default sans serif font to the default in this example in XeLaTeX? I can only get Helvetica with

\documentclass{article}

\usepackage[a4paper,margin=5pt]{geometry}

\usepackage{fontenc}
\usepackage{times,multicol,graphicx}
\usepackage[usenames,dvipsnames]{color}
\pagestyle{empty}

\begin{document}

and I get an error if I use \setsansfont{CMU Sans Serif} in the preamble.

  • 1
    Your code is for pdflatex. XeLaTeX requires fontspec package, see my answer. – user56567 Jul 20 '14 at 20:31
3

You can use Latin Modern Sans Serif:

\documentclass{article}

\usepackage{fontspec}
\setsansfont{Latin Modern Sans}

\begin{document}
\textsf{A simple example}
\end{document}
| improve this answer | |
  • OK, it works ... how do I set the default font for the entire document to sans serif? – Medulla Oblongata Jul 20 '14 at 20:36
  • 5
    Put \setmainfont{Latin Modern Sans} in the preamble. – user56567 Jul 20 '14 at 20:43

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.