You can open the project used in the video in ShareLaTeX by following this link:


In the last video we helped you get set up with ShareLaTeX, showed you some of it’s features and helped you create your first document. In this video we are going to look at dividing documents using sections and paragraphs. Let’s open up the document we created last time.

Currently our document only has one section named ‘Introduction’. Let’s add a few more to make it more like a lab report.

It’s often helpful to split up sections into further levels or subsections. These are created using the \subsection command. You can go even lower if you want by adding sub subsections.

Now let’s talk about paragraphs. If you want to start writing a new paragraph you must leave a blank line in the code. This will start a new line and indent it for you. Note that leaving more than one blank line just does the same as leaving a single blank line. However If you only take a single line break, LaTeX will ignore it. If you want LaTeX to take a new line without taking a new paragraph then you can use a double backslash, but this is to be discouraged as it leads to bad style.

In the last video we briefly mentioned the \maketitle command which adds a title along with the author and date information, all of which it collects from the preamble. You might not always want a big title on your document so you can easily remove it by commenting it out. To do this simply add a percent sign directly in-front of the command.

This brings us on to the topic of commenting. Comments are parts within the code that LaTeX ignores when compiling the document. To inform LaTeX that what you are writing is a comment simply place a percent sign in front of the text, then any text following the percent sign on that line will be ignored. Comments are there to give anyone reading your code information about what the code does or it’s purpose. It is good practice to regularly comment your code. For example I may write a comment at the top of the code to state the purpose of the document. I may also write a comment to remind myself that part of a section isn’t finished yet. Comments are also useful for turning off code without deleting it as we did with the make title command.

So that concludes our discussion on sections and paragraphs. In the next video we’ll look at using LaTeX to write basic maths and equations.

Published on 19 Jul 2013