2

Similar to the answer of this question on stackoverflow, I have renewed the \begin{savequote} and \end{savequote} environment to be always single spaced no matter what the rest of the document is.

However, the use of \doublespace creates a tremendous extra space between the quote and chapter number, as seen in the following figure.

enter image description here

How can I make sure that the spacing between the quote and chapter number is always the same, no matter what spacing is used for the document?

For the image I used the following MWE:

\documentclass[a4paper,twoside,10pt]{book}

\usepackage{lipsum}
\usepackage{quotchap}
\usepackage{setspace}


\makeatletter
\let\oldquote\savequote
\def\savequote{\@ifnextchar[\savequote@i \savequote@ii}
\def\savequote@i[#1]{\oldquote[#1]\singlespace}
\def\savequote@ii{\oldquote\singlespace}
\makeatother

\begin{document}

%\doublespace

\mainmatter

\begin{savequote}[10pc]
\sffamily There is always something to say, in nice quote boxes, that spans more than one line.
\qauthor{Some person}
\end{savequote} 

\chapter{First chapter}
\lipsum[1]

\end{document}

1 Answer 1

1

Instead of redefining the innards of the savequote environment directly, I would load the etoolbox package and use its \BeforeBeginEnvironment and AfterEndEnvironment macros to place the material of the entire savequote environment inside a singlespace environment. Do distinguish between the environment versions of the macros of the setspace package (e.g., singlespace) and the package's direct macros (e.g., \singlespacing, \doublespacing).

To assure that the vertical distance between the top of the page and the chapter header, as well as between the chapter header and the chapter's body, is not affected by \doublespacing, the LaTeX macros \chapter, \@chapter, and \@schapter need to be modified. This can be achieved directly, as is done in the code below, or with the help of a package such as titlesec.

The modified MWE thus might look like this:

\documentclass[a4paper]{book}
\usepackage{lipsum,quotchap,setspace}

\usepackage{etoolbox}
\BeforeBeginEnvironment{savequote}{\begin{singlespace}}
\AfterEndEnvironment{savequote}{\end{singlespace}}
\pretocmd{\chapter}{\begin{singlespace}}{}{}
\makeatletter
\apptocmd{\@chapter}{\end{singlespace}\nointerlineskip}{}{}
\apptocmd{\@schapter}{\end{singlespace}\nointerlineskip}{}{}
\makeatother         

\begin{document}
\doublespacing

\mainmatter

\begin{savequote}[10pc]
\sffamily There is always something to say, in nice quote boxes, that spans more than one line.
\qauthor{Some person}
\end{savequote} 

\chapter{First chapter}
\lipsum[2]
\end{document}
4
  • Thanks for the etoolbox option, I'm not that familiar with redefining things... However, even though your suggestion might be better than my redefinition, the spacing issue remains.
    – DoubleYou
    Commented Apr 8, 2015 at 4:31
  • @DoubleYou - There are two, not just one, spacing issues. I thought earlier that you were referring just to the one affecting the line spacing above the savequote environment. Are you also looking to fix the (entirely separate) issue of the vertical distance between the top of the page and the start of the chapter header?
    – Mico
    Commented Apr 8, 2015 at 4:34
  • Even though I might have not provided the right way of redefining the savequote, from the image you can see that even with my option the quote line spacing is always singlespaced. So I thought to have solved one spacing option myself, and the other spacing issue I don't know how to solve is the vertical space between the quote and the chapter number.
    – DoubleYou
    Commented Apr 8, 2015 at 4:37
  • @DoubleYou - I've modified the code so that the chapter header material is also typeset in singlespacing mode, regardless of the overall spacing settings that may be in effect.
    – Mico
    Commented Apr 8, 2015 at 5:21

You must log in to answer this question.

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