LaTeX Basics
Posted: Thu Jun 26, 2014 11:28 pm
LaTeX is a markup language, mostly used to prepare scientific documents, books, articles, and even presentations. One of the great benefits is that working with LaTeX is completely distraction-free. You just write and don't need to care about formatting. It can automatically create a table of content, bibliography, a list of references and sources, etc.
Another benefit is portability. You can use any editor in any operating system to prepare your document. The .tex files are comparably small, and you can create PDFs or PostScript files from them.
So, where to get our rubber suite?
Firstly, you need at least one package: texlive-base
You can grab a slightly bigger one with: texlive-latex-base
For Emacs users, there is an excellent environment called: whizzytex
You can also add: auctex
Of course, if you plan to work with mathematical formula, or with certain languages, you need to grad suitable packages that can display what you want: apt-cache search texlive|more
A simple document to start with
Fire up your editor of choice and create a file with .tex extension.
We first need to define what type of document we want to create, and we can also set up the font size we want to use throughout the document:
Of course there are some other document classes you can use: book, thesis, beamer -- depending on which packages you have installed. "article" is a very common one.
Let's also add some meta information, like the title and the author of our document, along with a date.
As you can see, the date will always be updated to the day you actually process the document. This block can be before or after the \documentclass line.
The following tells LaTeX where the actual document begins, and where it ends.
Everything related to the content of the document will be placed between these two lines. For example:
The good Emacs users can now run M-x whizzytex-mode and see a live preview of what they produced. Those who are afraid of wacky key sequences can try lyx or gummi as WYSIWYG editors. :) Yes, vim has a latexsuite, too!
To create a PDF from this .tex file run:
Of course this is really just a very very basic example of a .tex file. Good references are:
- http://en.wikibooks.org/wiki/LaTeX/Document_Structure
- http://texblog.org/tex-resources/
- http://texblog.org/code-snippets/
- http://www.emacswiki.org/emacs/LaTeX
Hope you find it useful ;)
Another benefit is portability. You can use any editor in any operating system to prepare your document. The .tex files are comparably small, and you can create PDFs or PostScript files from them.
So, where to get our rubber suite?
Firstly, you need at least one package: texlive-base
You can grab a slightly bigger one with: texlive-latex-base
For Emacs users, there is an excellent environment called: whizzytex
You can also add: auctex
Of course, if you plan to work with mathematical formula, or with certain languages, you need to grad suitable packages that can display what you want: apt-cache search texlive|more
A simple document to start with
Fire up your editor of choice and create a file with .tex extension.
We first need to define what type of document we want to create, and we can also set up the font size we want to use throughout the document:
Code: Select all
\documentclass[12pt,a4paper]{article}
Let's also add some meta information, like the title and the author of our document, along with a date.
Code: Select all
\title{My First Encounter With BDSM}
\author{Larry Satenstein}
\date{\today}
\keywords{BDSM, Slave, Whipping, Banana}
The following tells LaTeX where the actual document begins, and where it ends.
Code: Select all
\begin{document}
\end{document}
Code: Select all
\begin{document}
\maketitle
\begin{abstract}
The abstract begins here.
This new line has no line break.
If we want a line break, we place two backslashes at the end of the line.\\Yeah.
\end{abstract}
\section{Introduction}
This is the introduction. All sections will be enumerated automatically.
\begin{itemize}
\item \emph{Some item in italics.}
\item And a regular one
\end{itemize}
\paragraph{Outline}
And a paragraph.
\bibliography{main}
\end{document}
To create a PDF from this .tex file run:
Code: Select all
pdflatex file.tex
- http://en.wikibooks.org/wiki/LaTeX/Document_Structure
- http://texblog.org/tex-resources/
- http://texblog.org/code-snippets/
- http://www.emacswiki.org/emacs/LaTeX
Hope you find it useful ;)