Basic Layout
Below is an example of a very basic layout of a report style document in LateX, with a link beneath the code as to what this document looks like:
\documentclass{article}
\begin{document}
\title{Example RHUL physics report}
\author{A. N. Onymous}
\maketitle
\section{Introduction}
\subsection{Experimental setup}
\subsection{Data collection}\label{sec:data}
\end{document}
Resulting document: Click Here
Any code above the tag "\begin{document}" is known as the preamble and this contains commands that affect the whole document. For now the only piece of code we need here is "\documentclass{article}".
Now let us examine what each piece of code means:
\documentclass{article} |
This line is a command and tells LaTeX to use the "article" document class. A document class file defines the formatting, which in this case is a generic article format. The handy thing is that if you want to change the appearance of your document, substitute article for another class file that exists.
|
\begin{document} |
This line is the beginning of the environment called "document"; anything inside the begin and end tags will be rendered as part of your document.
|
\title{Example RHUL physics report} |
The "\title" command is one of two tags (the other being "\maketitle") that make up the top matter. The text inside the immediate curly brackets is your main title and will be rendered as a large font at the very beginning of your document
|
\author{A. N. Onymous} |
This command adds the author(s) of your document to the title section in a small font just below the main title.
|
\maketitle |
You always finish the top matter with the \maketitle command, which tells LaTeX that it's complete and it can typeset the title according to the information you have provided and the class (style) you are using. Removing "\maketitle" will result in the titling not being typeset (ie working at all).
|
\section{Introduction} |
This command adds a section to your document, which is rendered in a larger font than main body text but smaller than the title. LateX automatically numbers these sections numerically. Can be labelled and referenced.
|
\subsection{Experimental setup} |
This command adds a subsection to a section, for example "1.1" in section 1. Subsections are rendered in slightly larger text than main body text but smaller than sections or your main title. Again, LateX automaticalls numbers these for easy referencing.
|
\label{sec:data} |
This command allows you to label said item (can be anything from a section of text to a graphic to a table)for quick referencing later.
|
\end{document} |
The document environment ends here. Anything after this tag will be ignored and not rendered into your document.
|
Basic Tutorials:
Advanced Tutorials: