43

I use this code:

\begin{quote}
my quote
\end{quote}

I want to set it to singlespacing although the rest of the text ist formated with oneandahalfspacing. i also want to set the font size. How can I do this?

2
  • What's the font size in the main document, and which font size do you want to use inside quote environments? – Mico Aug 20 '16 at 13:36
  • In the main text it is 12p and in the quote it should be 11p. – texNewbie Aug 20 '16 at 13:37
28

(2021/06/22: I updated this answer in response to @moewe's very helpful comment, that some settings in the lipsum package changed since I posted this answer back in 2016. The update below consists of adding a \par directive in the second argument of \AtBeginEnvironment. If you don't use the lipsum package, you probably don't need the added \par instruction.)

Assuming you use the setspace package and the instruction \onehalfspacing to modify the line spacing of the document, you may achieve your objective by including the following instructions in the preamble:

\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\par\singlespacing\small}

In the document classes I'm familiar with, if the main document font size is 12pt, the instruction \small switches to 11pt as the font size.

A full MWE (minimum working example):

enter image description here

\documentclass[12pt]{article}
\usepackage{lipsum}   % for filler text
\usepackage{setspace} % for \onehalfspacing and \singlespacing macros
\onehalfspacing 

\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\par\singlespacing\small}

\begin{document}
\lipsum[2]  % filler text
\begin{quote}
\lipsum[2]
\end{quote}
\lipsum[2]
\end{document}
4
  • With a current LaTeX kernel this will also make the paragraph immediately preceding the quote environment single-spaced (actually I'm not sure if this is due to the recent change in the hook management: it could also be due to the fact that \lipsum no longer issues a \par at the end). See tex.stackexchange.com/q/569716/35864. – moewe Jun 22 at 20:00
  • @moewe - Many thanks for bringing this issue to my attention. A quick (and hopefully-not-too-dirty) fix is to change \AtBeginEnvironment{quote}{\singlespacing\small} to \AtBeginEnvironment{quote}{\par\singlespacing\small}, i.e, to insert a \par directive. I'll update my answer accordingly. – Mico Jun 22 at 20:13
  • Just for completeness: The change in behaviour is due to changes to \lipsum. Version 2.1 of lipsum released in 2018 no longer ends the output with \par (cf. ctan.org/ctan-ann/id/…). And indeed with the TeX Live 2017 available on Overleaf (where \lipsum ends with \par) things are alright, but with TeX Live 2018 on Overleaf (which has lipsum v2.2 where there is no \par at the end), the undesired effect can be observed. – moewe Jun 22 at 20:16
  • @moewe - Thanks for your follow-up. I had been sort-of aware of the fact that the lipsum package had changed in recent years, but until just now I had never fully understood what was going on. Thanks! – Mico Jun 22 at 20:26
10

Since this is the first result I got when I Googled "latex block quote", I thought I'd mention the csquotes package I found via this Overleaf article. Seems to do about the same thing, just not the font resizing the OP asked for.

\documentclass[12pt]{book}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{displayquote}
\lipsum[2]
\end{displayquote}

\lipsum[3]

\end{document} 

... gets you this....

enter image description here

0
7

You can do that with the etoolbox package:

 \documentclass[12pt]{book}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\singlespace\vspace{-\topsep}\small}
\AtEndEnvironment{quote}{\vspace{-\topsep}\endsinglespace}

\onehalfspacing

\begin{document}

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

\lipsum[3]

\end{document} 

enter image description here

1

As suggested in ahogen's answer, csquotes is a great way to typeset all sorts of quotations.

One of the simplest ways to customise csquotes' block quotations is via \SetBlockEnvironment and a custom environment based on quote.

Unfortunately, we need to define a new helper command to enter singlespacing without space correction (\singlespacingNoVspace), since we already have enough space added by quote.

\documentclass[12pt]{article}
\usepackage{csquotes}
\usepackage[onehalfspacing]{setspace}

\makeatletter
\newcommand*{\singlespacingNoVspace}{%
  \setstretch{\setspace@singlespace}}
\makeatother

\newenvironment{singlequote}
  {\quote\small\singlespacingNoVspace}
  {\endquote}

\SetBlockEnvironment{singlequote}

\usepackage{lipsum} % for dummy lorem ipsum text

\begin{document}
\lipsum[1]
\begin{displayquote}
\lipsum[2]
\end{displayquote}
\lipsum[3]
\end{document}

one-half spaced surrounding text, single-spaced quote

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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