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.

Sorry if this is a duplicate, but I can't find the right way of doing this.

I want to redefine my quote and quotation commands to use a different font. My main font is Linux Libertine O (I am using fontspec), and I want to use the small version of Linux Biolinum O inside my quotations.

Among some of the commands I've tried is this, but it ain't working:

\let\quoteOld\quote
\renewenvironment{quote}{\fontspec{Linux Biolinum O}\small\quoteOld}

Bonus question: What do I need to learn, in order to figure out how to achieve the above by myself? I would appreciate a book or resource to read.

share|improve this question
1  
On some learning resources: What's the best book to start learning LaTeX. Also, there's a lot of good information here. For example, searching for renewenvironment led to Redefining the quote environment which asks a very similar question (with a similar problem). –  Alan Munn Mar 8 '12 at 20:58
    
I guess I am asking what I need to learn/read so that I could figure out anything by myself - not only the renewenvironment command... That link looks good! Thanks –  drozzy Mar 8 '12 at 21:01
    
I understand your question, I was just saying that searching here for almost anything will turn up some good results. The renewcommand was just an (apropos) example. –  Alan Munn Mar 8 '12 at 21:11
    
I guess I also don't want to learn about all the font features that do not related to Xetex - as it does things completely differently from what I understand. Most of the books out there - cover the font with the use of the babel and such. –  drozzy Mar 8 '12 at 21:42
    
Well books are always a bit behind (unless they've just been published.) The fontspec documentation is probably all you need to know about font handling in XeLaTeX; you can ignore almost all of the rest. See also How do I use a particular font for a small section of my document. –  Alan Munn Mar 8 '12 at 21:45
add comment

3 Answers

up vote 19 down vote accepted

As I've commented on one of your other questions, you shouldn't use \fontspec to change fonts, but define a new fontfamily. The etoolbox package provides simple patching commands. For this you can just use its \AtBeginEnvironment command.

% !TEX TS-program = XeLaTeX

\documentclass{article}

\usepackage{etoolbox}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newfontfamily\quotefont{Linux Biolinum O}
\AtBeginEnvironment{quote}{\quotefont\small}
\begin{document}
Some text.
\begin{quote}
A quotation.
\end{quote}

\end{document}
share|improve this answer
add comment

Your code snippet is missing the third required argument of \renewenvironment which specifies the code to be executed at the end of the environment.

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine O}
\newfontfamily{\quotefont}{Linux Biolinum O}

\let\quoteOld\quote
\let\endquoteOld\endquote
\renewenvironment{quote}{\quotefont\small\quoteOld}{\endquoteOld}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{quote}
\lipsum*[1]
\end{quote}

\lipsum[1]

\end{document}
share|improve this answer
    
Just out of curiosity - do you get hired immediately anywhere if you have 90k rep on tex.se? –  drozzy Mar 7 '13 at 4:49
add comment

After adding the fontspec code for your font, just change the quote size.

% Using 'xelatex'
\documentclass{article}

\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\expandafter\def\expandafter\quote\expandafter{\quote\small}

\begin{document}
 Normal text.

\begin{quote}
    This is a quote.
\end{quote}

\end{document}

The line: \expandafter\def\expandafter\quote\expandafter{\quote\small} works without adding any other package.

share|improve this answer
add comment

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.