LaTeX video tutorial for beginners (video 7)
Video 1 | Video 2 | Video 3 | Video 4 | Video 5 | Video 6 | Video 7
This seven-part series of LaTeX tutorial videos was first published in 2013; consequently, today's editor interface has changed considerably due to the development of ShareLaTeX and the subsequent merger of ShareLaTeX and Overleaf. However, the video content is still relevant and teaches you the basics of LaTeX—skills and expertise that will apply across all platforms. You don’t need any previous background knowledge, and by the end of these LaTeX guides you will be able to create and write basic LaTeX documents and have the knowledge to start learning how to create more complicated documents. Each video is accompanied by a transcript (listed below the video)—these in-situ transcripts replace the URLs shown at the start of each tutorial.
Longer documents in LaTeX
Note: You can open the project used in the video by following this link.
Video transcript
In the previous videos we’ve used the document class article
. This document class is useful for producing short documents, for example articles for scientific journals. If however you want to create a longer document you would be wise to use either the book
or report
class. Both of these classes enable you to add chapters in while this wasn’t an option in the article
class.
When writing longer documents it is wise to split up your document into multiple files. This makes our projects more modular and it makes them a lot tidier. I will now demonstrate this by creating an example document with the report class. This first .tex
file is what is called the ‘root document’ and is the file that will draw the whole document together. We begin it just like the documents we’ve made before, with a preamble specifying what document class we want to use and which packages we want to load up. For this document I want to write five chapters. If we weren’t splitting our document up we would just start writing the chapters in-between the \begin{document}
and \end{document}
commands using the \chapter
command. Instead we create a new .tex
file for each chapter. Here’s an example. Notice that in this .tex
file we haven’t written a preamble or even used a \begin{document}
command. We have just started with a \chapter
command and then composed the chapter splitting it up into sections.
I have now created all five files and you can see them and easily switch between them from the project panel on the left hand side. Now we will return to the root document. To add our individual chapters into the actual report we use the \input
command followed by the filename of the file we want to add to the document. Now if we compile the document we can see that LaTeX has added in our chapters and automatically numbered them. An alternative command to \input
is the \include
command which would also add our chapters into the document. However there are a couple of differences between the two commands, firstly the \include
command forces whatever is in the included file to be started on a new page, whereas \input
doesn’t. Of course in our example it won’t make any difference because all of our non-root files start with a chapter command which automatically starts a new page regardless. The second difference is that \input
allows you to nest \input
commands in files that are already being inputted by the root file. For example I could split chapter five into multiple .tex
files, draw them together in the chapter05.tex
file using \input
commands and then input the completed chapter into the document in the same way as before. The \include
command won’t allow this.
The next thing I want to talk about is adding a table of contents. LaTeX will automatically generate a table of contents if you include a \tableofcontents
command. You will notice that LaTeX has added all the numbered sections down to the subsection level. You can change the level to which the table of contents goes down to, using a \setcounter
command in the preamble followed by the keyword tocdepth
and then a number. If I want it to include sub-subsections I can use the number three. Or maybe we just want the chapter titles and so we use the number zero. At this point I should inform you that if you aren’t using ShareLaTeX as your LaTeX editor you may have to run LaTeX more than once for tables of contents to appear with the correct page numbers. ShareLaTeX streamlines this process into one click of the recompile button.
When writing a longer document you may want to store your graphics in a separate folder or multiple folders. For example In this project my graphics have been stored in a folder called my_images
. If I now load up the graphicx
package and add an \includegraphics
command in chapter one, the compiler will give us an error. This is because the image is in a different folder to the .tex
files. To fix this error we use the \graphicspath
command in the preamble of the main .tex
file and enter the folder name followed by a forward slash. Now LaTeX will know where to look for the graphic.
This brings us to the end of our discussion on writing longer documents and also to the end of our basic tutorial series.
Video 1 | Video 2 | Video 3 | Video 4 | Video 5 | Video 6 | Video 7
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class