# Customise my own subsubsection numbers

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.

• You're omitting the subsection level --this is not recommended – user31729 Apr 22 '16 at 9:50
• The reason I am using subsubsections is because I do not want large titles (I suppose I may be able to edit this individually for these specific subsections), however, I think the question still stands, then for subsections. – Daniel Ward Apr 22 '16 at 9:52
• – Marijn Apr 22 '16 at 9:53

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}


• Thank you, this answers my question. In order to then continue to have subsubsections in a later section, how would I go about resetting the numbering? – Daniel Ward Apr 22 '16 at 9:57
• @DanielWard: See the update please – user31729 Apr 22 '16 at 10:03
• Thank you again for your help, this works very well, except when I put it into my main document it messes up the table of contents. This may be a seperate question but how do I go about making sure the table of contents is also changed appropriately? – Daniel Ward Apr 22 '16 at 10:09
• Of course it messes up the ToC --> actually, a theorem like approach would be much better – user31729 Apr 22 '16 at 10:13
• That's not a bad idea, thank you I'll look into it. – Daniel Ward Apr 22 '16 at 10:14

This is the solution I found using Christian Hupfer's suggestion in one of his comments.

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

\theoremstyle{definition}
\newtheorem{solution}{Solution}

\begin{document}

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

Intro.

See solution \ref{solution:3} for ...

\begin{solution} \textbf{Description} \\

Solution 1

\end{solution}

\begin{solution} \textbf{Description} \\

Solution 2

\end{solution}

\begin{solution} \textbf{Description} \\ \label{solution:3}

Solution 3

\end{solution}

\end{document}

• Actually, unaccepting the solution, grabbing a comment by someone else and using this as self-answer and self-acceptance, this is not really kosher! – user31729 Apr 27 '16 at 12:02
• My bad, I didn't realise. I mentioned you in the answer, I thought this would be okay. I can re-accept your answer if you like. It was just that this was the solution I used. – Daniel Ward Apr 28 '16 at 11:39

There are two different ways of suppressing subsubsection numbers:

1. Use \subsubsection*. This suppresses numbering completely and also supresses the addition of this subsubsection to the table of contents.

2. \setcounter{secnumdepth}{2} (you only need this command once, best in the preamble of the document). This supresses the the printing of the numbers for subsubsection. It does not influence the table of contents generation.

If all you are concerned about is that the font for subsections is too large for your liking then change the definition of the subsection font. You can find the (sub)subsection code via texdoc article. In your preamble do

\makeatletter
\renewcommand{\subsection}{...} % changing the font specification
\makeatother


and then use \subsection{...} instead of \subsubsection{...} in your document.