Latex Part I

LaTeX commands

LaTeX commands generally begin with a backslash and take the form \command[options]{argument}. For example,

\section{Introduction}
This will create a section, with the name Introduction.
If we want to insert a coment, we just need to insert a '%' character, and everything you type to the end of the line will be commented.
To insert the '%' , just insert a backslash: \%

The preamble
Everything we type before the line “\begin{document}” is part of the preamble. The typical preamble look like this:

\documentclass{article}
\usepackage{graphicx}
\title{Test}
\author{Test}
\date{}
In the example above:

• \documentclass{article} tells LaTeX that the document is an article. Other classes include book, letter and slides
• \usepackage{graphicx} tells LaTeX to use the graphicx package, which allow users to insert graphics in the documents
• \title{} and \author{} define the title and author
• \date{} tells LaTeX to write the today date. \date{June 2010} would print “June 2010? as the date.
The \documentclass{} command can contain some options, for example, \documentclass[11pt,twocolumn]{article} would organize body of the document into two columns and the options are separated by a comma. Other options include:

• oneside or twoside – change margins for a one or two-sided document
• landscape – change the document from landscape to portrait
• titlepage or notitlepage – define whether there is a separate title page, or if the title, author and date info are show at the top of the article

Document structure
A document’s structure is defined using \section{} commands. LaTeX is based on well-structured documents. The structure tags are :

• \section{Name}
• \subsection{Name}
• \subsubsection{Name}
• \paragraph{Name}
If you want to insert a unnumbered section, you can use the command \section*{Name}. In the next section, the numbering will continue as normal.
The \paragraph{}is used if you want to insert a heading for a paragraph.

The next image will show the comands explained before:

Lists items

If we want to itemize(create bulleted) or enumerate(numbered lists), just do as we do in the following example:

To itemize:

\begin{itemize}
\item First thing
\item Second thing
\item Third thing
\end{itemize}

To enumerate:

\begin{enumerate}
\item First numbered thing
\item Second numbered thing
\end{enumerate}

The graphicx package
The graphicx package allows you to insert images into the document. To use it, we have to import it, to do that we just type the command \usepackage{graphicx} in your document preamble. After that, to insert a image we just need to type:

\includegraphics[options]{filename.png}
The images supports many filetypes, including PDF, PNG and JPG. The options include:

• width=Xin
• height=Xin
• scale=X (where x is between 0 and 1)

The geometry package
Formating in latex can be easy, but changing the defaults formats can be a little bit difficult. The geometry package can changes somes aspects of the document, for example if we want to change the margin to 1, we just need to type the next command:

\usepackage[margin=1in]{geometry}

Continues in next post.

An website that helps a lot in latex is http://aprendolatex.wordpress.com/, is in portuguese, but have a lots of exemples to improve your latex documents

Sources: http://generaldisarray.wordpress.com/2006/04/20/latex-from-beginner-to-texpert/