# A zero \parskip and an unusual \paragraph result in overlapping paragraphs

I'm trying to debug a class provided by some journal. From times to times, the text appears completely garbled, or does not appear at all (I believe it is printed somewhere but probably out of the page). This class is a complete (and useless) reimplementation of article, but I think I narrowed down the problem.

Consider the following document:

 \documentclass[a4paper,10pt,twoside]{article}
\usepackage{lipsum}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}
{4}{\z@}{12pt \@plus -3pt}{-.5em}
{\normalfont\normalsize\bfseries}}
\parskip\z@
\makeatother

\begin{document}
\lipsum[1-3]
\paragraph{New Par} \footnote{Oh}\lipsum[1-2]
\end{document}


While I believe that the \paragraph definition is inoffensive it seems that, in combination with the \parskip\z@, the results get wrong:

Question: What fix should I give to the editor? Don't set \parskip to zero? Is that really the problem? Is the problem in the definition of \paragraph?

-
The garbled part is the footnote. Remove the \textheight46.1c and it looks normal again. –  percusse Dec 6 '12 at 3:35
OT: \p@ is defined as 1pt. Instead of 0\p@ you can use \z@, which is defined as 0pt. –  Aditya Dec 6 '12 at 3:37
@percusse: Thanks for your input. However, I believe I should be able to use the \textheight I want without having the text garbled. This is just a fine tuning to trigger the (un)desired result, and I think it is legit to expect it to work. @Aditya: Right, thanks. I think they just copied the line from article, which uses the even stranger 0\p@ \@plus \p@. –  Michaël Dec 6 '12 at 3:41
You should give a full minimal working example (MWE) so people can test. –  Stephan Lehmke Dec 6 '12 at 4:49
@StephanLehmke: I managed to reduce the WE so that it is close to M. Thanks. –  Michaël Dec 6 '12 at 5:35

The problem is with the definition of \paragraph: the fourth argument ("beforeskip") contains a negative plus component, which it shouldn't. Changing this to 12pt \@plus 3pt fixes it.

A negative stretch (or shrink) is hardly ever useful, except for certain cases.

Usually, I would leave it at that – but because I suspect that there is a reason to why this negative stretch is there (and because you've asked for it ...), it might be worthwhile to delve into the intricacies of \@startsection:

According to source2e, the "beforeskip" argument is to specify the following:

Now, if latex encounters a negative value (of the first part: e.g., -12pt), it will (1) reverse the sign of the skip (which means reversing the sign of all components of this skip: its natural width, stretch and shrink), and (2) set the paragraph indentation switch to false. So that, for example, -12pt \@plus -3pt \@minus -3pt would actually mean: beforeskip of 12pt \@plus 3pt \@minus 3pt and "no indentation of the next paragraph". Since negative stretch or shrink components usually don't make much sense (see above), all components should be either positive or negative, but not mixed.

The fifth argument ("afterskip") specifies:

In your definition of \paragraph, the fifth argument is negative, signalling that it should be a run-in heading, and not start a new paragraph. Therefore, it actually does not matter whether "beforeskip" is positive or negative, as text following a run-in heading is of course never indented.
Thanks Robert! Would you mind adding a reference for your assertion to the effect that all components have to be negative if one is? Or explain how the different components behave? I thought that \@plus and \@minus were only arithmetics (as their names suggest), so maybe you can explain how these work too? Thanks! –  Michaël Dec 6 '12 at 14:37