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.
Note: You can open the project used in the video by following this link.
In the previous 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 previous 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.