Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
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

2 Answers 2

up vote 10 down vote accepted

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}
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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