[Tex/LaTex] Customise the own subsubsection numbers

numberingsectioningsections-paragraphs

I am trying to write a thesis and would like to number the subsubsection titles within a section easily so I can refer to them nicely and easily later on in the document.

Here is what I have at the moment:

\documentclass[10pt]{article}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{fancyhdr, graphicx}
\usepackage[width=5.5in, height=8in]{geometry}

\begin{document}

\section{Exact Solutions of the Navier-Stokes Equations}

Intro.

\subsubsection{Solution 1: Description}

Solution 1

\subsubsection{Solution 2: Description}

Solution 2

\subsubsection{Solution 3: Description}

Solution 3

\end{document}

and the output comes out as:

1.0.1 Solution 1: Description

Solution 1

1.0.2 Solution 2: Description

Solution 2

but what I'd like is to have it appear as:

Solution 1: Description

Solution 1

Solution 2: Description

Solution 2

such that the part "Solution i" becomes the number – if that makes sense.

The reason I want to do this is so that: 1 – it looks nice, and 2 – so that I can use a \label and \ref later on so I can refer back to them later on in the document.

Best Answer

Here's an example that 'automatically' redefines the subsubsection header number format and numbering and restores it with the next \section.

I also used \cleveref so refer to the subsubsection as a Solution and not as a subsubsection.

\documentclass[10pt]{article}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{fancyhdr, graphicx}
\usepackage{xpatch}
\usepackage[width=5.5in, height=8in]{geometry}

\usepackage{cleveref}


\makeatletter
\let\latexthesubsubsection\thesubsubsection
\let\latex@@seccntformat\@seccntformat

\newcommand{\othersubsubformat}{%
  \renewcommand{\thesubsubsection}{Solution \arabic{subsubsection}}
  \def\@seccntformat##1{\csname the##1\endcsname:\ }
}
\newcommand{\restoresubsubformat}{%
\let\@seccntformat\latex@@seccntformat
\let\thesubsubsection\latexthesubsubsection
}

\xpretocmd{\section}{\restoresubsubformat}{}{}

\begin{document}



\section{Exact Solutions of the Navier-Stokes Equations}



\othersubsubformat

Intro.

We have a nice solution in \ref{solution:3}

\subsubsection{Description}

Solution 1

\subsubsection{Description}

Solution 2

\subsubsection{Description} \label[Solution]{solution:3}

Solution 3


\section{Other stuff}

\subsection{Foo}
\subsubsection{Foobar}

\end{document}

enter image description here