zarzax the blog

Basic LaTeX Guide

by Mark on Mar.20, 2009, under Software

The purpose of document is to demonstrate how to construct a basic LaTeX document. This assumes that you are running from a system that has LaTeX installed. Most Linux distros include or make it simple to install. I wrote an earlier post on LaTeX Resources for Mac OSX.

Continue reading for the complete guide.

Simple LaTeX Document

This is an extremely basic LaTeX Document.

\documentclass{article}

\begin{document}

just some text

\end{document}	% End

Slightly more advanced sample.tex document

This is a sample document that demonstrates some advanced features such as adding a title, using sections, and using equations.

Download the sample.tex File

Download the sample.pdf File

\documentclass[12pt]{article}

% The following is used in the \maketitle
\title{Sample \LaTeX{} Document}
\author{Mark Young}
\date{March 19, 2009}

\begin{document}
\maketitle	% Insert the title at this location

To make this file type into any text editor.

\section{Some Lorem Ipsum}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\section{Equations}
This is a section named Equations.  This is an inline equation, $ p \wedge T \equiv p 	$ , which is the one of the identity laws.

The following displayed equation is one of the Distributive Laws.
$$ A \cap ( B \cup C ) = ( A \cap B ) \cup ( A \cap C ) $$

\subsection{Equation subsection}
This is a subsection.

\end{document}	% End

Turning LaTeX file into PDF

From the command line

The ‘pdflatex’ command creates a PDF file from the LaTeX file.

user@srv:# pdflatex sample.tex
user@srv:# ls
sample.tex
sample.pdf  <-- the pdf file you want for printing, made with 'pdflatex' command
sample.log  <-- record of the compilation.
sample.aux  <-- contains extras for LaTeX normally not used

Alternatively

I use the MacTeX LaTeX Distribution with Macromates TextMate on OSX. It includes bundles that makes compiling into pdf as easy as ⌘R.

:,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!