# Latex to Display Mathematics

When writing regular text documents, they are limited to a single line. To even have underline or subscript you need to move to rich text format or beyond. This article describes what you need to make documents with all formulas clear and good looking. You also get an overview of the tools.

LaTeX is a markup language designed specifically for mathematics but it also caters for languages that is not written with standard characters. Examples of languages are: Arabic, Chinese and Sanskrit.

The markup is surprisingly simple, with two modes. The modes are inline and display, the difference between the two is that display will put everything on its own line and inline will have embedded in the line.

## Why LaTeX instead of word processors?

The reason to use LaTeX instead of word processors are many. The project was started because most word processors could not handle mathematics. This has changed for the better now. Currently, the main reason is that when you use LaTeX you decide what you are writing not where it goes on the page, the placing and font are handled by the process after you have written your text. In a word processor you may choose the font for any individual top heading, in LaTeX you pick the style for the document and all headings follows a style. With the LaTeX method you decide what heading it is and continue writing. The methods differ in their approach when in that the LaTeX method separates the layout completely from the meaning. This means that this tool is not useful for creating unique layouts and graphics.

To illustrate how LaTeX works, you must first see the basic structure of a .tex document.

The document starts with a document class statement that defines the formatting. The other absolute necessary statements are the begin and end statements. If you want comments, add a percent sign at the beginning of a line.

\documentclass{article}
%this demonstrates a comment
\usepackage{amsmath}
\begin{document}
This is your text.
\end{document}

The above is the absolutely simplest document you can create. There are many more predefined statements but those are easy to find in the documentation. It is important to mention use packages, they are created to support special cases. The one that is interesting for maths is ‘amsmath’, it contains most symbols for mathematics. To handle more specialized work there are many other use packages that can be loaded in. The wikibooks website has a nice reference list.  To show what the main use of LaTeX is, it is better to use some equations.

First, you want to start a maths section with a begin statement.

\begin{math} .... \end{math} or in shorthand $$...$$ or even shorter $...$

A good idea is to the longest form when you create multiline equations and the shorthand for inline equations.  So here are a few equations:

Einstein’s famous

$E = mc^2$

To use fractions:

\begin{equation}
\frac{x+y}{y-z}
\end{equation}

To use root you can optionally set two for a square or any arbitrary value.

\begin{equation}
\sqrt[3]{{\frac{x^n-4}{y^2 + z}}}
\end{equation}

As you can see, there are options here to use the text sqrt to make a square or just using the roof (^) symbol.

And here is Euler’s equation:

\begin{equation}
e^{ \pm i\theta } = \cos \theta \pm i\sin \theta
\end{equation}

The above results in what you see in picture 1.

To the right of the equations you see a reference number that LaTeX adds when you use the keyword ‘equation’.

### The Tools

To start with, it takes a bit getting used to the notation and most users will need a reference sheet for all the symbols.  You can find help with some tools for Linux, and other operating systems. These tools will help with syntax highlighting and can also process into known formats directly form the application.

Latexila is a Gnome desktop centered application that includes many use packages. The display shows the packages, an editing area and a console to show the processing of your document. It also includes templates for you to create different types of documents. When you use them, the essential markup is already inserted and you can get started immediately. you also get code completion the same way you get it when programming.

Lyx uses the Gtk+ framework, it has workspace that resembles other wysiwig editors more. There are many templates included and the code is shown in a window below. This editor is more appropriate when you are starting out, before you have a feel for the result of different markup.

#### Use Packages Commonly Available

Except for the mathematics packages that are available there are many others. Some of them handle languages and some are aimed at specific branches of science. The first place to look for packages is the CTAN web page. This resource has hundreds of packages for diverse subjects such as physics, chemistry, statistics and even quantum computing. A lot of the packages are there to help convert to formats of all kinds, e-book conversion  It is highly likely that your subject already has a package to help you document your project.

##### Conclusion

LaTeX is a very powerful documentation system that can make your job easier after you have learned how to handle the markup language. With the hundreds of packages for different topics you will most likely already have what you need to get your points across with nice equations and diagrams. You will also adhere to standards in the academic world which will give you an air of authority.

### About the author

#### Mats Tage Axelsson

I am a freelance writer for Linux magazines. I enjoy finding out what is possible under Linux and how we can all chip in to improve it. I also cover renewable energy and the new way the grid operates. You can find more of my writing on my blog.