LaTex

On this page I noted some information and examples about LaTeX. This is a document preparation system.

Interesting Packages

Language Related

American:

usepackage[american]{babel}

Make Umlauts possible (2. variant with Unicode):

usepackage[latin2]{inputenc}
usepackage[utf8]{inputenc}

Include Pictures

usepackage{graphicx}

Display Soure-Code of Programs

usepackage{listings}

Tables Over Several Pages

usepackage{longtable}

Several figures side by side

usepackage{subfigure}
begin{figure}
begin{center}
subfigure[foo]
{
...
}
subfigure[bar]
{
...
}
caption{foo bar}
label{fig1}
end{center}
end{figure}

User-Defined Commands

Include a Graphic

newcommand{einbild}[3]{
begin{figure}
begin{center}
includegraphics[scale=0.75]{#1}
caption{#2}
label{fig:#3}
end{center}
end{figure}
}

einbild{pic1.eps}{This is figure 1}{fig1}

"Beautiful" Characters

usepackage{amsfonts}
newcommand{schoen}[1]{mathbb{#1}}
newcommand{mschoen}[1]{$schoen{#1}$}
mschoen{S}
$schoen{S}$

see ...

newcommand{see}[1]{{it(see #1 section~ref{#1}, page~pageref{#1})}}
see{fig1}

Comment Over Multiple Lines

newcommand{mycomment}[1]{}

mycomment{

THIS AREA WILL BE IGNORED

}

Lists

itemize

begin{itemize}
item foo
item bar
end{itemize}
  • foo
  • bar

enumerate

begin{enumerate}
item foo
item bar
end{enumerate}
  1. foo
  2. bar

description

begin{description}
item[foo] This is foo
item[bar] This is bar
end{description}
  • foo This is foo
  • bar This is bar

Content Should Appear on the Same Page

begin{samepage}
BLA BLA
begin{itemize}
item foo
item bar
end{itemize}
BLA BLA
end{samepage}

Tables

begin{table}
label{table1}
begin{tabular}[ht]{|l|l||l|l|}
hline
A & B & C & D\
hline
1 & 2 & 3 & 4\
hline
5 & 6 & multicolumn{2}{|l|}{7 8}\
hline
hline
9 & 10 & 11 & 12\
hline
13 & 14 & 15 & 16\
hline
end{tabular}
caption{A Table}
end{table}
LaTeX table

LaTeX Beamer

Create slides for your presentation with LaTeX Beamer directly from you LaTeX sources.

LaTeX Beamer

Choose a layout:

%usetheme{default}
%usetheme{PaloAlto}
%usetheme{Malmoe}
usetheme{Warsaw}

Start a new (sub-) section:

section{Foo}
%subsection{Bar}

Create a new page:

frame
{
frametitle{Foo}
...
}

Create the index:

frame{tableofcontents}

Show the following content not before the next slide:

foo pause bar

Let items appear successively

Manually select on which slide a item will appear:

begin{itemize}
item<1-> AA
item<2-3> BB
item<3-> CC
item<4-> DD
end{itemize}
1.2.3.4.
AAAABBAABBCCAACCDD

Elements won't be only invisible on some pages but also won't use any space there:

only<2-3>{FOO}
...
item<only@1-> FOO
...

The items will appear successively (unless otherwise noted):

begin{itemize}[<+->]
item AA
item BB
item CC
item<2-3> DD
item EE
end{itemize}
1.2.3.4.
AAAABBDDAABBCCDDAABBCCEE

Highlight the current item:

begin{itemize}[<+-| alert@+>]
item AA
item BB
item CC
end{itemize}
1.2.3.
AAAABBAABBCC
item<3-| alert@3> Foo
%alert<4>{Foo}

Elements which are not yet uncovered are shown transparent

setbeamercovered{transparent}

Show a block with the title FOO and the content BAR:

begin{block}{FOO}
BAR
end{block}

The block will only a appear on some slides:

begin{exampleblock}{Example}<2->
%begin{exampleblock}{Example}<only@2->

Include a graphics:

includegraphics[width=7cm,height=3cm]{foo.jpg}
%includegraphics<1>[height=2cm]{foo.pdf}%

Split a slide in two columns (The parameter indicates how to vertically arrange the two columns: b last line, c center, t (T) first line):

begin{columns}[t]
column{5cm}
Foo
column[T]{5cm}
Bar
end{columns}
begin{columns}
begin{column}[t]{5cm}
FOO
end{column}
begin{column}[t]{5cm}
BAR
end{column}
end{columns}

View presentation in xpdf in fullscreen mode:

xpdf -fullscreen presentation.pdf

gbrief

documentclass[german]{g-brief}
usepackage[T1]{fontenc}
usepackage[latin2]{inputenc}
usepackage{babel}
makeatletter
lochermarke
faltmarken
fenstermarken
trennlinien
%% klassisch
makeatother
begin{document}
Name{}
Unterschrift{}
Strasse{}
Zusatz{}
Ort{}
Land{}
RetourAdresse{}
Telefon{}
Telefax{}
Telex{}
EMail{}
HTTP{}
Bank{}
BLZ{}
Konto{}
Betreff{}
%Postvermerk{}
MeinZeichen{}
IhrZeichen{}
IhrSchreiben{}
Anlagen{}
Verteiler{}
Datum{today}
Anrede{}

begin{g-brief}

...

end{g-brief}
end{document}

Example: ,

Miscellaneous

References

BibTeX

cite{q1,q2}

Links

Latex Makefile with latexmk

latexmk Debian latexmk

myfile:=foo.tex

all: dvi pdf ps

dvi:
latexmk -dvi ${myfile}

pdf:
latexmk -pdf ${myfile}

ps:
latexmk -ps ${myfile}

force:
latexmk -g ${myfile}

view:
latexmk -pvc ${myfile}

clean:
latexml -c


figurelist=
foo
bar

figurelist := $(figurelist:%=figures/rendered/%.pdf)

figures: ${figurelist}

figures/rendered/%.pdf: figures/%.fig
fig2dev -L pdf $< $@