Latex - Header

From Torben's Wiki

This header is outdated, better check out my template.

% by Torben Menke (
% Version 2009-09-02
% loads needed packages
% defines basic settings

% Test for correct encoding: äöüß


\documentclass[                 % Koma: scrartcl, srcreprt, srcbook, scrlttr2
%,draft                         % draft/final
,12pt                           % 10pt, 11pt, 12pt
,twoside                        % one/two: different layout for left/right pages
,onecolumn                      % one/two
,fleqn                          % equations aligned left
,ngerman                        %
,titlepage                      % titlepage / notitlepage = title on a page of its own
,liststotoc  %or ...numbered    % list of figures + -tables to table of contents
,bibtotoc                       % Lit Verz -> TOC
,abstracton                     % writs the word abstract above the abstract
%,noonelinecaption              % table + figure captions of only one line are not treated different 
                                % to multiline-ones
,bigheadings                    % big-,normal-, smallheadings: sets size of section-headings, std=big
,openany                        % openright : new chapters only on right pages, openany: do not care
                                % only for scrreprt and scrbook, not scrartcl

% put subsubsections in toc

\usepackage[ngerman]{babel}     % Languagesettings
                                % ngerman for new German spelling
%\usepackage[latin1]{inputenc}  % Umlaute (Windows)
\usepackage[utf8]{inputenc}     % Umlaute (Linux)
\usepackage[T1]{fontenc}        % Worttrennung von Worten mit Umlauten möglich


\usepackage{geometry}           % Pagesettings
% printversion: left=4cm
  % A4: 21cm x 29.7cm
  % 15cm = 425.2 pt
  % 23.5cm = 666.14 pt
\usepackage[automark]{scrpage2} % KOMA layout paket, automark is important!
%\cfoot[Torbens Diplomarbeit, Stand: \today]{Torbens Diplomarbeit, Stand: \today}
%\cfoot[--- \pagemark{} ---]{--- \pagemark{} ---}


[1] [2]

%% Palatino
%% \usepackage{palatino} is replaced by this (see l2tabu)
%\usepackage{mathpazo}            % MathFont Palatino
%% dirty solution to make headings use the text-font

%% Times
% \usepackage{times} is replaces by

%% Computer Modern Roman
%\fontfamily{cmr} \selectfont

% Gothic or OldGerman or Schwabenbacher 
% \usepackage{yfonts} 
& \swabfamily  or \gothfamily or \frakfamily or \initfamily


American Mathematical Society Guide

\usepackage[reqno]{amsmath}      % reqno: equation numbers right hand side of the eq
%\usepackage{amsfonts}           % Math fonts?


\usepackage{array}               % nicer \hlines
                                 % new column-align types in tabulars, similar to p{width}:
                                 % m(iddle), b(ottom)

%\usepackage{longtable}          % support for tables that are longer than one page and allows rotating together with package rotating
%  \centering
%  \begin{longtable}{|lll|}
%    table body
%  \end{longtable}

% Join / merge cells:
% columns: no package needed  \multicolumn{#cols}{c}{centered Multicolumn}
% rows (Zeilen):
\usepackage{multirow}            % merges a number of rows and centers text
                                 % use: \multirow{#rows}{width}{text}

% align table column by comma:
%\usepackage{dcolumn}            % use D{inputsep}{outputsep}{#digits}
% to use the comma as seperator for in+output
% \newcolumntype{d}[1]{D{,}{\mathcomma}{#1}}
% to use the dot as seperator for in+output
% \begin{tabular}{rd{2}l}

% Round Numbers and align at the comma.
%\usepackage{rccol}              % use: R{#digits before Komma}{#digits after comma}
                                 % R{3}{2}
%\usepackage{fltpoint}           % requirement for rccol


% graphicx is loaded in the pdf section
%\usepackage{graphicx}           % use: \includegraphics{filename} (without fileextension)
                                 % for dvi/ps latex the images have to be .eps or .ps
                                 % for pdflatex the images have to be .jpg, .png, .gif, .pdf, .bmp
                                 % work around: save 2 copys of the image: e.g. one .eps and one .jpg
%\usepackage{rotating}           % Rotate images
%\usepackage{subfigure}          % figure inside figure
\usepackage[outercaption] {sidecap} % Caption besides the figure
%\usepackage{wrapfig}            % Wrap text around figures or tables
\graphicspath{{./fig/}{.}}       % where to look for image-files


\ifpdfoutput{ %ifpdfoutput comes with Koma
%  \usepackage{epstopdf}
%  \newcommand{\inputfig}[1]{\input{#1.pstex_t}}
%  \DeclareGraphicsExtensions{.ps,.pstex,.eps,.pdf}
%% convertes eps files to pdf ones on the fly, using epstopdf (miktex)
%% use: pdflatex --enable-write18 FILENAME !!!!!!!!!!!!!
%  \DeclareGraphicsRule{.pstex}{pdf}{.pdf}{`epstopdf #1}
%  \DeclareGraphicsRule{.ps}{pdf}{.pdf}{`epstopdf #1}  
%  \DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf #1}  
    pdftex, % hypertex (default), pdftex
    final, % final, draft, debug -> more text in log file
%    pdfstartview={Fit},
%    plainpages=false,
%    pdfpagelabels=true,
%    colorlinks=false,
%    pdfborder={0 0 0}, % no colorful frames around links
%    unicode, % Unicode encoded pdf strings
    linkcolor=black, citecolor=black, filecolor=black, pagecolor=black, urlcolor=black

%  \pdfinfo {
%  /CreationDate (D:20060901010000) % this is the format used by pdf for date/time:YYYYMMDDhhmmss
%  /ModDate      (D:20060901020000)
%  }
% \texorpdfstring helps generations formulas, that can be used as pdf _bookmark_ titles:
% \section{Die \texorpdfstring{$e^x$~}{Exponential-}Funktion}
}{ % if dvi/ps output

This warning

PDF inclusion: found PDF version <1.5>, but at most version <1.4> allowed

can be removed by placing


above the \documentclass{...}. (Maybe later works as well, not tried)


%\usepackage{textcomp}           % Additional Symbols
%\usepackage{ifsym}              % Additional Symbols
%\usepackage{wasysym}            % Additional Symbols
%\usepackage{stmaryrd}           % Additional Symbols
\usepackage{pxfonts}             % Additional Symbols 
                                 % pxfonts for font palatino / txfonts for times

\usepackage[squaren,textstyle]{SIunits} %
% adds support for SI units like \ampere, \ohm
% defines \unit{}{}, %  \unit{10}{\centi\meter}
% textstyle for using the same font, than the surrounding text
% if textstyle is used, only buildin units should be used: cm->\centi\meter
% squaren for problems with amssyb package

%\usepackage{slemph}             % \emph{} writes text now in \textsl instead of \textit

\usepackage{float}               % adds placement rule H for floats -> exactly HERE 

% defines the command \FloatBarrier: the name is program
% [section] : floats are not allowed to travel into another section

% makes Problems with pdflatex !!!
%\usepackage{varioref}           % \vref{eqn:dreieck} = x on page y

\usepackage{color}               % Support for colors :\textcolor{red}{Red Text}
\usepackage{url}                 % www-links etc. \url{}
\usepackage{upgreek}             % Upright greek letters: \uppi, \upalpha...
\usepackage{xspace}              % \xspace can be used in newcommands without parameters to ensure whitespace after it


%\usepackage[right,modulo]{lineno}             % Adds line-numbering, modulo every 5th
% redifine \section -> section \linenumbers*
% '*' stands for a reset of the number
% PROBLEMS WITH \listoffigures and \listoftables !!!!!!!!
%  \def\tempOPT{#1}%
%  \ifx\tempOPT\empty\sectionorg{#2}
%  \else\sectionorg[#1]{#2}\fi\linenumbers*}
%  \def\tempOPT{#1}%
%  \ifx\tempOPT\empty\subsectionorg{#2}
%  \else\subsectionorg[#1]{#2}\fi\linenumbers*}


%,intoc % put in table of contents
\setlength{\nomlabelwidth}{.15\hsize} % distance label-text
\setlength{\nomitemsep}{-\parsep} % no spacing between lines
%\renewcommand{\nomlabel}[1]{#1 \dotfill}

Index List

\usepackage{makeidx}            % support for creation of index list
% use '\index{Moinsen} Moinsen' in the document
% \printindex  %prints the index list here
% Attention: to create the index you may have to run the following command by hand:


\usepackage[square]{natbib}     % needed by plainnat + dinat Bib Styls, square -> [] instead of ()
%\bibliographystyle{./dinatTM}  % located in my folder



% Seperate paragraphs by an empty line instead of intending the line
\setlength{\parskip}{2ex plus0.5ex minus0.3ex}

% from l2tabu.pdf (Latex Sündenregister), page 6
\tolerance 1414
\hbadness 1414
\emergencystretch 1.5em
\hfuzz 0.3pt
\vfuzz \hfuzz

% penalty for words split on two lines
%\tolerance 9000               % Less Bad-Box-Warnings, less too long lines !!!
%\exhyphenpenalty=5000                 % Removes Problems with words containing "-" a la E-Lock

%\numberwithin{equation}{section}      % Sectionnummer in x

% layout of Captions in Tables and Figures (Bildunterschriften)
\setkomafont{captionlabel}{\bfseries}  % Font of the Label 'Figure' etc
\setkomafont{caption}{\small}          % Font of the Caption \itshape
\setcapindent{0em}                     % decrease intention of following lines
% \setcapwidth[c]{0.75\textwidth}      % not here, for it makes problems with package sidecap!

%% dictum = Zitate

Hyphenation (Worttrennung)


my own commands

% Syntax:
% \newcommand{\myCommand} [ N ] [ STD ] { DEFINITION }
% N = num of arguments
% STD -> Arg 1 is optional, if missing its value is STD

% I want to have a German and an English Abstract, so I duplicated the environment
  \renewcommand*{\abstractname}{Abstract} \abstract}{%

\newcounter{todos} \setcounter{todos}{0}
\emph{\textcolor{red}{TODO: #1}}%
\emph{\textcolor{blue}{WORT: #1}}%

% \footnotetextref{Text über Drop Coating}{text:dropcoating}

\newcommand{\footnotetextref}[1]{% do not insert spaces!!!
\footnote{vgl. Seite \pageref{#1}}%
\newcommand{\engl}[1]{% do not insert spaces!!!
\newcommand{\enTOde}[1]{% do not insert spaces!!!

\newcommand{\mW}  [1]{\unit{#1}{\milli\watt}}
\newcommand{\uW}  [1]{\unit{#1}{\micro\watt}}
\newcommand{\eV}  [1]{\unit{#1}{\electronvolt}}
\newcommand{\meV} [1]{\unit{#1}{\milli\electronvolt}}
\newcommand{\nm}  [1]{\unit{#1}{\nano\meter}}
\newcommand{\um}  [1]{\unit{#1}{\micro\meter}} 
\newcommand{\mm}  [1]{\unit{#1}{\milli\meter}} 
\newcommand{\sek} [1]{\unit{#1}{\second}}

\newcommand{\symkreis}  {\ensuremath{\medcirc}}  % needs package pxfonts or txfonts
% \widehat = doof
% \mathrel = corrects spacings

% centered figure
\caption[#4]{#5}% \caption[shortcaption]{caption}

% Caption besides the figure
\newcommand{\scBild}[5][tb]{% sidecap
\caption[#4]{#5}% \caption[shortcaption]{caption}

% param1=placement htbp (optional)
% param2=filename (without extension, must be located in folder fig/)
%       Label: \label{fig:#2}
% param3=width (5cm or 0.5\textwidth etc)
% param4=shortcaption
% param5=caption

%\cBild[htbp]{img_setup}{0.5\textwidth}{short caption for list of figures}{caption}
%\scBild[htbp]{img_setup}{6cm}{short caption for list of figures}{caption}

\renewcommand{\arraystretch}{0} % removes rowspacing
\begin{tabular}{c@{}c}%  @{} removes the columnspacing
\setcapwidth[c]{.9\textwidth}% usefull?
\caption[#3]{#4}% \caption[shortcaption]{caption}
% param5  :

\includegraphics{fig/#1}%  the '%' is important!!! , removed width [width=#3]
\setcapwidth[c]{0.9\textwidth}% usefull?
\caption[#2]{#3}% \caption[shortcaption]{caption}

  \setcapwidth[c]{0.9\textwidth}% usefull?
  \caption[#3]{#4}% caption above table???

% usage:
% \cTabelle{htbp}{shortcaption}{caption}{label}{lr}
% {
% nicht & viel\\
% }

% print the number of the last equation
% \lasteqn[n] -> (n+1)th last; (n = optional)
% print the number of the next equation
% \nexteqn[n] -> last + n (n = optional)