I know most of the world uses Word and Microsoft Office products so this post is for the chosen few – the small minority do use LaTeX.
LaTeX produces beautiful documents, with equations if needed which is big selling point for many. LaTeX has been around since the 1980’s and is based on TeX produced by iconic computer scientist Donald Knuth in 1978. Unlike most things in the ethereal world of information technology, it seems LaTeX is not going to die even in the age of tablets (see The revolution will be typeset, D.Steele, Physics World, Jan 2013, p35).
LaTeX produces beautiful documents, with equations if needed which is big selling point for many. LaTeX has been around since the 1980’s and is based on TeX produced by iconic computer scientist Donald Knuth in 1978. Unlike most things in the ethereal world of information technology, it seems LaTeX is not going to die even in the age of tablets (see The revolution will be typeset, D.Steele, Physics World, Jan 2013, p35).
However, LaTeX is not simple to use. There is lots of help, many free guides which a search for LaTeX guide will turn up, or one of my favourites, Tobi Oetiker’s The not so short guide to LaTeX2e.
What is missing are some of the little things. At least, these useful snippets may be out there but they are buried under the important things. So I thought I would post my top tiny tips, the little bits it took me ages to discover, the things I see again and again in the reports from my students.
- Never leave an empty line after the end of an equation or eqnarray unless you really mean to start a new paragraph after the equation.
An empty line in regular text always indicates the start of a new paragraph and the next line of text will be indented. Usually equations are meant to be read as being in the middle of a paragraph. - Quotes in LaTeX are built from the two different types of single quotes, do not use the double quote symbol.
The right way to get quotes is to put one or two single backwards quote characters ` (grave accent, ASCII 96, on a funny key to the left of the number 1 on my UK keyboard) at the start of a phrase, and match with the same number of normal single quotes ‘ (apostrophe, ASCII code 39, with the @ symbol on my UK keyboard). Never use the single symbol for a double quote “ (ASCII 34, on the key with the number 2 on my UK keyboard). LaTeX will interpret matched pairs of single quotes as a double quote and will produce a nice result. So use`single quote'
,``double quote using pairs of single quotes''
but never use the"double quote characters"
. Note how these may well appear very similar when rendered on a web page but LaTeX will produce very different results for each. - For labels as subscripts, use the \mathrm{text} to get the text in roman (normal) not italic (slanted) style usually used for maths.
Thus x_{\mathrm{max}} looks better than plain x_{max}. If you use this a few times, why not define a new command
e.g. \newcommand{\xmax}{x_{\mathrm{max}}} which is usually placed before the \begin{document}. - Likewise,all the standard functions of mathmatics have their own commands. The function is then typeset in standard roman so that it stands out from the italic style usually used for maths. That is use \ln not ln or \cos not cos as the second version sometimes looks like it might be two or three variables, say l and n, multiplied together.
- For “much less than” and “much more than” symbols do not use double less than or double greater than signs.
There are special commands \ll and \gg which look much better than doing << and >>. - To see all the labels used in equations figures, sections etc. while you are writing a document, put a
\usepackage{showkeys}
command near the top of the LaTeX file, just after the documentclass command.
- Dashes and hyphens:-
- one for a hyphenated-word,
- two for a number range 1–2,
- three for a punctation dash — like this (note spaces either side of the three dashes).
- To get the name of the file used to start LaTeX use something like
\texttt{{\jobname}.tex}}
To get the names of all the constituent LaTeX files is harder.
- I may want to create my own simple symbol by placing two on top of each other. LaTeX has some standard symbols for spaces and it is useful to know some of them for minor tweaks.
- \; a thick space
- \: a medium space
- \, a thin space
- \! a negative thin space
- \qquad a large space
So for example I might write
\begin{eqnarray} A &=& B \, , \qquad B=C \\ I &=& \int_{0}^{1} dx \; x \cos(2 \pi x) \end{eqnarray}