LaTeX - The way documents are meant to be written


Updated: January 19, 2008

Most of the people use some sort of a word processor to write their documents on the PC. Usually, the word processors are a part of an office suite, like Microsoft Office, OpenOffice or StarOffice.

However, the term word processor is quite inadequate. The 'word' programs that we use are What You See Is What You Get (WYSIWYG) graphical text editors; these programs layout different objects on the screen (paper) to our liking, be they actual words, images or other items. This brings us to our Challenge No.1.

Challenge No.1

Using your eye to style the document is very tricky - and inaccurate. Fonts, indentation, line spacing, and other text parameters are ultimately set in pixels. We may be able to discern individual pixels, however our ability to gauge sizes and distances is quite bad. Telling font size 11.5 from 12 is very difficult. Hell, you don't need a computer to get convinced that our eye is not a very precise measurement system. Try to estimate the distance of your nose from the screen you are reading right now. It will be something like 40-60 cm or so. Make an educated guess for three random objects around you and then measure with a tape. You will reach a slightly mood-dampening realization that our sight is good to within 10-20% of the actual figure. With pixels this is even trickier, because pixel is a relative unit, dependent on your screen resolution.

Well, what does this tell us? It tells us that if we style the document by the look of it, there's a fair chance there will be quite a few structural mistakes that we simply won't notice.

Sub-challenge No.1-1

Let's say we have a document that contains the word dedoimedo 20 times. We would like to style it differently than the rest of the text. We want to increase the font by 2 pixels, em-bold and italic-ize it, underline it, and paint it red. This can be done in several ways:

Most word processors support styling, in one way or another, but this function is often neglected, because people easily see the big shiny shortcut buttons on the toolbars, but have no elan to dig in the menus and look for rather non-intuitive styling options.

Using independent styling has numerous advantages over in-text editing:

Another interesting thing one may notice when using the word processors is that contain much more information than simple text. Here's a little exercise for you.

Challenge No.2

Open your favorite word processor. Do not write a single word in the body of the document. Just save it as it is. Now look at the size of the resulting file. In my experiment, the MS Word document weighs 23.5KB, the OpenOffice weighs 6.2KB.

How come?

Isn't an empty document supposed to weigh 0 bytes? Apparently not. Most word processors append tons of useless data to the files, including private data, like the name of the author, title, keywords, and who knows what else. 23.5KB means 23,500 characters that the user has no control of, whatsoever. A lot. So, using word processors brings us to some very interesting conclusions:

But this can be remedied. Answer: LaTeX.

What is LaTeX?

LaTeX is a document markup language, just like HTML is a markup language. LaTeX has an extensive use in publishing, as it offers high flexibility, commonality and quality of typesetting. While it may appear to the unknowing eye that LaTeX is strictly out of the domain of the humble home user, it is definitely not so.

If you have an inkling of knowledge of HTML, you'll love LaTeX. If you are even remotely familiar with CSS, you will adore LaTeX. And if you are a geek, this is definitely the right way of doing word processing. All this sounds rather cool - but fails to demonstrate the true power of LaTeX. Therefore, we come to our Exercise No.1.

Exercise No.1

Let's write a mathematical equation. Our equations is the following expression (you can find it in the LaTeX guide):

Latex example formula

The few people who have had the misfortune to study Calculus or Fourier Transforms or both will probably recall this little devil. Anyway ...

Now, the goal is to see how much time it takes to write this using the built-in Microsoft Equation 3.0 in MS Office versus Latex plain, inline formatting. Assuming that a user has enough skill to use both programs competently. Of course, most people will find it much simpler to master the crude Microsoft Equation 3.0 rather than learn a new language like LaTeX and write their documents using a text editor like Notepad. But that's a different story altogether. How did I accomplish this?

LaTeX

In a text editor, I wrote these simple lines, just clicked 104 times on the keyboard, no use of mouse whatsoever:

\begin{displaymath}
\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
= \frac{\pi^2}{6}
\end{displaymath}

MS Equation

I opened the Equation Editor and clicked on the keyboard only 15 times - but I did have to use 29 mouse clicks to select desired formatting.

Comparison, LaTeX vs. Word processor

So, I did it. Here are the times:

LaTeX
74 seconds
Microsoft Equation
123 seconds

This simply yet clearly demonstrates the power of LaTeX. Now imagine your document contains 37 equations, much longer and more complex than our sample. Think of the time you will save. Think of the frustration you will avoid. No, wait, let me help you think.

Here's a simple calculation, based on my observations/measurements: any decent scientific document will contain about 50 equations or equation-like expressions, with a sprinkling of references and a touch of bibliography. Having written a number of documents that meet the above statistics, both the traditional and the geeky way, I am under the impression that using LaTeX saves about 10-16 minutes per page. For the humble five-pager, this is about an hour of precious time. For a decent twenty-pager, this is solid four hours.

Once you have written your first 1,000 pages using LaTeX, you will have realized you have saved yourself about 170 hours of work - a full month of work - just by using a text editor rather than a shiny office package, to write your documents.

Convinced?

But not everyone writes scientific articles or cares about equations. Again, LaTeX is extremely useful. Instead of roaming wildly with your mouse cursor from one obscure toolbar icon to the next, seeking the right options, making the classic mistakes, you would simply forget about how the document should look like and concentrate on the contents. By the way, regards whether you use word processors or text editors to make your documents, styling should always be applied after you have finished writing and never in between.

Another advantage of using LaTeX is avoiding unexpected modifications in the text properties while creating your document. The following scenario must sound familiar: You write a few paragraphs using Word. Then, you hit the Enter key to start a new paragraph. And all of a sudden, the text properties are modified - different font style, different font size. This probably happens due to (possibly) undesirable bugs (call them features) in the related software, where random software computation tree paths take over inherited properties of the parent object ... Yes ... Of course, it is relatively easy to modify the properties back to your desired settings, but it is still quite annoying and can be completely avoided by using LaTeX.

What about the disadvantages of using LaTeX?

Well, it's only fair that I introduce you to the dark side of the force. The so-called disadvantages are fairly negligible compared to challenges posed by the other other word processors - and can be easily eliminated - but new users should bear them in mind when venturing into the world of pure text.

Firstly, one can claim that, unlike Word, LaTeX is a language - or more accurately a programming language - so why should one bother studying a whole language, containing rules and reserved words and whatnot, just in order to write TEXT?

Well, you only have to learn the language once - and once you do, you earn all of the advantages LaTeX has over the conventional word processors. Secondly, LaTeX has a very quick learning curve, mainly due to the meaningfulness behind reserved words constructing the language.

Some simple examples

\sum is the reserved for the sum symbol.

Sum symbol

\rightarrow is the reserved word for the right arrow symbol.

Right arrow symbol

Furthermore, the logic of the language matches the concept of text editing. What can be more natural than blocking an enumerated area with \begin {enumerate} on the top and \end {enumerate} on the bottom - and referring to each enumerated paragraph as an item?

As the last feeble attempt at resistance, one could claim that using a programming-like language for creating a text may lead to user errors, which are frustrating and time-consuming. This may be true - when using LaTeX, there might be some errors that must be corrected to achieve a successful compilation. However, after quite short an experience, user errors are almost completely eliminated.

Using following tips will helps you reduce the number of errors to the minimum, even during your LaTeX infancy:

Working with LaTeX may sound very daunting. This is an uncharted territory for most people. But there's no reason for fear. Here are the few simple steps that will forever change the way you look at documents.

1. Get acquainted with LaTeX

Head to the official project site and read about LaTeX. Truth to be told, you might be a bit overwhelmed by the amount of helpful information you will find, but there's no reason to panic. If you are running Linux, the distribution is most likely bundled with a TeX system. If you are running Windows, you have several options to choose from.

Windows users

What do you need? What do you want? If you are comfortable with the command line, you will probably want to try the full proTeXt. If you are more of a GUI sort of person, then you might want to use one of the more stylish TeX editing platforms like TeXmacs. Although TeXmacs is a WYSIWYG editor, you can use it purely for opening text files and exporting to different formats (like .pdf or .ps). Or you could use the powerful graphical interface to get better acquainted with LaTeX.

Here's a screenshot of the Windows version of the editor, called WinTeXmacs.

WinTeXmacs interface

Like most open-source software, the software is available for Windows, Linux, OSX, BSD, and other platforms.

2. Read the documentation

The only help you will ever need to getting seriously started with LaTeX is to read the guide linked just below. This docuiment contains everything you need to know.

The (Not So) Short Introduction to LaTeX2e (direct link to a .pdf document)

3. Working with LaTeX

There are many ways you can produce a LaTeX document. You can write in a text editor, as simple as Notepad, then open your .txt. file using TeXmacs, or WinTeXmacs under Windows and then edit and export it to a desired format. You can also simply change the extension of the .txt file to .dvi format and then edit and export it to a desired format. You can also save your text as a .tex file and then convert it to a .dvi format and then do the usual drill.Eventually, you will decide what suits you best. I have found the following methodology to work quite well:

Linux

Windows

Exporting a file in WinTeXmacs

4. Extras

To make the fancy, smart-looking documents, you will need to have a PDF or PS software installed on your computer. Linux users will most likely need not bother, as the required software should be included in the distro. However, Windows users will probably need these:

Foxit - lightweight PDF document viewer and printer

Ghostscript - interpreter for PostScript language

GSview - graphical interface for Ghostscript

proTeXt comes bundled with Ghostscript and GSview. Although not strictly LaTeX, users are more than encouraged to read and get into Emacs or XEmacs, super-useful text editors that will make the pure-text experience so much faster, efficient and professional. Like I said before, a simple and primitive text editor like Notepad will do, but there's no reason NOT to use the bleeding edge of the text editing software available.

More good reading, on Wikipedia: LaTeX, Emacs and XEmacs.

That's it for now.

Conclusion

As you can see, I am not trying to teach you LaTeX. For that, you should use the superb guide I linked to 54 lines above. This article is meant to pique your appetite for the wondrous world of simplicity and efficiency of document writing in a world dominated by flashy excess of big, useless "office" suites.

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate