1

Hi I am using latex for my dissertation and I need to make a change to conform to my school rules.

I currently use the following commands for \subsection

\makeatletter
\renewcommand\subsection{\@startsection{subsection}{1}{\z@}%
                                  {-3.5ex \@plus -1ex \@minus -.2ex}%
                                  {2.3ex \@plus.2ex}%
                                  {\normalfont\large\bfseries}}
\makeatother

which gives me

4.2.3 Quasi-balanced in the System Scale

but I need to have "Quasi-balanced in the System Scale" underlined only and not the subsection number. I have search but cannot find a solution that will give me what I want, any help will be greatly appreciated.

Ashford
  • 11

1 Answers1

1

This patches the \@sect command and uses a conditional to check whether the first parameter of \@sect is subsection. It applies \ul from soul package then to perform the formatting. I assumed the standard class article for this -- it does not work with scrartcl etc. however.

\documentclass{article}

\usepackage{soul}

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@sect}{%
  #8%
}{%
  \ifstrequal{#1}{subsection}{%
    \ul{#8}%
  }{%
    #8%
  }%
}{\typeout{successful patching}}{\typeout{Nope}}
\makeatother

\begin{document}
\tableofcontents
\section{First}
\subsection{Underlined with a very very very very very very very veryvery very very veryvery very very very long}
\subsubsection{Not underlined with a very very very very very very very veryvery very very veryvery very very very long}

\end{document}

enter image description here