# setspace and quoting environment result in superfluous empty line

I was trying to set up the quoting environment by the package of the same name, which included single line spacing for block quotes as opposed to one and a half line spacing for normal text. The spacing seemed weird to me, so I boiled it down to the following MWE, which clearly shows off the extra line when applying singlespacing to quoting, even though nothing ought to happen because single line spacing is the standard.

\documentclass[12pt,twocolumn]{article}
\usepackage[a4paper,landscape]{geometry}
\usepackage{setspace}
\usepackage{quoting}
\usepackage{lipsum}
\begin{document}
\lipsum*[66]

\begin{quoting}
\lipsum*[66]
\end{quoting}

\lipsum*[66]

\newpage

\quotingsetup{font=singlespacing}

\lipsum*[66]

\begin{quoting}
\lipsum*[66]
\end{quoting}

\lipsum*[66]
\end{document}


Notes: The order in which setspace and quoting are loaded does not seem to matter. I also made sure lipsum's paragraph breaks don't disturb us by using \lipsum*, which doesn't insert \pars.

Is this expected behavior, can I patch it, is it a bug?

-

In the user guide to the quoting package, the following is said about using the font=... argument in a \quotingsetup{font=...} command:

font The font used for typesetting the contents of a quoting environment. Permitted values are the names (without preceding backslash) of LATEX's fontswitching/ formatting commands; e. g, use font=itshape to typeset quotes in italics. (By default, quoting uses the font/formatting of the surrounding text.) To specify several font properties, use a comma-separated list of font/formatting names, e.g., font={itshape,raggedright} (note the surrounding braces).

What this comes down to, then, is that the package doesn't think (rightly or wrongly...) that singlespacing is a valid font switching or formatting instruction and ends up throwing in an extra blank line before (but interestingly not after) the quoted material.

Elsewhere in the user guide, there's also a comment that

The options font and font+ [of the \quotingsetup command] do not accept values which itself take an argument. In such cases you must resort to redefining the command \quotingfont.

Specifically, to change the line spacing in a quoting environment [to singlespacing, say], there's a suggestion to use the instruction

\renewcommand*{\quotingfont}{\setstretch{1.0}}


(with the setspace package loaded, naturally).

Indeed, with this modification, your MWE works as one would expect it to.

-
The question is: Why does font not accept values that take an argument, and does it accept macros that stand for a macro taking an argument? I would assume the answer to the latter question is yes. \singlespacing is defined as follows: \newcommand{\singlespacing}{\setstretch{\setspace@singlespace}\vskip \baselineskip}. If I change that and get rid of \vskip \baselineskip, my MWE also behaves as expected. The line containing these two commands is commented % Correction for coming into singlespace. It seems necessary for normal paragraphs, but I'll have to test that. – doncherry Oct 15 '12 at 19:18
@doncherry - I must confess that I was a bit unsure about the precise meaning of the claim in the second quoted passage, or why it would apply to the \singlespacing macro, as it doesn't actually take an argument. Anyway, I think you've found, by unearthing the actual definition of the \singlespacing command, that it's the presence of \vskip \baselineskip rather than the command (not) taking an argument that's responsible for the extra amount of vertical whitespace. Safer to just type \setstretch{1.0} -- or to use Harish's solution based on etoolbox... – Mico Oct 15 '12 at 19:59

Adding to Mico's excellent answer, the problem can be solved by using etoolbox with its \AtBeginEnvironment macro:

\documentclass[12pt,twocolumn]{article}
\usepackage[a4paper,landscape]{geometry}
\usepackage{setspace}
\usepackage{quoting}
\usepackage{etoolbox}
\usepackage{lipsum}
\begin{document}
\onehalfspacing
\lipsum*[66]

\begin{quoting}
\lipsum*[66]
\end{quoting}

\lipsum*[66]

\newpage

\AtBeginEnvironment{quoting}{\singlespacing}
%\quotingsetup{font=singlespacing}

\lipsum*[66]

\begin{quoting}
\lipsum*[66]
\end{quoting}

\lipsum*[66]
\end{document}


-

Mico and Harish Kumar have already suggested ways to remove the extra blank line. I'll add that this "feature" of the setspace package isn't limited to quoting, but affects also the LaTeX standard environments quote and quotation: Whenever you issue \singlespacing inside the environment, setspace adds an extra blank line:

\documentclass[12pt,twocolumn]{article}
\usepackage[a4paper,landscape]{geometry}
\usepackage{setspace}
\usepackage{lipsum}
\begin{document}
\lipsum*[66]

\singlespacing

\begin{quotation}
\lipsum*[66]
\end{quotation}

\lipsum*[66]

\newpage

\lipsum*[66]

\begin{quotation}
\singlespacing

\lipsum*[66]
\end{quotation}

\lipsum*[66]
\end{document}

-
So this addresses the "why" part of the question, I assume? It doesn't seem like quoting is based on quote or quotation though, or is it? I.e., is there any particular reason for this behavior? Is there any case in which it is needed for a desired result? – doncherry Oct 15 '12 at 19:03
@doncherry It seems to be a bad interaction between setspace and the list environment on which quoting & friends are based. – lockstep Oct 15 '12 at 20:05
Could this bad interaction be fixed on the side of one of these packages? I don't entirely understand how setspace works, but it seems the "mistake" is on that side, if it's problematic with the list environment in general? – doncherry Oct 19 '12 at 5:48