Enter your email id to get regular update free

# How to create Your first LaTeX document?

### Creating documents with LaTeX is simple and fun. In contrast to Word, you start off with a plain text file (.tex file) which contains LaTeX code and the actual content

LaTeX uses control statements, which define how your content should be formatted. Before you can see what the final result looks like, the LaTeX compiler will take your .tex file and compile it into a .pdf file. A basic example document can be created with the following code:
Once you translated this code into a PDF document, you will find the text:
Hello World!
along with the page number at the bottom, which is added automatically when using the article class. Let us now take a closer look at how the magic happens. As you can see, you will find a few statements beginning with a backslash \ in the code example above. This tells LaTeX that this is not actual text, that you want to see printed in your document, but instead is an instruction or command for the LaTeX compiler. All commands share the following structure: \commandname{option}. The first part indicates the name of the command and the second part in braces sets an option for this command. The options vary from command to command and you will learn some of them later on in this tutorial. Most of the time, the commands are pretty self-explanatory: \documentclass{article} and what's even greater, you don't have to remember all of them, because you can later just copy and paste them from previous documents. Now let's take a little closer look at the command \documentclass{article} The command is obviously named documentclass and it does exactly that, it sets the document class (to article). LaTeX uses document classes, to influence the overall layout of your document. For instance, there's one class to layout articles, one class to layout books (called book) and many more, which we probably don't need. In my tutorials, I will always use the class article. Feel free to play around and try different document classes anyway and see what happens! This second example differs slightly from the first one, since this command involves a \begin and \end statement. In fact this is not a command, but defines an environment. An environment is simply an area of your document where certain typesetting rules apply. It is possible (and usually necessary) to have multiple environments in a document, but it is imperative the document environment is the topmost environment. The following code shows how environments can be used:

Create
LaTeX document
LaTeX
Ayesha
Tech writer at newsandstory
Total 97 views