Jump to content

LaTeX quick and easy beginning


MoonChild
 Share

Recommended Posts

LaTeX is a very complex typesetting language used by authors and publishers worldwide to produce academic papers as well as books and other types of publications. It has numerous options, commands and options that require tons of books to explain in full. This is just an introduction to get you started for your college years as well as all the official documents you want to

create.

 

Documents created for LaTeX resemble C source code. The idea behind it is generation of documents through a compiler, surprisingly called LaTeX too. Why would anyone do that in the world of WYSIWYG text editors (like the excellent OpenOffice.org Writer)? Simply put, beauty! Nothing can match the presentation of LaTeX documents, no matter how hard you try. One of the reasons why almost all text editors have (or are in the stage of developing) LaTeX export functionality.

 

All commands in LaTeX begin with (backslash). To all IRC fanatics, this won't sound very surprising. All required arguements are usually enclosed between { } and all optional ones within [ ]. Commentwise, everything following the % (percentage) character is considered a comment.

 

We will create a University level Paper as a case study of LaTeX. You should write all your documents with a .tex extension to easily distinguish them. You may use your favourite editor to edit them, as long as it is a simple text editor and not an overbloated office suite editor. I like to use Kate for it, which has specific highlighting for LaTeX, but it is still your personal choice.

 

The most basic LaTeX document contains a few commands. The most basic one of them all is

documentclass[option]{style}

. Some options you might find usefull are the text size optional arguement (10pt, 11pt, 12pt etc) as well as the styles, which can be article, book, report, etc. In our case, we will create an article. Our starting command will be:

documentclass[12pt, titlepage]{article}

 

I included the optional arguement titlepage, which means LaTeX will create a standalone title page on the beginning of our Paper (as it is required by almost all University Papers you might write in your life). Just remove it if you don't like it there.

 

The following commands are optional for general documents, but are used by LaTeX to create your titlepage, so you better include them yourself.

 

author{Put yourname in here}

title{The title of the paper you want to have}

date{Date of completition}

 

As the above commands are quite easy to understand, I will move forward to documents objects or blocks. LaTeX treats all TeX files. You begin your blocks with begin{block} and finish them with end{block}. You can create as many blocks as you want, but it will only be shown if it is included in the master block of LaTeX called document. So our next command will be

 

begin{document}

<i>Our text will go here</i>

end{document}

 

As soon as you start your document, you might consider creating the title (or titlepage if you asked for it). The command to do that is maketitle and should be placed before you start your text obviously. Unless you want to play a little or confuse your professors.

 

Just a small note... Paragraphs are separated by an empty line, so it won't be hard to do that. If you prefer to have titles for each paragraph (of any number of them) you can create Sections in the document by typing

 

section{Name of Section}

or...

section*{name of Section}

The <i>section<b>*</b>{}</i> will not create automatic numbering for your sections.

 

So for a school paper, the whole file would look something like:

% The document class

documentclass[12pt, titlepage]{article}

 

% The Author

author{MoonChild}

 

% The title of the paper

title{Introduction to latex}

 

% Date of Completition

date{December 8$^{th}$ 2002}

 

% Start my Document here

begin{document}

 

% Create the title (titlepage in this case)

maketitle

 

% This is my introduction stuff

section*{Introduction}

 

This is the First Paragraph.

 

Of course, this is the second.

 

% I create a different section for the body of my document

section*{Main arguementation}

 

One more paragrapg.

 

And one more yet again.

 

% My conclusion will have its own section

section*{Conclusion}

 

Here is my conclusion. Use Latex!

 

% Obviously, finish my document

end{document}

 

All these are so beautiful and easy to understand. But what happens next? Well we need to compile our document using the command latex. It has a lot of arguements you can pass to it, but the one that concerns us is the filename. To run the program just type (in a console):

 

latex filename or latex filename.tex

 

The compiler will also give you all the errors that came up, as well as create a lot of files. LOG, AUX, DVI etc... What interests you more is the .dvi file, which is the printable beautiful document we just created. To view it, use xdvi filename or kdvi filename. You can print it through these applications if you wish. But most of your professors probably have no idea what DVI is or how to view it, so you might want to create it in a different format for them. I will assume PDF is acceptable to all Universities in the world.

 

pdflatex filename

 

The above command will create the exact same DVI looking document in a

PDF format you can view with xpdf filename.pdf or ofcourse acroread filename.pdf.

 

There are billions of more things I can tell you about it, but the scope of this document cannot cover them. Feel free to search on the Internet for a lot more information. Some links that might be of interest:

 

Latex Help by Cornell University

Getting Started with Latex by David R. Wilkins.

Latex Help 1.1 at Emory University

Beginner's Latex Tutorial at University of Waterloo in Canada

 

Enjoy!

 

NOTE: This was originally written for ManDraKe eXPerience but I thought some people might find it interesting in here.

Link to comment
Share on other sites

Thanks for the info, sounds pretty usefull.

 

I like the sound of the pdflatex, currently i use Openoffice to convert writer docs to pdf.

Use it for making technical data sheets and Material safety data sheets at my work, latex sounds ideal for that sort of thing.

 

I have just had a play with it, looks damn good :!:

Will definately need to investigate further.

Link to comment
Share on other sites

So for a school paper, the whole file would look something like:  

% The document class

documentclass[12pt, titlepage]{article}

 

% The Author

author{MoonChild}

 

% The title of the paper

title{Introduction to latex}

 

% Date of Completition

date{December 8$^{th}$ 2002}

 

% Start my Document here

begin{document}

 

% Create the title (titlepage in this case)

maketitle

 

% This is my introduction stuff

section*{Introduction}

 

This is the First Paragraph.

 

Of course, this is the second.

 

% I create a different section for the body of my document

section*{Main arguementation}

 

One more paragrapg.

 

And one more yet again.

 

% My conclusion will have its own section

section*{Conclusion}

 

Here is my conclusion. Use Latex!

 

% Obviously, finish my document

end{document}

 

I didn't see any refs to adding images to the document so i did some looking Here is your example with an image inserted as a figure. I found i was only able to get it to work using a .eps image format, you can convert .png .bmp etc to .eps with image magic.

 

just type: "convert imagename.png imagename.eps" //so simple change file names and extensions to suit your case.

 

place the image in the directory where you have the text file you are going to convert with latex you could put the image somewhere else, but you would have to define the path so if you want to do that refer to the 2 links further on.

 

Ok so here is the modified example, modifications in red.

 

% The document class

documentclass[12pt, titlepage]{article}

% Need to specify this package to use graphics in you document

usepackage{graphics,epsfig}

% The Author

author{MoonChild}

 

% The title of the paper

title{Introduction to latex}

 

% Date of Completition

date{December 8$^{th}$ 2002}

 

% Start my Document here

begin{document}

 

% Create the title (titlepage in this case)

maketitle

 

% This is my introduction stuff

section*{Introduction}

 

This is the First Paragraph.

 

Of course, this is the second.

 

% I create a different section for the body of my document

section*{Main arguementation}

 

One more paragrapg.

 

And one more yet again.

Here is a picture.

 

% Create a figure, the [h] means place here in the document, you can use b - bottom of page,

% t -top of page, or p - seperate page of figures

begin{figure}[h]

 

% center the picture

begin{center}

 

% Put in a picture but resize it to 40mm X 40mm (only way i found to resize thats works).

% The includegraphics{tux.eps} the pic is tux.eps

resizebox{40mm}{40mm}{includegraphics{tux}}

 

% Ok we have finished centering the graphic

end{center}

 

% Put a caption for the figure, {Fig:figX} gives you Fig: and the figure number, If it's the first

% figure, figX will be 1

caption{Enter some descriptions}label{Fig:figX}

 

% end of the figure

end{figure}

% My conclusion will have its own section

section*{Conclusion}

 

Here is my conclusion. Use Latex!

 

% Obviously, finish my document

end{document}

 

 

 

 

The following links contain info on using images.

http://www.maths.lth.se/help/latex/graphics/

http://www.site.uottawa.ca/~jlin/latex_help.htm

Link to comment
Share on other sites

  • 4 weeks later...

Thanks for the intro.

 

Kate is a great editor, but for LaTeX stuff I use Kile, which is an Integrated LaTeX environment. It's great for learning LaTeX because many of the commands are built in. It's very similar to, say, Quanta for HTML.

 

There is a MDK9 rpm available.

Link to comment
Share on other sites

Thanks for the intro.

 

Kate is a great editor, but for LaTeX stuff I use Kile, which is an Integrated LaTeX environment. It's great for learning LaTeX because many of the commands are built in. It's very similar to, say, Quanta for HTML. 

 

There is a MDK9 rpm available.

 

That looks excellent, i will try it out

Thanks :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...