# (La)TeX equivalent of MS Word's “Don't add space between paragraphs of the same style”

I'm using a quote environment to add some references at the beginning of sections with two custom commands. If I have more than one reference, the \list nature of the environment automatically adds margin space around each reference, which is not so pleasant looking. MS Word offers the paragraph option "Don't add space between paragraphs of the same style" which would be able to suppress the space between these two environments. How can I do the same in this situation?

### MWE:

\documentclass{article}

\usepackage{url}
\usepackage{blindtext}

% Commands for adding references to sections
\newcommand{\referenceurl}[2][See:]{\begin{quote}\emph{#1} \url{#2}\end{quote}}
\newcommand{\reference}[2][See:]{\begin{quote}\emph{#1} #2\end{quote}}

\begin{document}
\section{Important Material}
\referenceurl{http://www.example.com/important_material}
\blindtext

\section{Other Material: Ideal Style}
\referenceurl{http://www.example.com/important_material}
\blindtext

\section{Single Reference: Default style should not change}
\reference{Example page}
\blindtext

\section{Single URL Reference: Default style should not change}
\referenceurl[Excellent Resource:]{http://www.example.com/important_material}
\blindtext

\section{Multiple References: Spacing should be suppressed}
\reference{Textbook}
\reference[Alternate Resource:]{Textbook}
\blindtext
\end{document}

-
Do you always have \reference after \referenceur? – egreg Jun 24 '14 at 12:28
@egreg No, not always. And sometimes, there will only be one appearing. – cslstr Jun 24 '14 at 12:29
@egreg In fact, the only reason I have both commands is to automatically format the url in cases where I am simply referencing a url. You could just consider the case where there are zero/one/two \references – cslstr Jun 24 '14 at 12:30
Could you supplement your example code with some other typical calls? – egreg Jun 24 '14 at 12:32
@egreg A few other examples added. – cslstr Jun 24 '14 at 12:37

I suggest you set up a dedicated list environment for this. Then the entries are nothing other than \items and do not need special commands. Such lists are easiest to set-up with the enumitem package.

\documentclass{article}

\usepackage{url,enumitem}
\usepackage{blindtext}

\newlist{references}{itemize}{1}
\setlist[references]{align=left,leftmargin=2em,itemindent=!,rightmargin=2em,labelindent=2em,labelsep=0.3em,itemsep=0pt,parsep=0pt,label=See:,font=\normalfont\textit}

\begin{document}
\section{Important Material}
\begin{references}
\item \url{http://www.example.com/important_material}
Wikipedians Anonymous Press, 2005.}
\end{references}
\blindtext

\section{Other Material: Ideal Style}
\begin{references}
\item \url{http://www.example.com/important_material}
Dummies}, Wikipedians Anonymous Press, 2005.}
\end{references}
\blindtext

\end{document}

-

You could detect that and remove teh space automatically, but I wouldn't, I'd use a more explicit markup:

\documentclass{article}

\usepackage{url}
\usepackage{blindtext}

% Commands for adding references to sections
\newcommand{\referenceurl}[2][See:]{\par\emph{#1} \url{#2}}
\newcommand{\reference}[2][See:]{\par\emph{#1} #2}
\newenvironment{secrefs}{\quote\parskip0pt\relax}{\endquote}
\begin{document}
\section{Important Material}
\begin{secrefs}
\referenceurl{http://www.example.com/important_material}
\end{secrefs}
\blindtext

\section{Other Material: Ideal Style}
\begin{secrefs}
\referenceurl{http://www.example.com/important_material}

I'd define \newcommand{\referenceurl}[1][See:]{\par\emph{#1} \url} so that special characters in URLs can be correctly dealt with. – egreg Jun 24 '14 at 12:40
@DavidCarlisle Does TeX have any concept similar to the Word option (for a general environment), or is \parskip along with margins (like in \@startsection) really the closest it gets? – cslstr Jun 24 '14 at 12:40
@cslstr word needs that as its user interface makes it hard to see the difference between one style spanning two paragraphs and two paragraphs separately having the same style, so it needs kludges to fix things up at spurious boundaries. You could do that in TeX either by getting referenceurl to look ahead in the token stream for \reference and adding corrective space, or getting \reference to look in the current vertical list with \lastskip and adjusting for space already added. But it isn't really the latex way. More natural to have an environment as here or Andrew's answer. – David Carlisle Jun 24 '14 at 12:48