Changing Section heading in latex template

I would like to change the section and subsection heading in my latex template. The current heading is in bold, but it also has to be indented and numbered. I do not know how to change it in the class file.

I have attached the images and code snippet of section heading and also link to the class file. Any help to change the class file is appreciated.

\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}

\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}

\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus -1ex \@minus -.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}

\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus -1ex \@minus -.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}


Do not change the class file. Make your changes in your preamble.

The third argument to the \@startsection command is the indent from the left margin. In your examples it has always been set as \z@ for zero indent. Try, for example,

\makeatletter
\renewcommand{\subsection}{\@startsection
{subsection}{2}{5mm}%               % name, level, indent
{as in class}%                      % beforeskip
{as in class}%                      % afterskip
{as in class}}%                     % style
\makeatother


and similarly for the other sectional headings. You will have to adjust the indents as appropriate for your design.

The \setsecnumdeph{<num>} controls which sectional levels get numbered. To have numbering down to the subsubsection level put

\setsecnumdepth{3}


The typesetting of the section number is by an internal LaTeX macro \@seccntformat whose typical definition, but it depends on the class file, is along the lines of

\newcommand*{\@seccntformat}[1]{\csname the#1\endcsname\quad}


which typesets the section number followed by a \quad space. To change the spacing to, say, \yourlength, in your preamble put

\makeatletter
\renewcommand*{\@seccntformat}[1]{\csname the#1\endcsname\yourlength}
\makeatother


BTW: You are talking about a class file, not a template. GOM

• Hi, That worked for me without using \setsecnumdepth{3}. How can I change the spacing between numbering and text of the heading? – pss47 Sep 27 '18 at 9:53
• @pss47 I have extended my answer to cater for your extra question. – Peter Wilson Sep 27 '18 at 18:53