It has been a while since I last used LaTeX. And things have moved on. I wanted to write a paper as well as preparing some slides. I also had to include vector graphics and bitmaps as well as source code. So this is what I learnt:
- Use pdfLaTeX! It produces PDF straight away and including images in various formats is painless.
-
Including images:
% in the preamble \usepackage{graphicx} %wherever you need to include \includegraphics[width=12cm]{image.png}
This supports png and jpg as well as pdf for vector graphics. You might want to use
epstopdf
to produce
pdf form eps. -
Including source code with listings:
\usepackage{listings} %Setting defaults for formatting \lstset{ language=Java, basicstyle=\ttfamily\small, keywordstyle=\textbf, stringstyle=\ttfamily\textbf, showstringspaces=false, commentstyle=\textsl, captionpos=b } % And now including code \begin{lstlisting} public interface ListDataListener extends EventListener { void intervalAdded(ListDataEvent e); void intervalRemoved(ListDataEvent e); void contentsChanged(ListDataEvent e); } \end{lstlisting}
-
Setting urls:
\usepackage{url} \url{http://wuetender-junger-mann.de}
-
Creating slides using the beamer class (beamer being German for projector) to show code
snippets:\documentclass{beamer} \usepackage{listings} \title{Weird Presentation} \author{Felix Leipold} \date{January 2009} \begin{document} \frame{\titlepage} \begin{frame}[containsverbatim] \frametitle{Example} \begin{lstlisting} sourcode.goesHere(); \end{lstlisting} \end{frame} \end{document}
- These days there is good support for using postscript fonts instead of computer modern. The following packages help including them: times, avant, bookman, newcent, palatino, helvet. The are included with \usepackage{packagename}.
-
When using latex for reporting the
longtable
package provides
good support for tables spanning multiple pages. - Further reading:
- LaTeX Wikibook
- Manuela Jürgens: LaTeX – Eine Einführung und ein bisschen mehr….
- Manuela Jürgens: LaTeX – Fortgeschrittene Anwendungen.
Leave a Reply