# Block quote with big quotation marks

How can I create a block quote enviroment with big quotation marks similar to the Cquote Template of Wikipedia?

Additionally it would be nice to place both quotation marks and quote in a colored box and to have the author closer to the citation.

Here's one solution using TikZ which defines a new environment using the framed package. You should preferably compile this with xelatex or lualatex, since it gives the easiest access to a wide range of fonts. I've added code to make it run under pdflatex as well.

The code has now been updated to allow some flexibility in the formatting of the different components of the quotation, and the environment takes two arguments:

## Environment Syntax

 \begin{shadequote}[<alignment>]{<author>}
text of quote


## Code

% !TEX TS-program = xeLaTeX

\documentclass[12pt]{article}
\usepackage{ifxetex,ifluatex}
\usepackage{etoolbox}
\usepackage[svgnames]{xcolor}

\usepackage{tikz}

\usepackage{framed}

% conditional for xetex or luatex
\newif\ifxetexorluatex
\ifxetex
\xetexorluatextrue
\else
\ifluatex
\xetexorluatextrue
\else
\xetexorluatexfalse
\fi
\fi
%
\ifxetexorluatex%
\usepackage{fontspec}
\usepackage{libertine} % or use \setmainfont to choose any font on your system
\newfontfamily\quotefont[Ligatures=TeX]{Linux Libertine O} % selects Libertine as the quote font
\else
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine} % or any other font package
\newcommand*\quotefont{\fontfamily{LinuxLibertineT-LF}} % selects Libertine as the quote font
\fi

\newcommand*\quotesize{60} % if quote size changes, need a way to make shifts relative
% Make commands for the quotes
\newcommand*{\openquote}
{\tikz[remember picture,overlay,xshift=-4ex,yshift=-2.5ex]
\node (OQ) {\quotefont\fontsize{\quotesize}{\quotesize}\selectfont};\kern0pt}

\newcommand*{\closequote}[1]
{\tikz[remember picture,overlay,xshift=4ex,yshift={#1}]
\node (CQ) {\quotefont\fontsize{\quotesize}{\quotesize}\selectfont''};}

% select a colour for the shading

\newcommand*\shadedauthorformat{\emph} % define format for the author argument

% Now a command to allow left, right and centre alignment of the author
\newcommand*\authoralign[1]{%
\if#1l
\def\authorfill{}\def\quotefill{\hfill}
\else
\if#1r
\def\authorfill{\hfill}\def\quotefill{}
\else
\if#1c
\gdef\authorfill{\hfill}\def\quotefill{\hfill}
\else\typeout{Invalid option}
\fi
\fi
\fi}
% wrap everything in its own environment which takes one argument (author) and one optional argument
% specifying the alignment [l, r or c]
%
{\authoralign{#1}
\ifblank{#2}

\begin{document}

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

\end{document}


In this code, the font for the quotation marks is set independently of the main document font. This is because depending on the main font you choose, the very large quotation marks will not look good; Linux Libertine has pretty quotes that seem appropriate for the purpose. If you want to use this environment with another main document font, remove/change the \usepackage{libertine}.

## Sample output

• @Alun: Why do you define \quotefont? libertine is already present. – user2478 Apr 30 '11 at 14:32
• @Herbert Because these are decorative elements, it makes sense to define the font for the quotes independent of the document font. For example, if you just use Computer Modern, the big quotes look quite silly; The libertine font has a pretty quote for this purpose, and I would use it with most document fonts. – Alan Munn Apr 30 '11 at 14:53
• @Alun: You know, that I know that ... ;-) But then it makes sense to use another text font in your example, if you want to show this behaviour. – user2478 Apr 30 '11 at 17:32
• @Chernoff I'm not sure why this happens, but you can adjust the value of xshift in the \closequote macro to 1ex (or similar values) to adjust the positioning of the quote. – Alan Munn Jun 30 '18 at 16:02
• @Chernoff Again, not sure the reason, but you can add \vspace{1ex} (or similar value) before the \emph in the \shadedauthorformat definition. – Alan Munn Jun 30 '18 at 16:41

(We just got another question asking for something similar: Quote style like on owni.eu. I wasn't aware of this question when I started to answer that one, but on becoming aware of it decided to post my answer here instead.)

It's also TikZ-based but slightly different to Alan's as the whole thing ends up in a TikZ node. This does mean that it won't work with page-breaking. One could also adapt the quote marks from Alan's version to make them look a bit better.

Here's the result:

And here's the code:

\documentclass{article}
\thispagestyle{empty}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\makeatletter

\tikzset{%
fancy quotes/.style={
text width=\fq@width pt,
align=justify,
inner sep=1em,
anchor=north west,
minimum width=\linewidth,
},
fancy quotes width/.initial={.8\linewidth},
fancy quotes marks/.style={
scale=8,
text=white,
inner sep=0pt,
},
fancy quotes opening/.style={
fancy quotes marks,
},
fancy quotes closing/.style={
fancy quotes marks,
},
fancy quotes background/.style={
show background rectangle,
inner frame xsep=0pt,
background rectangle/.style={
fill=gray!25,
rounded corners,
},
}
}

\newenvironment{fancyquotes}[1][]{%
\noindent
\tikzpicture[fancy quotes background]
\node[fancy quotes opening,anchor=north west] (fq@ul) at (0,0) {};
\tikz@scan@one@point\pgfutil@firstofone(fq@ul.east)
\pgfmathsetmacro{\fq@width}{\linewidth - 2*\pgf@x}
\node[fancy quotes,#1] (fq@txt) at (fq@ul.north west) \bgroup}
{\egroup;
\node[overlay,fancy quotes closing,anchor=east] at (fq@txt.south east) {''};
\endtikzpicture}

\makeatother

\begin{document}
\lipsum[1]

\begin{fancyquotes}
\lipsum[1]
\end{fancyquotes}

\lipsum[1]
\end{document}


The lipsum package is just to provide some dummy text.

• I like this one a lot and have started to use it in my documents. Thanks! – adl Jan 26 '12 at 16:46
• This looks seriously good in documents. Thanks! – tchakravarty Jul 25 '12 at 6:53
• Just had a request on TeXwelt.de to have the box in twocolumn mode taking up just one column. Basically, s/textwidth/columnwidth/g. Can you add a line explaining and maybe another screenshot? – Johannes_B Feb 13 '15 at 16:44
• @Johannes_B Feel free to edit the answer with that change. As this is over three years old, I don't feel able to resurrect it myself. – Andrew Stacey Feb 14 '15 at 19:34
• @Johannes_B @LoopSpace This is great! This creates no spacing between paragraphs within the block quote, however. How can I modify it so that there is normal spacing between paragraphs within the fancyquotes environment? I tried adding \setlength{\baselineskip}{16pt} and \setlength{\parskip}{\baselineskip} but neither one worked. – incandescentman Dec 21 '16 at 5:31
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage{graphicx}
\usepackage[svgnames]{xcolor}
\usepackage{framed}

\newcommand*\openquote{\makebox(25,-22){\scalebox{5}{}}}
\newcommand*\closequote{\makebox(25,-22){\scalebox{5}{''}}}

\makeatletter
\newif\if@right
\makeatother
\begin{document}

Some quoted words

Some quoted words

A common mistake that people make when trying to design something completely
foolproof is to underestimate the ingenuity of complete fools.\par\emph{Douglas Adams}

\end{document}


• Using your code in a minimal example works great, but when I copy it to a large document I work on I get the error "You can't use '\spacefactor' in vertical mode". Do you have any idea how to resolve this problem? Thanks! – lumbric Mar 21 '12 at 22:39
• you'd forgotten the makeatletter ... makeatother – user2478 Mar 22 '12 at 11:09
• Thanks a lot! It took me quite a while to figure out what happend, but you were right, I messed up the \makeatletter and \makeatother commands. This happend after exporting some code from LyX, at this step LyX put some additional \makeatletter and \makeatother around my custom code. – lumbric Mar 26 '12 at 21:22
• If there is a line break before the closing quote, it looks a bit strange. I don't have a real good suggestion, but I think placing simple a nolinebreak makes things a bit better. This means one would have to replace the line \if@right\hfill\fi\closequote\end{quote}\end{snugshade}} by \nolinebreak\if@right\hfill\fi\closequote\end{quote}\end{snugshade}}. This is a comment and not an edit, because I'm unsure if it's the best solution. – lumbric Mar 28 '12 at 20:28
• I'm trying to use this in my thesis which is based on classicthesis but the problem is, it mess with all my fonts and change them. What am I doing wrong here? The same holds for @Herbert 's answer. – Pouya Sep 25 '13 at 15:31

I know that this is old, but I may as well share my simple attempt.

Note: requires \usepackage{xcolor}

The command itself:

\newcommand{\quotebox}[1]{\begin{center}\fcolorbox{white}{blue!15!gray!15}{\begin{minipage}{0.9\linewidth}\vspace{10pt}\center\begin{minipage}{0.8\linewidth}{\space\Huge}{#1}{\hspace{1.5em}\break\null\Huge\hfill''}\end{minipage}\smallbreak\end{minipage}}\end{center}}


Minimum working example:

\documentclass{article}
\usepackage{xcolor}
\newcommand{\quotebox}[1]{\begin{center}\fcolorbox{white}{blue!15!gray!15}{\begin{minipage}{0.9\linewidth}\vspace{10pt}\center\begin{minipage}{0.8\linewidth}{\space\Huge}{#1}{\hspace{1.5em}\break\null\Huge\hfill''}\end{minipage}\smallbreak\end{minipage}}\end{center}}

\begin{document}
\quotebox{Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.}
\end{document}


Example:

Had I known about this question, I would not have written cfr-dquote. However, I didn't, so I did. Here's a lightly modified version of my package for public consumption or rejection.

The package defines a command, \dquote[<dimension>]{<long text>}{<short text} which is intended to be used so that <dimension> is the width desired, <long text> is the quotation and <short text> is the attribution.

The package is based on TikZ and the appearance can be customised using the usual key-value interface. For example, I've never used this with a coloured background to the quotation, but that is easy to achieve by simply altering quote style.

For example,

\documentclass[a4paper,british]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry,babel,csquotes}
\usepackage{cfr-lm}
\usepackage{cfr-dquote}
\MakeAutoQuote{‘}{’}
\MakeAutoQuote*{“}{”}
\begin{document}
\tikzset{%
dquote text font=\fontfamily{LobsterTwo-LF}\selectfont\Large\upshape,
dquote attrib font=\fontfamily{LobsterTwo-LF}\selectfont\Huge\itshape,
dquote={
quote style/.style={align=justify, fill=blue!50!cyan, fill opacity=.2, text opacity=1, text=blue!15!darkgray},
marks={
size=\Huge,
scale=4,
color=blue!50!darkgray,
opacity=.5,
},
},
}%
\dquote{%
‘Come, we shall have some fun now!’ thought Alice. ‘I'm glad they've begun asking riddles --- I believe I can guess that,’ she added aloud.

‘Do you mean that you think you can find out the answer to it?’ said the March Hare.

‘Exactly so,’ said Alice.

‘Then you should say what you mean,’ the March Hare went on.

‘I do,’ Alice hastily replied; ‘at least --- at least I mean what I say --- that's the same thing, you know.’

‘Not the same thing a bit!’ said the Hatter. ‘Why, you might just as well say that ‘I see what I eat’ is the same thing as ‘I eat what I see’!’

‘You might just as well say,’ added the March Hare, ‘that ‘I like what I get’ is the same thing as ‘I get what I like’!’

‘You might just as well say,’ added the Dormouse, which seemed to be talking in its sleep, ‘that ‘I breathe when I sleep’ is the same thing as ‘I sleep when I breathe’!’
}{Lewis Carroll}

\end{document}


produces the following output

The package consists of two files, cfr-dquote.sty and cfr-dquote.tex. In theory, the latter can be compiled alone, since it uses the standalone class, but don't be tempted to use it this way - that's just to make tweaks and debugging easier.

Complete code:

\begin{filecontents}{cfr-dquote.sty}
% !TEX encoding = UTF-8 Unicode
% cfr-dquote.sty
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/12/01]% LaTeX date must December 1994 or later
\RequirePackage{svn-prov}
\ProvidesPackageSVN{$Id: cfr-dquote.sty 7799 2018-07-20 01:52:15Z cfr$}
\RequirePackage{xcolor,pifont,standalone,xparse,tikz}
\usetikzlibrary{calc,positioning,backgrounds}
\IfFileExists{tikzlibrarypicfix.code.tex}{\usetikzlibrary{picfix}}{}
\IfFileExists{tikzlibrarycfrexternal.code.tex}{\usetikzlibrary{cfrexternal}}{\usetikzlibrary{external}}
\NewDocumentCommand\dquotetextfonthook{}{\normalfont\large}
\NewDocumentCommand\dquoteattribfonthook{}{\normalfont\normalsize}
\AtBeginDocument{%
\newlength\cfrdquoteparskip\setlength\cfrdquoteparskip{\parskip}%
\newlength\cfrdquoteparindent\setlength\cfrdquoteparindent{\parindent}}
% BEGIN defaults
\tikzset{%
dquote text font/.code={%
\RenewDocumentCommand\dquotetextfonthook{}{#1}
},
dquote attrib font/.code={%
\RenewDocumentCommand\dquoteattribfonthook{}{#1}
},
dquote/.code={%
\tikzset{%
/cfr-dquote/.cd,
#1
}
},
/cfr-dquote/quote style/.style={align=justify, color=blue!50!black},
/cfr-dquote/quote/.style={/cfr-dquote/quote style, font=\dquotetextfonthook},
/cfr-dquote/attrib/.style={/cfr-dquote/quote style, font=\dquoteattribfonthook},
/cfr-dquote/quote mark/.style={color=\cfrdquotecolor, opacity=\cfrdquoteopacity, font=\cfrdquotesize, scale=\cfrdquotescale},
/cfr-dquote/.cd,
width/.store in=\cfrdquotewidth,
text/.store in=\cfrdquotetext,
width=120mm,
text={Does dim o gwbl yn y fan hon!},
marks/.code={%
\tikzset{%
/cfr-dquote/quote marks/.cd,
#1
}
},
quote marks/size/.store in=\cfrdquotesize,
quote marks/scale/.store in=\cfrdquotescale,
quote marks/color/.store in=\cfrdquotecolor,
quote marks/opacity/.store in=\cfrdquoteopacity,
marks={
size=\Huge,
scale=4,
color=blue!50!cyan,
opacity=.25,
},
}
% END defaults
% BEGIN defn \dquote
\NewDocumentCommand\dquote { O {120mm} +m m }{%
\tikzset{%
external/export next=false,
/cfr-dquote/.cd,
width={#1},
text={\setlength\parskip{\cfrdquoteparskip}\setlength\parindent{\cfrdquoteparindent}#2},
}%
\input{cfr-dquote}%
}
% END defn \dquote
\endinput
\end{filecontents}
\begin{filecontents}{cfr-dquote.tex}
% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
% arara: pdflatex: { synctex: true }
%BEGIN preamble
\csname standaloneignore\endcsname
\pdfminorversion=7
\PassOptionsToPackage{rgb}{xcolor}
\RequirePackage{svn-prov}
\ProvidesFileSVN{$Id: cfr-dquote.tex 7800 2018-07-20 01:58:28Z cfr$}
\documentclass[tikz,12pt]{standalone}
\usetikzlibrary{calc,positioning,backgrounds}
\usepackage{pifont,biblatex}
% END preamble

\begin{document}%
\begin{tikzpicture}[node distance=0pt]
\node (quotation) [/cfr-dquote/quote, text width=\cfrdquotewidth]  {\cfrdquotetext};
\node (attrib) [/cfr-dquote/attrib, below=of quotation, text width=\cfrdquotewidth] {\cfrdquoteattrib};
\node (qlhs) [left=of quotation.north west, /cfr-dquote/quote mark, xshift=.25em, yshift=.25em, anchor=north east] {\ding{123}};
\node (qrhs) [right=of quotation.south east, /cfr-dquote/quote mark, xshift=-.25em, yshift=-.75em, anchor=south west] {\ding{124}};
\pgfresetboundingbox
\useasboundingbox (attrib.south -| qlhs.west) rectangle (quotation.north -| qrhs.east);
\end{tikzpicture}%
\end{document}
\end{filecontents}

\documentclass[a4paper,british]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry,babel,csquotes}
\usepackage{cfr-lm}
\usepackage{cfr-dquote}
\MakeAutoQuote{‘}{’}
\MakeAutoQuote*{“}{”}
\begin{document}
\tikzset{%
dquote text font=\fontfamily{LobsterTwo-LF}\selectfont\Large\upshape,
dquote attrib font=\fontfamily{LobsterTwo-LF}\selectfont\Huge\itshape,
dquote={
quote style/.style={align=justify, fill=blue!50!cyan, fill opacity=.2, text opacity=1, text=blue!15!darkgray},
marks={
size=\Huge,
scale=4,
color=blue!50!darkgray,
opacity=.5,
},
},
}%
\dquote{%
‘Come, we shall have some fun now!’ thought Alice. ‘I'm glad they've begun asking riddles --- I believe I can guess that,’ she added aloud.

‘Do you mean that you think you can find out the answer to it?’ said the March Hare.

‘Exactly so,’ said Alice.

‘Then you should say what you mean,’ the March Hare went on.

‘I do,’ Alice hastily replied; ‘at least --- at least I mean what I say --- that's the same thing, you know.’

‘Not the same thing a bit!’ said the Hatter. ‘Why, you might just as well say that ‘I see what I eat’ is the same thing as ‘I eat what I see’!’

‘You might just as well say,’ added the March Hare, ‘that ‘I like what I get’ is the same thing as ‘I get what I like’!’

‘You might just as well say,’ added the Dormouse, which seemed to be talking in its sleep, ‘that ‘I breathe when I sleep’ is the same thing as ‘I sleep when I breathe’!’
}{Lewis Carroll}

\end{document}


I had some issues getting the other solutions here to work with a particularly troublesome set of packages, so I rewrote a solution around the adjustbox package.

\newlength\shadeDepth
\adjustbox{rlap,valign=b,raise=\shadeDepth/2-1.75em,scale={-1}{-1}}{\Huge}%
\hspace{-\linewidth}%
\adjustbox{rlap,valign=B,raise=\shadeDepth/2-1.50em,left=\linewidth}{\Huge}%
\hspace{-\linewidth}%
}


which can be spaced out a bit for readability as

\newlength\shadeDepth
\begin{center}%
center,%
minipage=0.9\linewidth,%
rlap,valign=b,%
scale={-1}{-1}}{\Huge}%
\hspace{-\linewidth}
rlap,valign=B,%
scale={+1}{+1},%
left=\linewidth}{\Huge}%
\hspace{-\linewidth}
\ifblank{#2}%
{}%

}
\end{center}
}


usage takes the form of \shadequote{quote}{citation}

### Minimal Working Version

The above can be used as

\PassOptionsToPackage{table,xcdraw,svgnames}{xcolor}
\documentclass[multi=pane,border=4mm,tikz,crop]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\newcommand*\quotefont{\fontfamily{LinuxLibertineT-LF}}

\adjustbox{rlap,valign=b,raise=\shadeDepth/2-1.75em,scale={-1}{-1}}{\Huge}%
\hspace{-\linewidth}%
\adjustbox{rlap,valign=B,raise=\shadeDepth/2-1.50em,left=\linewidth}{\Huge}%
\hspace{-\linewidth}%
}

\colorlet{soulhlb}{DeepSkyBlue!30}
\colorlet{soulhly}{yellow!50}
\colorlet{soulhll}{lime!30}
\colorlet{soulhlp}{pink!30}
\colorlet{soulhlpr}{MediumOrchid!30}

\DeclareRobustCommand{\hlb}[1]{{\sethlcolor{soulhlb}\hl{#1}}}
\DeclareRobustCommand{\hly}[1]{{\sethlcolor{soulhly}\hl{#1}}}
\DeclareRobustCommand{\hll}[1]{{\sethlcolor{soulhll}\hl{#1}}}
\DeclareRobustCommand{\hlp}[1]{{\sethlcolor{soulhlp}\hl{#1}}}
\DeclareRobustCommand{\hlpr}[1]{{\sethlcolor{soulhlpr}\hl{#1}}}

\begin{document}

\begin{pane}%_
}{in Pulmonary Surfactant in Health and Human Lung Diseases: State of the Art'' by Griese (1999).$^{1}$}