Posts Tagged ‘LaTeX’

LaTeX length units

Posted: 26th May 2010 by Tim in LaTeX
Tags: , , , , , , , , , , ,

There are many configurations and commands in LaTeX which require lengths to be set. The following length units can be used: in – imperial inch pt – point (1/72 of an inch) cm – metric centimeter mm – metric millimeter em – width of a capital “M” in the current font settings ex – width […]

Union (∪) and Intersection (∩) symbols in LaTeX can be produced via the \cup and \cap definitions while in math mode. No extra packages are required to use these symbols. For example: Let $L_C = L_A \cap (L_B \cup L_C)$ will produce:

This tutorial is for those who have gone through the first tutorial. Here we will cover new lines and paragraphs, comments, font decoration (bold, italic and underline) and sections. Fun. New lines and paragraphs First we will look at paragraphs. In LaTeX, having a new line in your .tex file (which we will refer to […]

In math, certain blackboard (double-barred) letters Z, N, R, etc. represent sets of numbers (integers, natural numbers, rational numbers, etc). These can be included in a LaTeX document using the \mathbb{[letter]} tag from within the math environment. Note that this requires the amssymb package to be included (ie: add \usepackage{amssymb} to the top of the […]

Often times you want to add entries to the references section of a LaTeX document without actualy citing them. The \nocite{reference} may be used to add the record to the references, but writing \nocite for each reference can get tedious. Luckily, adding \nocite{*} to the document will ensure that everything is added to the references.

Underline text in LaTeX

Posted: 13th April 2010 by Tim in LaTeX
Tags: , , , , ,

Underlining text in LaTeX is very easy – simply wrap the text with \underline{text}. For example, The cake was \underline{huge}. will produce: The cake was huge.

In BibTeX there is no bibliography record type for website references. Luckily, the Misc bibliography record type has a howpublished attribute, which may be mixed with the \url command to allow website referencing. Below is an example of a document named urlbib which demonstrates this. File: urlbib.tex \documentclass[a4paper,11pt]{article} \usepackage{url} \begin{document} \section*{Testing the URL citations} Line […]

In a LaTeX document, the parts of the document are broken up into \section{}, \subsection{} and \subsubsection{} blocks. Because the document sections are so clearly defined, adding a table of contents is as simple as adding \tableofcontents wherever you want the table of contents to be printed. For example: \documentclass[11pt, a4paper]{article} \begin{document} \tableofcontents \newpage \section{First […]

Rotating images in LaTeX

Posted: 19th March 2010 by Tim in LaTeX
Tags: , , , , , , , ,

Sometimes you want to display an image sideways if, for example, it’s wider than it is tall. Or sometimes you just want to show images at funny angles. Each to their own. In LaTeX, you can add parameters to the \includegraphics call (See this post on LaTeX figures to see how to add the images). […]

Standard LaTeX allows you to extract the current page number using the thepage command. That’s an easy one. To get the total number of pages (ie: number of the last page) is a little more involved. To do this, you need to use the \lastpage package and use \pageref{LastPage}. For example: \usepackage{lastpage} … You are […]

The learning curve for LaTeX documents can be a steep one. This step-by-step guide covers installing and setting up the LaTeX environment, and creating and compiling your first document so that you can read and distribute it. Setting up the LaTeX environment A few things need to be installed before we can start creating documents. […]

If you’ve written up a LaTeX document and find that some of the figures, tables, algorithms, etc. are being referenced wrong (such as Figure 2.4 being referenced as figure 6), chances are you’ve put your caption and \label tags in the wrong order. LaTeX needs \label to be after \caption, or for \label to be […]

Referencing in LaTeX

Posted: 12th December 2009 by Tim in LaTeX
Tags: , , , ,

One of the nice things about LaTeX is that it sorts out reference numbers for you. This is done through the use of the \label, \ref and \pageref commands. This allows us to add, remove or re-arrange elements without worrying about where they are referenced in the rest of the document The \label is a […]

Verbatim in LaTeX

Posted: 5th November 2009 by Tim in LaTeX
Tags: , , , , , ,

If you’re adding a section to a LaTeX document which has a lot of special characters (such as code, HTML, etc), you can add it verbatim. This means that special characters (<, >, {, }, $, etc) will not be processed and will be displayed as they are. There are two ways of printing verbatim. […]

Placing borders around figures in LaTeX

Posted: 24th October 2009 by Tim in LaTeX
Tags: , , , , , ,

If you’re displaying a figure of pseudo-code or anything else which may blend into the text of your document, you will probably want to place a border around it to separate it. This may be done using the \fbox{} and minipage commands. In short, you’re putting the figure in a minipage and placing a border […]

Changing font sizes in LaTeX

Posted: 1st October 2009 by Tim in LaTeX
Tags: , , , , ,

Changing the font sizes in LaTeX can be done quite easily without having to specify the size in pixels, points or other measurements. There are ten relative sizes which may be used (ranked from smallest to largest): \tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge There are two ways to specify the size. […]

If you’re doing calculus, you’re going to want to print out the integral symbol, and talk about limits. LaTeX makes that easy for you. In math mode (ie: between $…$, \[…\], etc), integral symbols may be added using the \int_{lower}^{upper} command. Adding \displaystyle beforehand will make the symbol large and easier to read. Limits are […]

Highlighting Table Rows in LaTeX

Posted: 6th September 2009 by Tim in LaTeX
Tags: , , , , , , , , ,

Ever want to highlight table rows in a LaTeX document? Unlike most LaTeX formatting, this one’s pretty simple. First, you need to \includepackage[table]{xcolor} at the top of the LaTeX document. (You will probably need to download the package (sudo apt-get install latex-xcolor on ubuntu). Next, simply add \rowcolor{color} before the table row. Colors include red, […]

LaTeX Footnotes

Posted: 1st September 2009 by Tim in LaTeX
Tags: , , , , ,

Adding footnotes to LaTeX is very easy. LaTeX will figure out which page to place the footnote on, correctly number the footnote and so on – all you have to do is provide the text using the \footnote{footnote text} command. For example: Michelangelo’s statue of David is one of the best known sculptures of the […]

Large brackets in LaTeX math equations

Posted: 23rd August 2009 by Tim in LaTeX
Tags: , , , , , ,

There are times when you need to print large brackets in equations, such as around fractions and such. Simply type \left( and \right) instead of the normal brackets. For example: \displaystyle\sum_{k=1}^\infty \left(\frac{16}{5}\right)^k would be displayed as follows:

Lining up equations in LaTeX

Posted: 16th August 2009 by Tim in LaTeX
Tags: , , , , , ,

When writing up math equations, it looks much nicer if all of the equals signs are under each other. This cannot be done in the default LaTeX environment, but can be done with the amsmath package included. In order to get the equations lined up, place the group of equations between align* tags. Then, simply […]

Therefore symbol in LaTeX

Posted: 16th August 2009 by Tim in LaTeX
Tags: , , , , ,

There is no therefore symbol in the default LaTeX packages. There are (at least) two ways of getting the symbol: The package amssymb contains the \therefore symbol definition. To use, do something like: \usepackage{amssymb} … $\therefore 1 \neq 2$ Alternatively, you can create your own therefore definition: \def\therefore{ \leavevmode \lower0.1ex\hbox{$\bullet$} \kern-0.2em\raise0.7ex\hbox{$\bullet$} \kern-0.2em\lower0.2ex\hbox{$\bullet$} \thinspace} The amssymb […]

Bold and Italic font in LaTeX

Posted: 16th August 2009 by Tim in LaTeX
Tags: , , , , , , , , ,

There are two ways to make text italic in LaTeX. The first and most common method is the \emph{text here} tag. This is used for emphasizing words within a block of text. For example: The cake was \emph{huge} for a cup cake If you’re looking to italicize a whole block of text, then use the […]

Math summation symbol in LaTeX

Posted: 15th August 2009 by Tim in LaTeX
Tags: , , , , , , , ,

LaTeX is great in that it can display all those strange math symbols for you.  Summation is a common symbol in math and really useful to know how to display in LaTeX. There are two ways of displaying the symbol: compressed to fit onto one line (useful when printing long equations or proofs) or in […]

Indenting a block of text in LaTeX

Posted: 15th August 2009 by Tim in LaTeX
Tags: , , , , ,

To indent a block of text, you can use the \addtolength{length_variable}{length} command. For this task, we need to add to the \leftskip value for the block of text. For example, to indent a block of text by 5mm we would do the following: {\addtolength{\leftskip}{5mm} …indented text here… }