# Unwanted vertical space at top of page before subsection heading

I have been using LaTeX for a while now, but I am very new to defining my own commands in the preamble. I am working on my thesis, and I'm using a custom .cls file which has been passed down by other grad students over the years.

When I start a new subsection, there is a certain amount of vertical space required between the preceding paragraph and the subsection heading. This works great if the subsection starts in the middle of a page, but when a subsection starts at the top of the page there is unwanted vertical space. I can manually go through and add \vspace*{-<some distance>} before certain instances of \subsection{<title>} to fix this problem, but I'd prefer to either write a new command or edit the subsection definition in the .cls file so that the vertical space is automatically removed if the subsection starts on a new page.

EDIT 10/9/15 at 3:40 pm CDT Here's how subsections are defined in the custom .cls. Sorry for not including it originally

\renewcommand\subsection{\secdef\@subsection\@ssubsection}

\def\@subsection[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{subsection}%

\fi
}

{\parindent \z@ \raggedright \bfseries
\ifnum \c@secnumdepth >\m@ne
\ifnum\c@inappendix=0\@chapapp\space\fi\thesubsection .\space
\fi
\uppercase{#1}\par\nobreak
}}

• Welcome to TeX.SX. This doesn't happen in the standard classes, and we would need to see this custom .cls to be able to say anything about how to edit it. – Torbjørn T. Oct 9 '15 at 20:28
• Such inherited templates are most times ... well ... bad – user31729 Oct 9 '15 at 20:37
• replace \vspace*{\baselineskip} with \vspace{\baselineskip} – touhami Oct 9 '15 at 20:50