# Section headers not sticking with first paragraph

I'm seeing lots of section/subsection headers getting split up from their paragraphs across page and column boundaries. I've never seen this before, but I'm also using a class file that's new to me, so I suspect it has something to do with a mistake in the class file itself. I'm a relative TeX novice and haven't ever spent much time with class files, so it's pretty overwhelming, but some spelunking has turned up some clues.

The full class file is available here, but what seems like a (potentially) relevant snippet is included below:

% Rationale for changes made in next four definitions:
% "Before skip" is made elastic to provide some give in setting columns (vs.
% parskip, which is non-elastic to keep section headers "anchored" to their
% subsequent text.
%
% "After skip" is minimized -- BUT setting it to 0pt resulted in run-in heads, despite
% the documentation asserted only after-skip < 0pt would have result.
%
% Baselineskip added to style to ensure multi-line section titles, and section heads
% followed by another section head rather than text, are decently spaced vertically.
% 12 Jan 2000 gkmt
\def\section{%
\@startsection{section}{1}{\z@}{-10\p@ \@plus -4\p@ \@minus -2\p@}%
}

\def\subsection{%
\@startsection{subsection}{2}{\z@}{-10\p@ \@plus -4\p@ \@minus -2\p@}
{0.5pt}{\baselineskip=14pt\secfnt}%
}
\def\subsubsection{%
\@startsection{subsubsection}{3}{\z@}{-10\p@ \@plus -4\p@ \@minus -2\p@}%
{0.5pt}{\baselineskip=14pt\subsecfnt}%
}

\def\paragraph{%
\@startsection{paragraph}{3}{\z@}{-10\p@ \@plus -4\p@ \@minus -2\p@}%
{0.5pt}{\baselineskip=14pt\subsecfnt}%
}

\let\@period=.
\def\@startsection#1#2#3#4#5#6{%
\if@noskipsec  %gkmt, 11 aug 99
\global\let\@period\@empty
\leavevmode
\global\let\@period.%
\fi
\par
\@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa
\@afterindentfalse
\fi
%\if@nobreak  11 Jan 00 gkmt
%\everypar{}
%\else
%\fi
\parskip=0pt
\@ifstar
{\@ssect{#3}{#4}{#5}{#6}}
{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
}


There's a mention in the comments about keeping section headers "anchored" - is it possible one of these changes has caused the headers to become unanchored? When I'm stuck using Word, this is just "Keep with next", but it doesn't seem quite that simple here. What can I do about this? Is there anything in my .tex file I might be doing that could cause this?

-

That is an old (very, very old!) version of amsproc.cls you are using. Are you running on some Redhat distro perchance?

I suggest you update to a more modern version of TeX/LaTeX, which you can get from http://www.tug.org/texlive/ or from http://fedoraproject.org/wiki/Features/TeXLive.

-
I don't think this is amsproc.cls? It may be a variant. It's for an ACM conference, but is not (for reasons that aren't clear to me) the official ACM two column class file. It seems to be vaguely community supported, but has no official support. More on the templates can be found here. I might be able to use the official ACM format and adapt, but that seems harrowing, especially when I can just fix these issues by hand with \vspace if I absolutely have to. –  drewww Jun 3 '11 at 16:43
Umm, yech. One definite problem is those commented-out chunks of code without putting a trailing % on the line before the commented-out chunk of code. That could make those macros inadvertently add white space which in turn will counteract LaTeX's control over widows (which is somewhat limited to start with). If you have to use that beast, you might have to insert some \vfill statements to force a new column/new page. –  David Hammen Jun 3 '11 at 17:06