Thursday 29 March 2018

What Is the LaTeX Document Format and How to Use It

If you’ve spent any time in academia or the academic publishing world, you’ve probably heard of LaTeX (pronounced “LAY-tech”).

But what, exactly, is LaTeX? What are some of its uses? And how can you learn to use it?

We’ll walk you through the basics to help you get started. Then we’ll show you where to find great LaTeX tutorials and resources and point you toward some free LaTeX software.

What Is LaTeX?

Put simply, LaTeX is a typesetting and document preparation system that “includes features designed for the production of technical and scientific documentation.”

But what does that mean?

LaTeX 2e logo

For most people, it means that you can use LaTeX to create documents with text and formatting that would be difficult in a standard word processor.

Let’s use the quadratic equation as an example. Here’s what I typed in LaTeX:

\begin{equation}

x = \frac{-b \pm \sqrt{b^2 - 4ac}}
{2a}

\end{equation}

And here’s how that’s displayed:

LaTeX quadratic equation

Getting that equation to display nicely in Microsoft Word would be a pain. In LaTeX, it just took me a couple lines of text. But LaTeX can do a whole lot more than mathematical equations. It can handle non-Roman alphabets, tables of contents, lists, bibliographies, references, and even formulaic drawing.

Typesetting With LaTeX

If you’re writing with LaTeX, you usually don’t have to worry too much about typesetting. You’ll probably use it more for equations and the like. But by tagging the items in your document (sections, figures, titles, and so on), you give an editor or publisher the ability to apply styles and formats to the entire document at once.

The American Mathematical Society says this:

“LaTeX 2e defines ‘structured’ files in which the various elements (title, authors, headings, etc.) are easily identified. This is crucial for the future, when we may need to migrate tens of thousands of articles into new formats. AMS journals are already posted on line, with full bibliographic data in HTML.”

Formatting and typesetting with LaTeX is a bit like using HTML and CSS. If you correctly tag everything with HTML, all you need to do is make one or two changes in CSS to apply them across your entire HTML document.

Advantages of LaTeX Documents

LaTeX documents obviously have advantages for mathematicians and anyone else who uses equations in their writing. The systems is commonly used for documents in physics, statistics, computer science, engineering, and other fields that need to write down a lot of equations.

But it’s also used by linguists, economists, philosophers, children’s book authors, anthropologists, theologians… and just about anyone else you can think of.

That’s not to say that it’s for everyone, though.

If you want something that you can learn and use right away, LaTeX may not be for you. It’s a markup language, and it will take time to learn more than the basics. You’ll have to do a lot of research on how to solve specific problems.

That said, after you’ve learned it, it’ll save you a lot of time. Automatically generated tables of contents and bibliographies alone will save you hours. And if you design documents, you’ll be amazed at how much easier it is in LaTeX than Word or LibreOffice.

LaTeX is based on the TeX document formatting system, which has been around since 1978. Some version of LaTeX will likely stick around for a long time, so it’s a great format to store documents in.

Getting Started With LaTeX

Taking a look at LaTeX basics can be intimidating. It looks like learning a new coding language. But there aren’t as many commands to learn (at least at first).

Let’s take a look at a quick example to start. I’ll use LaTeX Base, a free online LaTeX editor. I recommend using it while you’re learning.

To open the document, I’ll declare a document class:

\documentclass{article}

There are many LateX document classes, but article is a common one.

After that, I’ll add the document title, the author’s name, and a date:

\title{Frankenstein; or, The Modern Prometheus}
\author{Mary Wollstonecraft Shelley}
\date{1 January, 1818}

Now, you’ll notice that none of this information is currently displayed in my document (the preview is on the right side of the screen):

LaTeX preamble information

That’s because this information is considered part of the preamble, which doesn’t appear in the LaTeX document.

Want to make it show up in the document? It’s easy. Just use the following line:

\maketitle

That’s all there is to it:

Inserting a title in a LaTeX document with \maketitle

Note that \maketitle must be between the document’s beginning and ending to work.

Within the body of the document, you can type plain text to insert it:

Inserting plain text into a LaTeX document

And for a bulleted list, use the following syntax:

\begin{itemize}
 \item First item
 \item Second item
 \item Third item
\end{itemize}

Here’s what it looks like in the editor:

Inserting a bulleted list into a LaTeX document

To create a numbered list, use enumerate instead of itemize.

Let’s add a section heading to make sure readers know that this is the introduction:

Adding a section heading to a LaTeX document

With a simple declaration:

\section{Introduction}

I’ve added a numbered section heading. LaTeX will automatically insert sections into a table of contents, if we want one.

As you can see, using LaTeX is straightforward—if you know the markup you need. That’s where tutorials and documentation come in.

Resources for Learning LaTeX

For the most part, learning to use LaTeX is all about finding the right information when you need it. You can start with plain text, then look up what you need for a section or sub-section heading.

Then you can find the information on how to insert a figure. Or a footnote. Or an entire bibliography. The best way to learn it is one step at a time.

To that end, here are some LaTeX resources that will help you out.

LaTeX Tutorials

One of the best introductions to LaTeX for beginners is Learn LaTeX in 30 Minutes by ShareLaTeX, an online LaTeX editor.

It goes over some of the basics that we covered above, as well as intermediate topics like mathematical equations, text formatting, comments, and figure captions.

Andy Roberts has a series of articles on LaTeX that will walk you through everything from the most basic setup all the way through figures and captions. It’s not clear if he regularly updates this, but it appears to be up-to-date at the time of this writing.

Overleaf, another free online LaTeX editor, also has a good LaTeX tutorial that will teach you the basics. They call it an “interactive” tutorial, but it’s really just a sequence of slides. That being said, it’s a comprehensive introduction to a lot of the commands you might want to try with LaTeX.

LaTeX Documentation

Whether you decide to use the above LaTeX tutorials or not, you’re going to need to reference documentation at some point.

LaTeX, an aptly titled book on Wikibooks, is a great place to start. It’s a comprehensive guide to the LaTeX system that includes everything from tables of contents to indices. Errors and warnings, algorithms, theorems, advanced mathematics, and anything else you could possibly want in LaTeX are included.

And because it’s on Wikibooks, it’s super easy to search.

LaTeX book

The official documentation from latex-project.org is another good resource, though it’s not exactly user-friendly. The documentation is split up into different documents meant for different people in the writing, editing, and typesetting processes.

The Not So Short Guide to LaTeX 2e is exactly what it sounds like: a (very long) guide to LaTeX. And while you could use it as a tutorial, as it does cover all of the basics, the massive size of this guide makes it better as a reference.

Finally, the guides section of ShareLaTeX is another good option. The resources there are somewhere between tutorials and references, and are great for when you have questions.

LaTeX Software

LaTeX isn’t a standalone piece of software. It runs on top of an older system called TeX. Many pieces of TeX software support LaTeX.

The official LaTeX project page recommends the following:

There are also a number of LaTeX online editors that you can use without downloading any software:

Start Using LaTeX Today

With the resources, tools, tutorials, and tips above, you can get started with LaTeX right away. It takes a while to get used to it, but once you do, you’ll be creating and formatting documents much more efficiently. You could continue making professional documents in Word, but why would you after you’ve seen what LaTeX can do?



from MakeUseOf https://ift.tt/2GDWuZn
via IFTTT

No comments:

Post a Comment