39

I am almost there in my quest to reproduce the rather compact layout of the book I'm translating... one thing to go, though:

I successfully used the enumitem package to modify the vertical and horizontal spacing of the various list environments.

But how do I modify the vertical and horizontal spacing of the quotation environment? I have found lots of information on how to do it for theorems and formulas etc., but none of that seems to apply for quotation (or quote, for that matter).

\documentclass[twocolumn]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{enumitem}
\setlist{leftmargin=*,parsep=0pt,itemsep=2pt,topsep=2pt,partopsep=0pt}
\setlist[enumerate]{widest=0}

\newcommand{\sometext}{Some random text. Not using lipsum as I don't need that much text.}

\begin{document}
\sometext
\begin{itemize}
\item One item.
\item Another item.
\end{itemize}
\sometext
\begin{quotation}
\textbf{Note:} \emph{This has too much whitespace around it.}
\end{quotation}
\sometext
\end{document}

enter image description here

2 Answers 2

29

The quoting package provides a quoting environment with customizable font, margins, spacing... Just load it with \usepackage{quoting} and use either \begin{quoting}[vskip=0pt] ... \end{quoting} or set it up globally with \quotingsetup{vskip=0pt}:

\documentclass[twocolumn]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{enumitem}
\setlist{leftmargin=*,parsep=0pt,itemsep=2pt,topsep=2pt,partopsep=0pt}
\setlist[enumerate]{widest=0}

\usepackage{quoting}
\quotingsetup{vskip=0pt}

\newcommand{\sometext}{Some random text. Not using lipsum as I don't need that much text.}

\begin{document}
\sometext
\begin{itemize}
\item One item.
\item Another item.
\end{itemize}
\sometext
\begin{quoting}
\textbf{Note:} \emph{This has no extra white\-space around it.}
\end{quoting}
\sometext
\end{document}

output result

4
  • 2
    Ummm, the word whitespace is a well-known case of a failure of TeX's hyphenation mechanism... You may want to add a discretionary hyphen, \-, to fix this in your MWE. :-)
    – Mico
    Sep 27, 2011 at 10:25
  • @Mico Thanks for pointing that out, fixed :-)
    – diabonas
    Sep 27, 2011 at 10:31
  • I find setting parameters for a package preferrable over redefining, or writing macros myself. (Assuming that the package authors know more about LaTeX than I do, which isn't hard at all.) Thanks for pointing out this package.
    – DevSolar
    Sep 27, 2011 at 11:22
  • 3
    Global settings may also be changed using \usepackage[vskip=0pt]{quoting}.
    – lockstep
    Sep 27, 2011 at 17:10
20
\documentclass[twocolumn]{scrbook}
\makeatletter
\renewenvironment{quotation}
               {\list{}{\listparindent=0pt%whatever you need
                        \itemindent    \listparindent
                        \leftmargin=0pt%  whatever you need
                        \rightmargin=10pt%whatever you need
                        \topsep=0pt%%%%%  whatever you need
                        \parsep        \z@ \@plus\p@}%
                \item\relax}
               {\endlist}
\makeatother

\newcommand{\sometext}{Some random text. Not using lipsum as I don't need that much text.}

\begin{document}

\sometext
\begin{quotation}
\textbf{Note:} \emph{This has too much whitespace around it.}
\end{quotation}
\sometext
\end{document}

enter image description here

4
  • I tried to \setlength{\topsep}{0pt} at the global level, but it did not seem to affect the quotation environment, so I thought it had to be some other parameter... but it seems that the \topsep etc. has to be declared explicitly in the environent... is there a simple explanation as to why?
    – DevSolar
    Sep 27, 2011 at 10:20
  • 6
    your value is always overwritten by the definition of quotation
    – user2478
    Sep 27, 2011 at 10:25
  • On second thought, isn't this somewhat... I won't call it "buggy", but perhaps "flaky"? If the environment ignores global topsep settings, shouldn't it react on some other setting? Having to re-define the environment to change one parameter strikes me as a bit heavy-handed, especially since LaTeX apparently does not provide a way to either determine the standard definition for reference ("what are all the other things done by this environment, so I don't forget them in my redifinition"), or add a single value to the definition without having to redefine it completely...
    – DevSolar
    Sep 27, 2011 at 14:36
  • Although I don't know much about it, the "toolbox" package might be a little more elegant. That being said, this is great; in no small part because one doesn't have to define ERT before and after each quotation in Lyx.
    – CodeLurker
    May 16, 2020 at 4:39

You must log in to answer this question.

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