Ok, so you've decided to take the plunge and learn Latex (the typesetting language, not the plasticy stuff...) but how do you create a document that you can add to and publish pdf's until your heart is content?

So first things first, you're going to need some software, there are two cases I'm going to cover, Windows and Linux (Specifically Ubuntu).


Ok so Windows does not natively support latex like Linux does, so we need to install MikTex, and at the time of writing, it was at version 2.9.

After this you are pretty much set to go, but everything is controlled using the command line and old looking interfaces, so we'll install a nice front end. There are many to choose from, but I really like Texmaker, again at the time of writing version 4.0.2.

REMEMBER you need the windows version.

Linux (Ubuntu)

Now Ubuntu does natively support latex, so all we have to do is download and install Texmaker, either from that link or in the software centre.

Now that we have installed Texmaker and/or MikTex its time to actually start working!

Step 1: Preamble

Now before we start writing, each document that you make should have its own folder on your computer, in this folder all the files associated with your document will be kept here, such as pictures and whatnot.

When writing in texmaker, its a good idea to seperate your code with comments. Comments are made in latex using the '%' symbol and only cover one line, for example;

%This is a comment
This is not

So then to start a document we need to tell latex what type of document it is by using the following command;

\documentclass[ ]{ }

This command and most of the commands in latex are initated using the backslash '\' character, and generally follow the same template: \command[Options]{Parameters}

latex built-in document classes are as follows;


There are others such as a meeting minutes class, but these need googling to understand.

So we need to tell latex several things; paper size, font size, document class, and any other options such as double sided, two columns, etc.

For this instructable we will use a4paper, 11pt font, and report. These are inputted as follows;

\documentclass[11pt, a4paper]{report}

All the options go between the square brackets and the document class goes between the parentheses (curly) bracket.

After the document class comes the additional packages that you might need. There are loads of packages, and I'm not going to list any useful ones incase I start an arguement, however a general package I've found to be extremely useful is todo notes. To use a package we simply enter them in after the document class line;

\usepackage[options]{package name}

so for todo notes;


(todo notes is a bad example in hindsight as it doesn't have any options...) If the package you're using doesn't have any options associated with it you can safely delete the square brackets.

Finally the last piece of the preamble puzzle is the start of the document;


this will add a \end{document} line underneath it, and your writing should be between these two.

See the picture for a sample preamble.

Step 2: Main Body of the Document

So between the \begin{document} and \end{document} tags we need to actually start some writing.

How about a title page?

So we need to add the following to the preamble;

\author{Your name}
\title{My title}

Where Your Name, and My Title are changed with whatever you want to add, and \today is a command that tells latex to print todays date.

After these are added to the preamble, we simply add the;


command between the document tags.

Table of Contents/Figures/Tables

These are easy to add and only require a few lines;

\addcontentsline{toc}{chapter}{List of Figures}
\addcontentsline{toc}{chapter}{List of Tables}

So these commands create a table of contents and figures and tables, and adds the latter two to the table of contents.

Now we can actually start typing away,

New document part

To seperate your document into several parts such as beginning, middle, and end we type;


which will create a big division between parts.


These are easy like parts we simply type;

\chapter{My impressive chapter title}


Now we can further divide the chapters into sections using the following command;

\section{Subdivision of my impressive chapter}


This is getting ridiculous but we can make subsections, and even subsubsections by typing the following;

\subsection{A subdivision to my awesome section}

\subsubsection{A subsection to my subsection}

So there you go, under eas section/subsection/subsubsection you write your paragraph! Easy?

Step 3: References and Figures

Now the situation may come about when writing a document where we need to refer to a section/figure etc, so we need to know how to do that. It is done by using labels, and then refering to them.

So in my text I need to refer to my awesome chapter, I'll add a label underneath the chapter line like so;

\chapter{Awesome Chapter}

It doesn't really matter what you call your labels, but I find it helps to stick to the basic principle of saying what the label refers to, then adding a label name, for example;

chp: is for a chapter
sec: for a section
ssec: for a subsection
fig: for a figure
tab: for a table
eq: for an equation

Refering to a label

Now that we have defined our labels, lets refer to them, so in the text we write \ref{label name}, for example

The derivation and explanation of this super important equation can be seen in chapter \ref{chp:awe_chp}.

This will print the following;

The derivation and explanation of this super important equation can be seen in chapter 2.

Where the reference to a label is replaced by the chapter/section/whatever number.


Now adding pretty pictures and graphs to your document follows the same procedure, first we add the picture to your document folder.

Now call the picture something easy to remember, such as 'picture'

Back to latex, we add the following code;

\caption{An awesome caption to go with my picture}

So the \begin{figure} is self-explanatory, however the options in square brackets [!th] are not. These tell latex that I want to put my figure here, no really here. This is how I like to do my figures in latex, but other people like to leave latex to decide the best place to put a figure.

Next the \centering command, this centers the figure in the middle of the page width, include graphics is where we say which file to input, and the \caption command adds a line of text under the picture.

to refer to this in the text we simply type;

As can be seen in figure \ref{fig:picutre}.

Which will be output as;

As can be seen in figure 2.1.

So there ends the quick introduction to latex and how to make a document.

Step 4: Maths

Step 5: Further Reading/Help

In the coming months, I will be making more Latex instructables and will update the links here. But for now here are some external websites/references I find useful/have been suggested;

*My template Repository - Contains useful pre-made LaTeX templates

*Gitter chat, you can talk to me on gitter about the templates or getting latex set up

* ctan.org
* LaTeX Project
* LaTeX Manual
* TeX Blog
* LaTeX Wikibook

Interesting! Of course, if you're going to use LaTeX, you need to spell it correctly :-) And if you're going to typeset it, then you <i>really</i> need to write <b>LaT<sub>E</sub>X</b> properly :-) <br> <br>I'm a little surprised you don't have any discussion of mathematical notation, which is of course LaTeX's primary strength. <br> <br>Also, why don't you include links to <a href="http://www.ctan.org/" rel="nofollow">CTAN</a>, the <a href="http://www.latex-project.org/" rel="nofollow">main LaTeX Website</a>, or the <a href="http://www.amazon.com/LaTeX-Document-Preparation-System-Edition/dp/0201529831/ref=sr_1_1?ie=UTF8&qid=1369756285&sr=8-1&keywords=LaTeX+manual" rel="nofollow">LaTeX Manual</a>?
Yeah I was rushing the typing! <br> <br>Well I haven't included any maths because only now two years after learning to use LaTeX I've started using it properly. I also thought of making another instructable for tables, figures and mathematical notation.
I wouldn't make a separate I'ble. I would just expand this one to include those additional areas. <br> <br>LaTeX is an extremely powerful authoring system, with a lot of flexibility, and deserves to be better known outside the academic sciences.
Yeah perhaps your right, I'll slowly expand this one to include other areas.

About This Instructable




More by adamrees89:Make a Document in LaTeX - Beginners Guide 
Add instructable to: