The Adventure Begins

Angie Korovesi's picture

For the past 3 months, Alice was sitting in frond of her computer trying to write her thesis with her favorite word processor. She was beginning to feel really tired of all the inconsistencies that occur with that kind of processors. Once or twice she found other alternatives that seemed more sufficient, but they could not run in her OpenBSD nor they had a decent typesetting and most importantly they were not free. "What is the use of a common application if it is not free or you cannot use it in any OS?" Alice thought.

So, while she was in the computer lab, she was considering in her own mind whether the search of a new tool would be worth the trouble or if she should stick with her word processor, when suddenly she turned around and saw Bob's editor in his screen.

There was nothing remarkable in that; nor did Alice think it so very much out of the way to hear Bob say to himself, "And now to add the final graphics and my report is ready". Alice was burning with curiosity. What was that? She had seen a moment ago a simple editor. How can this thing produce cool graphics? So she sat next to Bob and started asking questions.

So Bob started patiently to answer. "This is LaTeX. A powerful typesetting and formatting tool. It can produce just about any document format under the sun, but can be initially intimidating." Alice wanted to know more, so Bob continued. "LaTeX is free, it can run on all Operating Systems, you can export a LaTeX document into PDF, DVI, Postscript, PNG, JPG and SVG. Not only that, but you can use the editor of your choice, and there are templates for different kinds of documents such as letters, books, articles and more. You will find that styles and typesetting are far better than your word processor and that the overall size of your exported document is far smaller that the equivalent one written with a word processor." "But", Bob continued, "one of my favorite benefits is that I actually learned how to program using LaTeX."

In another moment Alice went after it, only considering how in the world she could start getting her hands to it. "So how I get started with LaTeX?", she asked Bob.

"There are some golden rules that you need to remember' Bob replied. "I am sure that they will save you some time."
"Well" Alice replied "after such an introduction, I am excited to hear your tips".
"You should always remember" Bob started, "that everything in LaTeX is done with commands. Most of them are written in plain English so it's really easy to remember. All of them start with a backslash ( \ ). They can be followed by braces ({} ), which are used for arguments, or by brackets ( [] ), which are used for optional arguments."

"For now," Bob continued "I will show you a simple LaTeX file. Open your favorite editor and copy paste this file. Read carefully the commands."


%This is a comment.

%Create a new document and choose its formatting. In this example I chose to create an article. You can also create a book, report or letter.
\documentclass{article}

%Declares the title of the article.
\title{Welcome to LaTeX}

%Declares the author of the article.
\author{Alice}

%Sets the current date.
\date{}

%Starts the body of the text
\begin{document}

%Displays the title in the front page.
\maketitle

\section{This is how you define a section}
If you want to display words in \textbf{bold} or \textit{italics} all you need to do is to type the right command.

\subsection{Subsection}
Most of the commands are straight forward, since they are in plain English.

%Ends the body of the text.
\end{document}

"The final thing" Bob carried on, "that I am going to tell you is how to compile your file. You need to save your file as: your_file_name.tex. Since you work on the console, you need to execute the following command:


$ latex your_file_name.tex

This creates a .dvi file of your text. If you have any errors, the output file will not be created.


$ pdflatex your_file_name.tex

This creates a .pdf file of your text. If you have any errors, your output file will not be created.


$ pslatex your_file_name.tex

This creates a .div file of your text. If you have any errors, your output file will not be created.

"This is it. Welcome to LaTeX-land. You need to explore the rest for yourself. If you need any help just drop me a line." Said Bob and he left the labs.

To Be Continued...

Average: 5 (5 votes)

Comments

Thanks for sharing this

Thanks for sharing this file. I would like to asked if after copy pasting should I need to do anything else?. I have tried but I got some errors in it .Or probably my application is wrong. Well I think I need to go over it first .
Angie Korovesi's picture

I'm glad you liked the post

I'm glad you liked the post :). I have more LaTeX tutorials on the way so stay tuned. As far as the code goes, I just copied pasted it and it works fine on my system. Try to identify the error and check google to see if you can trace what is going wrong. If you still can't find the problem let me know :).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

Please solve the math problem above and type in the result. e.g. for 1+1, type 2.
The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • No HTML tags allowed

More information about formatting options