In our previous article on Latex, we have introduced you to the basics of Latex and eventually showed you how to use LaTex on Windows 10. In this article, we will start the documentation to LaTeX and help you in understanding the LaTeX syntax.

As we are already aware, LaTeX is a great tool to create documents, and it is based on the idea ‘WYSIWYM'(what you see is what you mean) idea. The concept is pretty straightforward; all you need to do is focus on writing the content of the document, and the LaTeX engine will take care of formatting. In our previous article, we have shown you the power of LaTeX with a simple example. I felt one thing while learning Latex; its syntax is little clumsy and takes a little time to get used to it. Let us create a few sample documents to get familiar with the LaTex.

## Document class

The Document class is the very first syntax used to mention the type of document to the LaTeX engine, and it will take care of formatting and templates automatically.

Syntax: \documentclass[option]{class}

Decode the syntax:

• \documentclass : Command to mention the type of LaTeX document
• [option]: The options parameter used to customize the behavior of the document class mentioned below.
• {class}: The class parameter for the command \documentclass specifies the .cls file to use for the document formatting.

There are many document classes available as mentioned below,

1. article: This class is used to specify a document as an article in presentations, scientific journals, program documentation, short reports, and invitations.
2. IEEEtran: Formatting documents with the IEEE Transactions format.
3. proc: A class for proceedings based on the article class.
4. book: For writing real books.
5. letter: For writing letters.
6. beamer: For writing presentations.

Note: You can find proper documentation online regarding your document class requirement. To keep our article simple, we shall go ahead with the document class type, “article.”

To customize the document class type, LaTeX provides the [options] filed to specify the styling, formatting of the document. Let us go through a few of the available options,

1. 10pt, 11pt, 12pt: It is used to set the primary font size in the document. If no option specified, then 10pt is assumed by default.
2. a4paper, letterpaper: Specify the paper size. The default paper size is letterpaper. You can change it to a4paper.
3. twoside, oneside: Specifies whether the double or single-sided output should be generated.
4. landscape: To change the orientation of the document to the landscape mode.

Typical examples:

• \documentclass[12pt,oneside,a4paper]{article} -> A document with class “article”, with specified options such as font size: “12pt”, “single-sided” output and paper size is “a4”.
• \documentclass{article} -> No options specified means all default values to be taken and document class name is “article.”

This section is used to specify the metadata for the LaTeX document. Let us to through a few commonly used commands,

• \title{Title of the LaTeX document goes here}
• \author{Author name goes here}
• \date{Date of publication goes here}

Examples:

• \title{How to create a LaTeX Document}
• \author{WindowsHub}
• \date{July 2020}

## The Body Wrapper

As we are done with specifying the type of document and a few other supporting information such as author and title. It is time to start preparing the content/body of the LaTeX document.

• \begin{document}: This specifies the beginning of the LaTeX document.
• \maketitle: This asks the engine to typeset the title according to the information you have provided and the class.
• \end{document}: Specifies the end of the document.
\documentclass[11pt,twoside,a4paper]{article}
\title{How to create a LaTeX Document}
\author{MyWindowsHub}
\date{July 2020}
\begin{document}
{\maketitle}
Hello. It's a paragraph.
\end{document}


## Conclusion

In this article, we have introduced you to the basic syntaxs of LaTeX and showed you how to create LaTeX document by specifying a few important commands. In our upcoming article on Latex, we will dive deeper with a few advanced LaTeX commands used during writing scientific and other documents.

#### About Harsit Mohapatra

Harsit Mohapatra is a full-time Software Engineer passionate and hungry for tech updates and knowledge. Besides being a crazy software developer, he is an avid traveller and loves capturing the things that give him a perception through his lenses

This site uses Akismet to reduce spam. Learn how your comment data is processed.