10

I would like to limit the scope of \fontspec to just one or a couple of words in my paragraph, for example:

Vivamus gravida lacus a sapien \fontspec{The Font Name}{interdum} eget 
interdum mi sodales. Aenean nisi nunc, feugiat a auctor sed, consectetur
ut elit. In id tellus ac lectus ullamcorper tempor

If I just want to change the font of the word interdum, what would be the correct way to do it?

(I'm using XeLaTeX under Mac OS X 10.7.2)

  • 1
    Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it) – egreg Nov 18 '11 at 10:21
14

Use braces to create a group:

\documentclass{article}
\usepackage{fontspec}
\begin{document}

Vivamus gravida lacus a sapien {\fontspec{Arial}interdum} eget
interdum mi sodales. Aenean nisi nunc, feugiat a auctor sed, consectetur
ut elit. In id tellus ac lectus ullamcorper tempor
\end{document}
5

As an addition to Ulrike’s answer:

You could specify a new font family with \newfontfamily and then make a matching \text… command:

\newfontfamily\arial[⟨font features⟩]{Arial}
\newcommand*{\textal}[1]{{\arial #1}}

and use it like this

Vivamus gravida lacus a sapien \textal{interdum} eget
interdum mi sodales. Aenean nisi nunc, feugiat a auctor sed, consectetur
ut elit. In id tellus ac lectus ullamcorper tempor

fontspec manual section 6, p. 8.

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.