# LaTeX video tutorial for beginners (video 6)

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.

### Tables and matrices in LaTeX

**Note:** You can open the project used in the video by following this link.

### Video transcript

In the previous video we looked at using BibTeX to add bibliographies into our documents. In this video we’ll look at inserting tables and matrices.

To insert tables in LaTeX we use the `tabular`

environment. So let’s add in our begin and end commands. Immediately following the `\begin{tabular}`

command we need to tell LaTeX the column specifications. There are a few key characters we use to do this. Firstly, a lower case `l`

specifies a left justified column, a lower case `r`

specifies a right justified column and a lower case `c`

specifies a centred column. In my example I’m going to specify six columns, the first and last will be left-justified and the rest will be centred. To put vertical lines between the columns we can use the bar symbol and place it between the letters where we want the lines to appear. When entering the tables’ contents we start each row on a new line, separate column entries using an ampersand and finish each row, except the last, with a double backslash.

Now to add horizontal lines we use the `\hline`

command. To make a double horizontal line simply use the command twice. One potential problem with this table is that if I add a long line of text into one of the cells in the final column it will sprawl off the page. To fix this there is another option we can use when declaring column specifications. It is a lower case `p`

followed by a width in centimetres in curly brackets. So if I change the final `l`

in the declaration to a `p`

with `5cm`

you will see the text has been wrapped so that the final column’s width is 5cm.

So that’s the basics of writing tables. However, just like with images, we often want more control over positioning and we may want to add a caption and label. To do this we use an environment called `table`

which is similar to the `figure`

environment we used for images. To put our existing table in the `table`

environment we simply enclose the code in `\begin{table}`

and `\end{table}`

commands. We can then set the position specifier using a combination of `h`

, `t`

, `b`

, `p`

and exclamation mark (`!`

). I can also add a caption and label.

We will now briefly look at matrices as they use similar syntax as tables. At this point make sure you’ve loaded the `amsmath`

package. Before we add a matrix we need to tell LaTeX that we are about to add some maths by opening an environment. We could use the equation environment as we did a few videos ago, however here we’ll use the `displaymath`

environment as it has nice LaTeX shorthand. This means instead of using a `\begin`

command we can use a backslash and open square bracket and instead of an end command we can use a backslash and close square bracket. Matrices can be inserted using the `matrix`

environment. With matrices we don’t need to declare how many columns we use, we can simply start adding the entries. Again we enter each row on a new line, separate entries using an ampersand and separate rows using a double backslash. To change the brackets surrounding the matrix, we change the environment. The `pmatrix`

environment uses parenthesis, `bmatrix`

uses square brackets, `Bmatrix`

(with a capital `B`

) uses curly brackets, `vmatrix`

uses vertical lines and `Vmatrix`

(with a capital `V`

) uses double vertical lines.

Finally we’ll finish this video with a more interesting matrix. What we are doing in this example is nesting matrices inside another matrix. So what we actually have here is a two by two matrix built with the `pmatrix`

environment, where the top left and bottom right entries are also matrices, this time built with the `matrix`

environment to avoid multiple brackets.

This concludes our discussion on tables and matrices. In the final video of this series we’ll look at composing larger documents.

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