Tuesday, August 09, 2005

Introducing LaTeX

LaTeX is perhaps one of the most amazing and overlooked document formats every created! It's well suited for professional typesetting as a document's content is completely seperated from its style. What's the catch? LaTeX is typically edited in a code setting not a what-you-see-is-what-you-get setting, also referred to as WYSIWYG. It is the goal of this introduction to LaTeX to formilliarize one with the basics of LaTeX.

Like other languages, LaTeX has a method of commenting available. A comment line simply is prefixed with a percentage symbol like so:

% introduction.tex - Getting started with LaTeX

After some optional introductory comments, it is customary to specify the formatting desired for the LaTeX document. Here's how it's done:

\documentclass{article}

As one may imagine, other formatting styles are available besides article. In fact, a user may even wish to import his or her own custom document classes, as LaTeX refers to them. Besides article, other popular LaTeX document classes include:

- book
- letter
- report

Up to this point, the LaTeX document has been nothing but what is often called preamble. The following command specifies that anything before its ending tag, which is also displayed, is part of the document's actual contents:

\begin{document}
\end{document}

The beginning and ending tags accept other parameters besides document. Some popular ones include:

- abstract
- quote
- titlepage
- verse

At this point, one may wonder how he or she would go about displaying a % or \ in a document. They can't just be typed in normally because that would signify a comment line or a LaTeX command. Here's how it's done:

- To display a % enter \%
- To display a \ enter \textbackslash

Take a moment to consider the following LaTeX complete LaTeX document:

-----------
% This is a comment.
% Comments can be inserted anywhere in LaTeX documents.

\documentclass{article}

\begin{document}
Woo! Some text in a document.
\end{document}
-----------

The previous document can be compiled as a PDF by issuing the following command on a system with LaTeX installed:

latex introduction.tex

The compilation command assumes that the previous document has been saved as "introduction.tex." Actually ".tex" is not even required for compilation even if the saved file has the extension.

Another, and more newbie friendly way, of working with LaTeX would be to use a graphical front-end such as Kile. Kile is a wonderful KDE application available at:

kile.sourceforge.net

Happy hacking,
Samuel

--------

Credits:
- www.comp.leeds.ac.uk/andyr/misc/latex/tutorial1.html
- Autocompletion from Kile

No comments: