Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
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
add comment

1 Answer

up vote 7 down vote accepted

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}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.