24

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?

1 Answer 1

20
\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}
2
  • 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
    Commented May 4, 2013 at 10:05
  • see my edited answer
    – user2478
    Commented May 4, 2013 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .