## Referencing website URLs with LaTeX (BibTeX)

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

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 […]

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

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). […]

## Getting the current and last page numbers in LaTeX

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

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 […]

## 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: , , , , , ,

## 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 […]

## 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… }

## Drawing Horizontal Lines in LaTeX

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

Lines can be drawin in LaTeX using the \line function. This takes an x-slope, y-slope and length like so: \line(x-slope,y-slope){length} To draw a horizontal line (or horizontal rule), set the x-slope to 1 and the y-slope to zero. Depending on the margins which have been set, a length of 450 will draw a line which […]

## LaTeX Figures

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

Adding figures to LaTeX documents is quite simple. Like tables, figures can be added to the List of Figures automatically. Images need to be converted into encapsulated post script (eps) in order to be added to the document (other file types may be used with the inclusion of some external packages, which won’t be covered […]

## Changing Fonts in LaTeX

Posted: 28th July 2009 by Tim in LaTeX
Tags: , , , , , , , , ,

The default font used in LaTeX is a little bland. Most of us would like to use Times New Roman, Arial, Helvetica or something similar. This is quite a simple thing to do. All of the fonts are stored in packages and simply including that package (\usepackage{package}) will change the font. Some of the fonts […]

## Line Spacing in LaTeX documents

Posted: 22nd July 2009 by Tim in LaTeX
Tags: , , , , ,

Microsoft Word (and similar applications) give you the option to set double line spacing, 1.5 line spacing and so on. LaTeX, on the other hand, is much more flexible. The \linespread{spacing} command allows you to set any line spacing you like. For example, to get double line spacing, simply add: \linespread{2} to the top of […]

Posted: 22nd July 2009 by Tim in LaTeX
Tags: , , ,

LaTeX documents, by default, set the page margins to be quite big. In many cases this is too much and we need to make some adjustments. Margins are controlled with four settings: \textwidth, the width of the text on the page; \hoffset, the horizontal offset of the text (ie: how far the text is from […]

## LaTeX Tables

Posted: 18th July 2009 by Tim in LaTeX
Tags: , , ,

Creating tables in LaTeX is one of the more complicated tasks in simple document writing. This tutorial will cover the basics of creating LaTeX tables, including adding captions, adding the table to the List of Tables as well as referencing the table in other parts of the document. LaTeX is good in the way it […]

## Removing Paragraph Indenting in LaTeX

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

This may seem like a simple request, but I don’t want the first line of each paragraph in my LaTeX documents to be indented. I was surprised to find that I needed to traverse a page and a half of google search results to find the answer. So here it is. LaTeX will classify anything […]