by John on December 16, 2008
A lot of good (La)TeX resources come from Germany. I assume from the amount of development and support activity, there are probably a lot of users as well. Does anyone know why TeX is apparently so strong in Germany? Is there something about the German language that TeX supports particularly well?
by John on November 24, 2008
My previous post described how to put links in a PDF file generated from LaTeX. The hyperref package that lets you to include links also lets you to set PDF document properties. I’ve been using Adobe Acrobat to do this after creating my PDF file with pdflatex, but that’s unnecessary. Here’s how to put the PDF properties directly in the LaTeX file. Add something like this
\hypersetup
{
pdfauthor={John Hancock},
pdfsubject={Some subject},
pdftitle={Sample document},
pdfkeywords={LaTeX, PDF, hyperlinks}
}
after the \usepackage{hyperref} instruction at the top of your file.
by John on November 24, 2008
This has been on my to-do list for a while, but I finally found out how to embed hyperlinks in a PDF file generated from LaTeX.
Short answer: put \usepackage{hyperref} in your header, and when you want to link to a page, use the command \href{URL}{anchor text}. For example,
\documentclass{article}
\usepackage{hyperref}
\begin{document}
Here's a link to \href{http://twitter.com/home}{Twitter}.
\end{document}
For much more detail on links in LaTeX documents, see Patrick Jöckel’s LaTeX-PDF page and the hyperref package documentation.
by John on October 11, 2008
A while back I was trying to paste a figures into a LaTeX document this evening with names like foo_27.png and foo_32.2.png, putting a parameter value into the name of the plot. The former worked but the latter didn’t.
It turns out the \includegraphics command parses the file extension in a naive way to determine the file type. When it sees foo_27.png, it says “OK, a .png file”. But when it sees foo_32.2.png, it says “.2.png? I’ve never heard of that file type.”
Related post:
Including graphics in LaTeX documents
by John on September 16, 2008
Gregor Gorjanc has a post on Excel and LaTeX that lists four ways to convert and Excel table into LaTeX. I’ve used two of the methods he lists: brute force and excel2latex. I recommend excel2latex. I used it frequently until I upgraded to Office 2007 and the plug-in quit working. The only bug I remember with it was that sometimes it would give you a warning saying it didn’t work, but it did; the LaTeX code you wanted was waiting for you on the Windows clipboard.
I plan to try out Gregor’s other two suggestions. Creating tables in Excel is far easier than doing so in LaTeX and I miss the functionality that excel2latex provided. Maybe there’s a way to use excel2latex with Excel 2007. If you know of a way, please leave a comment.
Here are the rules for including images in LaTeX files as far as I can tell.
Near the top of your document, use \usepackage{graphicx} to load the graphicx package. Then at the point where you want to include your image, use \includeimage{...} where … is the path to your file.
If you want to create a PDF file with pdflatex, your image must be in PDF, PNG, or JPEG format.
If you want to create a DVI file with latex or a PS file with dvips, your image must be in PS or EPS format.
There’s no way to include a GIF file without first converting it to another file format.
If you use \usepackage{pgf} rather than \usepackage{graphics} at the top of the file, nothing changes except that you must chop the file extensions off image file names.
Related post:
Watch what you name graphics files in LaTeX
I use LaTeX for math documents and PowerPoint for presentations. When I need to make a math presentation, I can’t have everything I want in one environment. I usually go with PowerPoint.
Yesterday I tried the LaTeX Beamer package based on a friend’s recommendation. I believe I’ll switch to using this package as my default for math presentations. Here are my notes on my experience with Beamer.
Installation
Beamer is available from SourceForge. The installation instructions begin by saying “Put all files somewhere where TeX can find them.” This made me think Beamer would be another undocumented software package, but just a few words later the instructions point to a 224-page PDF manual with plenty of detail. However, I would recommend a couple minor corrections to the documentation.
- The manual says that if you want to install Beamer under MiKTeX, use the update wizard. But the update wizard will only update packages already installed. To install new packages with MiKTeX, use the Package Manager. (Command line
mpm.exe or GUI mpm_mfc.exe.)
- The manual says to install
latex-beamer, pgf, and xcolor. The Package Manager shows no latex-beamer package, but does show a beamer package.
The installation went smoothly overall. However, the MiKTeX Package Manager doesn’t let you know when packages have finished installing. You just have to assume when it quits giving new messages that it must be finished. At least that was my experience using the graphical version.
Using Beamer
I found Bruce Byfield’s introduction to Beamer helpful. The Beamer package is simple to use and well documented.
It’s nice to use real math typography rather than using PowerPoint hacks or pasting in LaTeX output as images. I also like animating bullet points simply by adding \pause to the end of an enumerated item.
Inserting images
The biggest advantage that PowerPoint has over LaTeX is working with images. With PowerPoint you can:
- Paste images directly into your presentations.
- Edit files in place.
- Carry around your entire presentation as a single file.
- Include multiple image formats in a consistent way.
The last point may not seem like much until you’ve tried to figure out how to include images in LaTeX.
I frequently need to look up how to add diacritical marks to letters in HTML, TeX, and Microsoft Word, though not quite frequently enough to commit the information to my long-term memory. So today I wrote up a set of notes on adding accents for future reference. Here’s a chart summarizing the notes.
| Accent |
HTML |
TeX |
Word |
| grave |
grave |
\` |
CTRL + ` |
| acute |
acute |
\' |
CTRL + ' |
| circumflex |
circ |
\^ |
CTRL + ^ |
| tilde |
tidle |
\~ |
CTRL + SHIFT + ~ |
| umlaut |
uml |
\" |
CTRL + SHIFT + : |
| cedilla |
cedil |
\c |
CTRL + , |
| æ, Æ |
æ, Æ |
\ae, \AE |
CTRL + SHIFT + & + a or A |
| ø, Ø |
ø, Ø |
\o, \O |
CTRL + / + o or O |
| å, Å |
å, Å |
\aa, \AA |
CTRL + SHIFT + @ + a or A |
The notes go into more details about how accents function in each environment and what limitations each has. For example, LaTeX will let you combine any accent with any letter, but MS Word and HTML only support letter/accent combinations that are common in spoken languages.
Some programming languages are much easier to come back to than others. In my previous post I mentioned that Mathematica is easy to come back to, put Perl is not.
I found it easy to come back LaTeX after not using it for a while. It has a few quirks, but it’s basically consistent. The LaTeX commands for Greek letters are their names, lower case names for lower case letters, upper case names for upper case letters. The command for a mathematical symbol is usually the name a mathematician would give the symbol. Modes always begin with \begin and end with \end.
Python also has a consistent syntax that make it easier to come back to the language after a break. Someone has said that Python is similar to Perl, except that the word “except” does not appear nearly so often in the Python documentation.
It’s more important that a language be internally consistent than conventional. Each of the languages I mentioned have their peculiarities. Mathematica uses square brackets for function argument arguments. LaTeX uses percent signs for comments. Python uses indention to denote blocks. Each of these take a little getting used to, but each makes sense in its own context.
A special case of consistency is using full names for keywords. Mathematica always spells out words in full. For example, the gamma distribution object is named GammaDistribution. I don’t mind a little extra typing. I’d rather optimize for recall and readability than minimize keystrokes since I spend more time recalling and reading than typing. (One flaw in LaTeX is that it occasionally uses unnecessary abbreviations. For example, \infty for infinity. The corresponding Mathematica keyword is Infinity.)
Here’s an interesting graph from Marko Pinteric comparing Microsoft Word and Donald Knuth’s LaTeX.

According to the graph, LaTeX becomes easier to use relative to Microsoft Word as the task becomes more complex. That matches my experience, though I’d add a few footnotes.
- Most people spend most of their time working with documents of complexity to the left of the cross over.
- Your first LaTeX document will take much longer to write than your first Word document.
- Word is much easier to use if you need to paste in figures.
- LaTeX documents look better, especially if they contain mathematics.
See Charles Petzold’s notes about the lengths he went to in order to produce is upcoming book in Word. I imagine someone of less talent and persistence than Petzold could not have pulled it off using Word, though they would have stood a better chance using LaTeX.
Before the 2007 version, Word documents were stored in an opaque binary format. This made it harder to compare two documents. A version control system, for example, could not diff two Word documents the same way it could diff two text files. It also made Word documents difficult to troubleshoot since you had no way to look beneath the WYSIWYG surface.
However, a Word 2007 document is a zip file containing a directory of XML files and embedded resources. You can change the extension of any Office 2007 file to .zip and unzip it, inspect and possibly change the contents, the re-zip it. This opens up many new possibilities.
I’ve written some notes that may be useful for people wanting to try out LaTeX on Windows.
by John on January 17, 2008