Custom Section Numbering in LaTeX
For our last coursework (which was for a really interesting compilers module), I chose to present my answers in LaTeX. It's been a very steep learning curve, but I'm extremely happy with the results. I don't even mind the slight drop in productivity that's caused by my uncontrollable urge to stop and admire my document every so often! One thing that had me stuck for a while, however, was the automatic section numbering system.
To answer the questions for the compilers coursework, I wanted my sections to be numbered (1, 2, 3), my subsections to be numbered (a, b, c), and my subsubsections to be numbered (i, ii, iii). This numbering pattern matches that which is given in the question paper, whereby a number of nested enumerates were used. The default LaTeX section numbering however is (1, 1.1, 1.1.1). I finally found a way to alter this default behaviour by using the following code in the preamble:
\renewcommand{\thesubsection}{(\alph{subsection})} \renewcommand{\thesubsubsection}{\roman{subsection}.}
This code modifies the way that the counters for subsections and subsubsections are printed (section counters are correct when left at the default).
I hope this saves someone even the few minutes it took me to work this out, once I'd applied some logic! It's very useful to know that LaTeX has a counter for everything. This particular post was very helpful in working out which ones to alter, and how.
-
Sportbike Rider
-
physician assistant