15

I use the package parskip, but want to suppress the parskip in some places, i.e. after headings inserted by a specific macro.

A negative vspace doesn't work, since parskip's spacing can stretch.

The only workaround I found is using \\ instead of a paragraph, but that feels wrong. Is there a better way?

15
\documentclass{article}
\usepackage{parskip}

\begin{document}
foo\par bar\par baz

{\parskip=0pt
foo\par bar\par baz\par}

foo\par bar\par baz
\end{document} 

enter image description here

Or as a command:

\documentclass{article}
\usepackage{parskip}
\newcommand\foo[1]{\par#1\par\vspace{-\parskip}}
\begin{document}
bar\par bar

\foo{some nonsense}

bar\par bar

\foo{some nonsense}

bar

\end{document}
  • That looks good, thanks. Can I use that to define a macro \foo that prints a paragraph foo after which there is no parskip? The obvious {\parskip=0pt foo\par} doesn't work, since the parskip as applied where a paragraph begins, not where it ends. – fefrei May 4 '13 at 10:05
  • see my edited answer – user2478 May 4 '13 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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