15

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.

5
  • 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, 2012 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 Mar 8, 2012 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, 2012 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. Mar 8, 2012 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, 2012 at 21:45

3 Answers 3

24

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}
4

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}
1
  • 3
    Just out of curiosity - do you get hired immediately anywhere if you have 90k rep on tex.se? Mar 7, 2013 at 4:49
3

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.

You must log in to answer this question.

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