It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

# LaTeX: Document Formatting

This topic guide was created to complement the Introduction to LaTeX workshop conducted by the Library and point users to resources and tips related to using LaTeX and Overleaf.

## Sections and Subsections

Desired result Command(s) Notes
1 Introduction \section{Introduction} You do not have to indicate the number of the section, LaTeX will automatically do it for you.
1.1 History of NTU \subsection{History of NTU} Similarly for subsections, you do not need to worry about numbering.
1.1.1 Nanyang Technological University \subsubsection{Nanyang Technological University} Similarly for subsubsections, you do not need to worry about numbering.
Nanyang University \section*{Nanyang University} Adding an asterisk (*) will remove the numbering
I Introduction to NTU \section{Introduction to NTU} To change the numbering from Arabic numerals to Roman, you'll have to add in the following code into the preamble i.e. before \begin{document}: \renewcommand{\thesection}{\Roman{section}}
I.I History of NTU \section{History of NTU} To change the subsection numbering from Arabic numerals to Roman, you'll have to add in the following code into the preamble i.e. before \begin{document}: \renewcommand{\thesubsection}{\thesection.\Roman{subsection}}

## Formatting Text

Desired result Command(s) Notes
bolded text \textbf{bolded text} Bracket your desired words within the curly braces.
italicised words \textit{italicised words}
underline \underline{underlined words}
emphasis \emph{emphasised text} What the \emph command actually does with its argument depends on the context - inside normal text the emphasized text is italicized, but this behaviour is reversed if used inside an italicized text. For more details & examples, click here
typewriter font \texttt{typewriter font}

Special characters e.g.

#, $, %, &, _, {, } \#, \$, \%, \&, \_, \{, \} Adding a backslash \ in front of most special symbols usually does the trick
Line break \\ or \newline Either method works fine.
Making internal comments %anything after a percentage sign is a comment It's good practice when you're writing to add in comments in your document to remind yourself what the commands do and it will also help others reading your document understand what you're using the commands to do
Highlighting Text \hl{Highlighting Text} You'll need both soul and xcolor packages for this function. This can only be used to highlight text i.e. it doesn't work for equations, etc. However you can define your own colours.