# Avoiding unwanted spaces in a shortquote / inline quote environment

In a book project, I use the following simple definition of a shortquote environment, mainly to make the use of inline quotations a bit more flexible than just using quote'' (source)

% inline quotations
\newenvironment{shortquote}{}{''}


When I use it, e.g., in

He said of his bar chart:
\begin{shortquote}
This Chart is different from the others in principle, as it does
not comprehend any portion of time, and it is much inferior in utility to those that do; for though it gives the extent of the different branches of trade, it does not compare the same branch of commerce with itself at different periods.
\end{shortquote}
(\emph{Atlas}, 1st edition, 1786, p. 101)


I get the following, that leaves an extra space before and after the quote. There is probably a better way to do this. Any suggestions are welcome.

From so other related queries, perhaps I need \ignorespaces somewhere, but I don't see how or where.

• if you don't want to complicate the macros to remove the space you could just not add the space in your document. you have space just as  foo '' has space but foo'' does not. – David Carlisle May 28 '18 at 17:34
• Ah, I forgot that the newline following \begin{shortquote} counts as a space. – user101089 May 29 '18 at 12:08

you can define the environment to always ignore spaces at the beginning and end:

\newenvironment{shortquote}{\ignorespaces}{\unskip''}


this will ignore spaces, but it won't ignore blank lines, so be sure to enter your quote as you show it in your question.

• I think it's better to guard the unskip, as in my answer, as otherwise a blank line before the end of env has different effects on the main vertical list (weird low level error) or in a parbox (removes vertical rather than horizontal) space. – David Carlisle May 29 '18 at 12:17
• @DavidCarlisle -- reasonable warning. (i did say not to leave blank lines and use the command exactly as the op showed in the question.) – barbara beeton May 29 '18 at 13:53
• yes but if you test for that it's the same as the answer I gave but less safe (just as long as OP is aware of that:-) – David Carlisle May 29 '18 at 14:44
• In my uses of this, as I always do with environments, perhaps out of bad habits, I use \begin{} and \end{} on separate lines. One reason for this is I might want to change a shortquoteinto a quote environment later. – user101089 May 31 '18 at 19:33
• @user101089 -- that's actually a very good practice, and it should work with the suggested code as long as you don't leave blank lines. – barbara beeton May 31 '18 at 20:59

The spaces are not related to the environment definition, they are added in your document, however you could redefine the environment to remove them if you don't want to avoid adding them when marking up the document.

\documentclass{article}

\newenvironment{shortquote}{}{''}
\newenvironment{xshortquote}{\ignorespaces}
{\ifvmode\PackageError{shortquote}{dont leave a blank line}{}\else\unskip\fi''}

\begin{document}

\begin{shortquote}xx\end{shortquote}

\begin{shortquote} xx \end{shortquote}

\begin{xshortquote}xx\end{xshortquote}

\begin{xshortquote} xx \end{xshortquote}

\end{document}