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.

Duplicate:
How do I use a particular font for a small section of text in my document?

How is it possible to use a new font for just a single section of a document and switch back to the original font after that paragraph?

I have:

\fontfamily{ppl}\selectfont

Which works fine for part way through a document changing the font. But how do I revert back?

share|improve this question

marked as duplicate by Joseph Wright Aug 16 '11 at 16:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@krlmlr In what way does the accepted answer here or the linked duplicate not answer the question, such that it would need to be reopened? –  Alan Munn Sep 9 '13 at 13:50
    
@AlanMunn: The accepted answer here answers the question. However, the answer to this question is buried deeply in the longish answer(s) to the alleged duplicate, –  krlmlr Sep 9 '13 at 13:52
    
@AlanMunn: By "reopen" I just vote for removing the [duplicate] status of the question. Please feel free to undo if you think this is inappropriate. –  krlmlr Sep 9 '13 at 13:53
    
@krlmlr Since this is a very common question, having a link to a definitive answer is a useful thing, (and what prompted creating that question in the first place). Since the accepted answer here has plenty of votes (and is accepted) I'm sure plenty of people who encounter this version of the question won't get bogged down in the more detailed linked answer. But removing it altogether I don't think is a good idea. –  Alan Munn Sep 9 '13 at 13:56
    
@krlmlr I rolled back your edit but added in your clarification. –  Alan Munn Sep 9 '13 at 13:58
show 1 more comment

2 Answers

up vote 20 down vote accepted

You can always restrict the scope of font changing commands by enclosing the paragraph in braces

{\fontfamily{ppl}\selectfont ... }

If this is something you will be doing a lot, it would make more sense to turn it into a proper environment:

\newenvironment{ppl}{\fontfamily{ppl}\selectfont}{\par}

Then you use it like any other environment:

\begin{ppl}
Some text in the new font.
\end{ppl}
share|improve this answer
3  
A good idea to end these sorts of environment with \par, I think. Especially necessary, although not in this case, if the paragraph settings will change (e.g., with \small). –  Will Robertson Feb 20 '11 at 5:44
add comment

Use the fontspec package,

Then you can define new commands to select font families as \newfontfamily\cmd[font features(optional)]{Font_Name} and apply it by \NewFontName{SOME TEXT!} or {\NewFontName SOME TEXT}

An example:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\unicodefont{Lucida Grande}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\begin{document}
A legacy \TeX\ font. {\unicodefont A unicode font.}
\end{document}

You can use the \newenvironment command to define a new environment by using this new font.

share|improve this answer
3  
Note that this requires the use of XeLaTeX, not pdfLaTeX. (And strictly speaking it answers the question of how to change a font, not how to restrict the scope of the change.) –  Alan Munn Feb 20 '11 at 12:52
    
OP did not mandate the use of PdfLaTeX, and for those who use IDE like software for LaTeX work can just switch to XeLaTeX using some easy option. This is much more neat compared to the methods that require finding the LaTeX friendly font family names, which actually look nothing like the human readable versions of them. But fontspec would just accept the human readable version, which is really convenient. –  Subhamoy Sengupta Mar 9 '13 at 23:11
add comment

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