# \vspace inside a command to add space between paragraphs but not before sections

I'm using a custom command to typeset some phrases and I need to put some vertical space between them. Unfortunately, this adds vertical space also before section and subsection headings.

As I have to type a lot of quotes, it would be nice to have \vspace automatically removed before sectioning commands.

Is there anyway to prevent \vspace to behave like this?

\documentclass[]{article}

\usepackage{lipsum}

\newcommand{\philquote}[1]{\noindent #1'' \vspace{12pt}}

\begin{document}

\section{Section 1}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\section{Section 2} % Wrong vertical spacing

\lipsum[1]

\section{Section 3} % Correct vertical spacing

\end{document}

-
 Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. – egreg Sep 24 '12 at 22:35

Instead of \vspace{12pt} you can use \par\addvspace{12pt}:

\documentclass[]{article}

\usepackage{lipsum}

\newcommand{\philquote}[1]{\noindent #1'' \par\addvspace{12pt}}

\begin{document}

\section{Section 1}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\section{Section 2} % Correct vertical spacing

\lipsum[1]

\section{Section 3} % Correct vertical spacing

\end{document}


-