Posts Tagged ‘document’

Power crosses are useful diagrams for doing lens power calculations in optics. Drawing the power crosses in LaTeX can be tedious, especially if you need to draw multiple power crosses in the same document. The code below creates a new command, \powercross{front@90}{front@180}{back@90}{back@180}, which will draw the power crosses for you and calculate the final lens […]

There are a few ways to do this, but one of the simplest ways to pretty-print code in LaTeX documents is to use the listings package. The package can be configured to use specific colors for different parts of the code, with many programming languages supported. The following document will display code for both C++ […]

Math product symbol in LaTeX

Posted: 28th August 2013 by Tim in LaTeX
Tags: , , , , ,

In a similar manner to the summation symbol, the product symbol can easily be added to a LaTeX document using the \prod notation. The sybmol can be compressed to fit on one line (useful for small equations displayed within a text block), or enlarged to make it more readable. For example, to print the formula […]

When using kanji in a document which is non-standard or rare, it is common for hiragana or katakana characters to be printed above (or beside for vertical text) the kanji to aid pronunciation. This is also common in children’s books and other Japanese learning material. This post explains how to do that using LaTeX. This […]

Small caps in LaTeX

Posted: 21st January 2012 by Tim in LaTeX
Tags: , , , , ,

Writing text in smallcaps in LaTeX is quite easy – just wrap your text in the \textsc{<text>} tag. For example: \textsc{This text is in small caps} Will create This text is in small caps

Japanese, like many other Asian languages, is written using a variety of symbols which are not found in the standard ASCII table. Fortunately, you can include these symbols in LaTeX documents using the CJK package. In ubuntu this can be installed via the sudo apt-get install latex-cjk-japanese command. I’m not sure about Windows, Mac or […]

Ever wanted to add some music to a document? It’s not really a big feature for most word processors and most solutions involve creating an image using some third party software and copying that image into the document. The idea is the same in LaTeX, but it’s much easier to manage. LilyPond is a free […]

When writing a math definition of a function, for example, the function may have different results depending on the value of the inputs. These are called cases and are grouped together with a large left curly brace. If you’re trying to typeset this in LaTeX, the cases environment makes this nice and easy. It’s easiest […]

Adding text in math mode in LaTeX

Posted: 4th December 2011 by Tim in LaTeX
Tags: , , , , , ,

Occasionally you’ll want to add some text to a maths equation in LaTeX. By default, any text is written in italics, and white space is ignored. The solution is quite simple; put the text in a \text{…} block like so: $$x = \sqrt{x^2} \text{ : where $x$ is positive}$$ As you can see, you can […]

Spanning columns in LaTeX tables

Posted: 27th November 2011 by Tim in LaTeX
Tags: , , , , , , ,

Tables are a fairly important part of LaTeX. Often you will want data to span multiple columns of the table, similar to colspan in HTML. In LaTeX it’s pretty easy too, using the \multicolumn{<cols>}{<format>}{<cell_text>} command, where <cols> is the number of columns to span and <format> is the cell format (l, c or r for […]

Using colors in LaTeX

Posted: 21st October 2011 by Tim in LaTeX
Tags: , , , , , , , , ,

If you want to add a bit of color to your LaTeX document, you can do this quite easily with the color package. This package works with both pdflatex and latex and gives you the following color options: blue cyan green magenta red yellow To use the colors, simply include the color package and wrap […]

Gnuplot is a great tool for creating plots. LaTeX is a great tool for creating documents. Both are (or at least can be) created using a text editor and compiling the source. Both work with Windows, linux/unix and Mac. Wouldn’t it be great if you could include a gnuplot plot in a LaTeX document without […]

In LaTeX, by default, tables are numbered Table 1, Table 2, Table 3 an so on (or Table 1.1, Table 1.2, Table 2.1, etc if you’re using chapters). Sometimes you may want to change the way these are numbered. The solution is very similar to changing list numbering styles using different keywords. Like enumeration lists, […]

If you want to include a glossary, definitions or some other descriptive list in your LaTeX document, you can make use of the description list type. This is a lot like the other list types except that \item can take an argument, the item `name’, in square brackets (ie: \item[Tim Murphy] Author of http://timmurphy.org). In […]

BibTeX is great in that it ensures all of the entries are output in the same style. The most noticeable formatting change is the Author field; John Smith becomes Smith, J for example. Useful, unless your author is not a normal name. Let’s say that you’ve got an article written by the Reserve Bank of […]

Splitting up LaTeX documents

Posted: 14th November 2010 by Tim in LaTeX
Tags: , , , , , , ,

If you’re writing a large LaTeX document like a book or a thesis, you probably don’t want to have the whole thing in one massive file. It’s the same principle as general programming; splitting the program into smaller components makes it easier to work with, maintain and test. In Microsoft Word you can do this […]

This tutorial is for those who have gone through the first and second LaTeX tutorials, and should give you the knowledge required to understand more specific LaTeX tips both on this site and on other websites. This tutorial will cover Packages and the basics of math mode. Packages Much like in programming, additional functionality can […]

LaTeX has the ability to draw images out of the box. The drawing functionality is pretty basic — lines, circles, boxes and the like — but perfect for most simple diagrams. This tutorial will be split into three sections: configuring the environment, different ways of drawing shapes, and a description of the shapes themselves. Configuring […]

There are a number of ways to change the document header and footer styles in LaTeX. One of the easiest and most flexible options is to use the fancyhdr package. fancyhdr is a massive package with a crazy number of tweaks and modifications available for your document’s header and footer styles. This tutorial will only […]

Latex allows the creation of itemized (unordered) lists up to four deep. The numbering styles for each depth can be styled to suit your needs using the \renewcommand{label}{style} command, where label is the list depth being styled and style is how you want that number to be shown. label may be any of the following: […]

Latex allows the creation of enumerated (ordered) lists up to four deep. The numbering styles for each depth can be styled to suit your needs using the \renewcommand{label}{style} command, where label is the list depth being styled and style is how you want that number to be shown. label may be any of the following: […]

There are times when you want to have multiple columns on part of a page. You could use tables to get such a layout, but that’s a bit dirty. A nice, clean method is to use the minipage environment. Minipages are defined with a width parameter. If you have multiple minipages defined immediately after each […]

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