Archive for the ‘LaTeX’ Category

LaTeX-Beamer with Bibliography and Newblock

Donnerstag, Juni 21st, 2007

Tomorrow morning I will give a presentation on publish/subscribe (read the abstract and the invitation – you are welcome to drop in!). To prepare the presentation I used the LaTeX Beamer Class. The package is great, but the command \newblock which I use in the bibliography does not work and constantly produces the error http://latex-beamer.sourceforge.net/. This is due to the fact that the \newblock is not defined in the Beamer Class. The solution is to define it yourself by adding the following line of code after the \begin{document} command:
\def\newblock{\hskip .11em plus .33em minus .07em}

With this simple line everything is fine and the bibliography works.

Tables in LaTeX

Donnerstag, Mai 17th, 2007

Have you ever created any tables in LaTeX? In my opinion tables are definitely one (the only one) of the weak points of this wonderful typesetting system. With LaTeX most common tasks (write a „normal“ report, standard formatting etc) are extremely easy, but creating tables with seems to be an occasion to tear one’s hair. Really? No!
Indeed there is a wonderful trick (thanks to Jutta for this hint) to easily add wonderful tables to your document: simply create it as a spreadsheet in the spreadsheet program of your favourite office suite (I recommend OpenOffice). Do not format the table, this is pure waste of time as all formatting will be lost later.
After you are done, save the table as Text CSV (.csv). Instead of saving the file with the standard CSV options, modify these options as follows: set the field delimiter to & and remove the text delimiter. This creates a .csv-file, in our example it is
expenses&2006&2007 replacement of dishes&300$&14$ fines for speeding&3500$&0$ fines for dodging paying the fare in trains&0$&600$ bail to be released after drug tracking&400$&1400$ 
Open this .csv-file in a text editor and copy its content to your favourite LaTeX editor (e.g. Kile). Now you simply have to modify this code to change it into a correct LaTeX table: add \\ at the end of each line of the table, add a \hline where you want a horizontal line, escape special characters (e.g. in our example the $sign) with a backslash \ and add (i.e. copy it from another document) the surrounding code like \begin{tabular}: \begin{table} \begin{center} \begin{tabular}{|l|r|r|} \hline expenses&2006&2007\\ \hline replacement of dishes&300\$&14\$\\ \hline fines for speeding&3500\$&0\$\\ \hline fines for dodging paying the fare in trains&0\$&600\$\\ \hline bail to be released after drug tracking&400\$&1400\\$ \\ \hline \end{tabular} \label{tab:expenses} \caption{Personal Expenses in 2006 and 2007.} \end{center} \end{table}

Even though the above code still seems to be complicated (it isn’t as you will realise when taking a closer look at it), this trick really simplifies the task of creating a table in LaTeX. When using it, the creation of tables in LaTeX does not become the easiest part of LaTeX but it is no more tedious and the countless advantages of LaTeX over Word make editing a report fare more efficient with LaTeX despite the rather cumbersome creation of tables.

I will talk about the advantages of LaTeX in a later post, so just look back later (or better: subscribe to my RSS-Feed).