# Can you help me fix broken latex class file?

So I am nearing the end of my PhD and need to start writing my dissertation. My university (University of Connecticut) has certain guidelines for the format of the document but does not have an offical LaTex class file. So a (now former) graduate student wrote an unofficial one. Unfortunately, they seem to have broken the star versions of everything below \chapter. I am new to LaTex, but I noticed they used

\newcommand\section{...}


\def{\section}
...
\secdef\@section\@ssection


so I think the problem is in this section of code.

\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
%{\if@center\centering\else\raggedright\fi
{\raggedright
\reset@font\s@font}
}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
%{\if@center\centering\else\raggedright\fi
{\raggedright
\reset@font\ss@font}
}
\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
%{\if@center\centering\else\raggedright\fi
{\raggedright
\reset@font\sss@font}
}
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\reset@font\pg@font}
}
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\reset@font\spg@font}
}


TLDR:

\section*{title}


doesn't work as it should and displays

1.1 *
title

title
as it should.

How can I fix this given the code above?

• Slightly off-topic: I haven't seen the entire class file, but if it doesn't change the \@sect and \@ssect macros, I think that those \raggedrights are useless... – Phelype Oleinik Jul 31 '18 at 19:14

Ooh, history repeats itself. Not more than two months ago someone at my University did the exact same mistake.

After the sixth argument there is a spurious space which is tokenized by TeX while scanning the command. This brings an error when you try to use \section*. As that space is already tokenized, what you actually use is \section *, which fails the \@ifstar test and the section gets numbered. Then another test comes up: \@ifnextchar[, which also fails because the next token is *, so the command proceeds to grab the next token as the section title, that is, you have an * for the title. Finally, what was supposed to be the title of the section is simply typeset as text.

The definitions should contain end-of-line protection:

\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
%{\if@center\centering\else\raggedright\fi
{\raggedright
\reset@font\s@font}% <-- Here
}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
%{\if@center\centering\else\raggedright\fi
{\raggedright
\reset@font\ss@font}% <-- Here
}
\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
%{\if@center\centering\else\raggedright\fi
{\raggedright
\reset@font\sss@font}% <-- Here
}
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\reset@font\pg@font}% <-- Here
}
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\reset@font\spg@font}% <-- Here
}

• Awesome! This solved the problem. Thank you! – Erik N Aug 1 '18 at 0:09