1

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
  • 1
    Your code is for pdflatex. XeLaTeX requires fontspec package, see my answer.
    – user56567
    Jul 20, 2014 at 20:31

1 Answer 1

6

You can use Latin Modern Sans Serif:

\documentclass{article}

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

\begin{document}
\textsf{A simple example}
\end{document}
2
  • OK, it works ... how do I set the default font for the entire document to sans serif? Jul 20, 2014 at 20:36
  • 7
    Put \setmainfont{Latin Modern Sans} in the preamble.
    – user56567
    Jul 20, 2014 at 20:43

You must log in to answer this question.

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