Last Update: 30/10/05

# Latex tricks

### Section numbering depth in report

The Latex report style is handy for writing theses and such, if one has the inclination. However, it only numbers sections as deep as subsection whereas other classes such as article will go as deep as subsubsection.

\setcounter{secnumdepth}{3}

3 refers to the section numbering depth, with 3 being subsubsection, 4 being paragraph and 5 subparagraph.

The same trick may be used with the counter tocdepth to dictate how deep the table of contents will display.

### References to tables

In order to get my tables to be refered to correctly, ie. to agree with the number in the caption I had to change:

\begin{table}
\begin{center}
\begin{tabular}
...
\end{tabular}
\label{table_label}
\caption{Example 1.}
\end{center}
\end{table}

to:

\begin{table}
\begin{center}
\begin{tabular}
...
\end{tabular}
\caption{Example 1.}
\label{table_label}
\end{center}
\end{table}

The first of these produced references of the form Table (current section) instead of Table (table number) in agreement with the caption.

### units and mbox

The latex units package is quite nice. It alters the spacing between numbers and units and adds a non-breaking space. What it doesn't do is stick the number and units in mboxs. So whilst the number and unit cannot appear on two different lines, the number itself can be broken.

This is easily fixed, however. Change the line 47 onwards in units.sty from

\else #1% \ifthenelse{\boolean{B@UnitsLoose}}{~}{\,}% \fi \ifthenelse{\boolean{mmode}}{\mathrm{#2}}{#2}%

to

\else \mbox{#1}% \ifthenelse{\boolean{B@UnitsLoose}}{~}{\,}% \fi \ifthenelse{\boolean{mmode}}{\mbox{\mathrm{#2}}}{\mbox{#2}}%

Not classy, but it does work :)