Comments and length units

Comments

Just like any other programming language, you can add comments in LaTeX. Comments are useful, no doubt, as they tell what the code is doing.
Anything that is preceeded by % is a comment. An example is:

usepackage{graphicx} %for including images

Comments are ignored by the compiler and are a help in understanding the working of code.

Length Units

LaTeX knows about the following common units.

      in – inches

 

      mm – millimeters

 

      cm – centimeters

 

      pt – points (about 1/72 inch)

 

      em – approximately the width of an “M”

 

    ex – approximately the height of an “x”

New lines and paragraph

If you create a new line in LaTeX code i.e. in your .tex file, that would not generate a newline in the output pdf file. So you have to specify this in the code in order to have a newline in output. This is done quite easily by use of two backslashes (i.e. ). The content after these two backslashes will be pushed to new line.

Next is making a paragraph. You need to leave an empty line after the two backslashes in the code. The content after that empty line will be in a new paragraph.

Let me show you how. Just observe the following code.

documentclass[10pt,a4paper]{article}
begin{document}10pt is used to specify font size. \
a4paper refers to paper of document.\

article is the class of document. There are different classes of documents: article, report, letter, book etc.
end{document}

Here’s the output of above code: pdf

 

 

Basic LaTeX

Introduction:

LaTeX is a typesetting language that is suitable for mainly math, science and other professional documents. It can be used to type books and small documents (reports, say).

Required Software:

You need a plain text editor and the LaTeX package. You can install it by using the following command:

sudo apt-get install texlive-full

Well, the package installation takes time. You have to be patient.

Getting Started:

Let’s start with a simple LaTeX document:

% Example 1

documentclass{article}
begin{document}
This is my first {LaTeX} document.
end{document}

Understanding syntax:

documentclass{article}

This sets the document type to article.

begin{document}

…..

end{document}

These commands mark the beginning and the end of document.

Paste this code in your editor and save it with name say example.tex.

Next, compile the code and see the output using following commands:

pdflatex example.tex
evince example.pdf

Now your first document of LaTeX is ready. It was not very tough. You will enjoy further. 🙂