Latex - Header

From Torben's Wiki
Revision as of 16:20, 23 October 2012 by Torben (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This header is outdated, better check out my template.

% by Torben Menke (http://www.entorb.net)
% Version 2009-09-02
% loads needed packages
% defines basic settings

% Test for correct encoding: äöüß

Documentclass

\documentclass[                 % Koma: scrartcl, srcreprt, srcbook, scrlttr2
a4paper
%,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
]{scrreprt}

% put subsubsections in toc
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\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

Layout

\usepackage{geometry}           % Pagesettings
% printversion: left=4cm
  \geometry{left=3cm,textwidth=15cm,top=3cm,textheight=23.5cm}
  % A4: 21cm x 29.7cm
  % 15cm = 425.2 pt
  % 23.5cm = 666.14 pt
\usepackage[automark]{scrpage2} % KOMA layout paket, automark is important!
\pagestyle{scrheadings}
\ohead[\pagemark{}]{\pagemark{}}
%\ohead[]{\pagemark{}}
\chead[]{}
%\ihead[]{\textsc{\headmark}}
\ihead[]{\textbf{\headmark}}
%\cfoot[Torbens Diplomarbeit, Stand: \today]{Torbens Diplomarbeit, Stand: \today}
%\cfoot[--- \pagemark{} ---]{--- \pagemark{} ---}
\ofoot[]{}
\ifoot[]{}
\setheadtopline{}
\setheadsepline{0.4pt}
\setfootsepline{}
\setfootbotline{}

Font-Settings

[1] [2]

%% Palatino
%% \usepackage{palatino} is replaced by this (see l2tabu)
%\usepackage{mathpazo}            % MathFont Palatino
%\usepackage[scaled=.95]{helvet}
%\usepackage{courier}
%% dirty solution to make headings use the text-font
%\renewcommand{\sffamily}{\normalfont}

%% Times
% \usepackage{times} is replaces by
%\usepackage{mathptmx}
%\usepackage[scaled=.90]{helvet}
%\usepackage{courier}

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

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

Math

American Mathematical Society Guide

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

Tables

\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
%\usepackage{rotating}
%\begin{sidewaystable}
%  \centering
%  \begin{longtable}{|lll|}
%    table body
%  \end{longtable}
%\end{sidewaystable} 

% 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
%\newcolumntype{d}[1]{D{.}{.}{#1}}
% \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

Graphics

% 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

PDF

\ifpdfoutput{ %ifpdfoutput comes with Koma
   \usepackage[pdftex]{graphicx}
%  \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}  
  \usepackage[
    pdftex, % hypertex (default), pdftex
    final, % final, draft, debug -> more text in log file
    pdfauthor={\Verfasser},
    pdftitle={\Titel},
    pdfsubject={Diplomarbeit},
%    pdfstartview={Fit},
    a4paper=true,
    bookmarks=true,
    bookmarksopen=true,
    bookmarksopenlevel=1,
    bookmarksnumbered=true,
%    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
]{hyperref}

%  \pdfinfo {
%  /CreationDate (D:20060901010000) % this is the format used by pdf for date/time:YYYYMMDDhhmmss
%  /ModDate      (D:20060901020000)
%  }
%\pdfcompresslevel=9
% \texorpdfstring helps generations formulas, that can be used as pdf _bookmark_ titles:
% \section{Die \texorpdfstring{$e^x$~}{Exponential-}Funktion}
}{ % if dvi/ps output
  \usepackage[dvips]{graphicx}
  \usepackage[dvips]{hyperref}
  %\usepackage{epsfig}
  %\newcommand{\inputfig}[1]{\input{#1.pstex_t}}
  %\DeclareGraphicsExtensions{.pstex,.eps}
}

This warning

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

can be removed by placing

\pdfminorversion=5

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

Misc

%\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 

\usepackage{placeins} 
% 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{www.google.de}
\usepackage{upgreek}             % Upright greek letters: \uppi, \upalpha...
\usepackage{xspace}              % \xspace can be used in newcommands without parameters to ensure whitespace after it

Line-Numbering

%\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 !!!!!!!!
%\let\sectionorg\section
%\renewcommand\section[2][]{%
%  \def\tempOPT{#1}%
%  \ifx\tempOPT\empty\sectionorg{#2}
%  \else\sectionorg[#1]{#2}\fi\linenumbers*}
%\let\subsectionorg\subsection
%\renewcommand\subsection[2][]{%
%  \def\tempOPT{#1}%
%  \ifx\tempOPT\empty\subsectionorg{#2}
%  \else\subsectionorg[#1]{#2}\fi\linenumbers*}

Nomenclature

\usepackage[
german
%,intoc % put in table of contents
]{nomencl}
\let\abbrev\nomenclature
\renewcommand{\nomname}{Abkürzungsverzeichnis}
\setlength{\nomlabelwidth}{.15\hsize} % distance label-text
\setlength{\nomitemsep}{-\parsep} % no spacing between lines
%\renewcommand{\nomlabel}[1]{#1 \dotfill}
%\setlength{\nomitemsep}{-\parsep}
\makenomenclature

Index List

\usepackage{makeidx}            % support for creation of index list
\makeindex
% 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:
% makeindex FILENAME_OF_THE_LATEX_FILE

BibTeX

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

%\renewcommand{\cite}{\citep}

Definitions

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

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

% penalty for words split on two lines
\hyphenpenalty=500
%\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
%\numberwithin{figure}{section}
%\numberwithin{table}{section}

% 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
%\renewcommand*{\dictumwidth}{.3\textwidth}

Hyphenation (Worttrennung)

\hyphenation{
Scheiß-haus
Ins-ti-tut
Sig-nal
}

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
\newenvironment{abstractEN}{%
  \renewcommand*{\abstractname}{Abstract} \abstract}{%
  \endabstract
}

\newcounter{todos} \setcounter{todos}{0}
\newcommand{\todo}[1]{%
\emph{\textcolor{red}{TODO: #1}}%
\addtocounter{todos}{1}%
}
\newcommand{\wort}[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!!!
(\emph{engl.:~#1})%
}
%\footnote???
\newcommand{\enTOde}[1]{% do not insert spaces!!!
(\emph{engl.~für~#1})%
}

\newcommand{\usd}[0]{\ensuremath{U_\text{SD}}\xspace}
\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{\temp}[1]{\unit{#1}{\kelvin}}
\newcommand{\sek} [1]{\unit{#1}{\second}}
\newcommand{\grad}[1]{\unit{#1}{\degree}}

\newcommand{\symkreis}  {\ensuremath{\medcirc}}  % needs package pxfonts or txfonts
\newcommand{\symdreieck}{\ensuremath{\triangle}}
\newcommand{\symquadrat}{\ensuremath{\square}}
\newcommand{\entspricht}{\ensuremath{\mathrel{\hat{=}}}} 
% \widehat = doof
% \mathrel = corrects spacings
\newcommand{\nmVerdi}{\nm{532}~(\entspricht\eV{2.33})}
\newcommand{\nmHeNe}{\nm{633}~(\entspricht\eV{1.96})}
\newcommand{\tInt}{\ensuremath{t_\text{int}}}

% centered figure
\newcommand{\cBild}[5][tb]{%
\begin{figure}[#1]%
\centering%
\includegraphics[width=#3]{fig/#2}%
%\setcapwidth[c]{0.9\textwidth}%
\caption[#4]{#5}% \caption[shortcaption]{caption}
\label{fig:#2}%
\end{figure}%
}

% Caption besides the figure
\newcommand{\scBild}[5][tb]{% sidecap
\begin{SCfigure}[][#1]%
\includegraphics[width=#3]{fig/#2}%
\caption[#4]{#5}% \caption[shortcaption]{caption}
\label{fig:#2}%
\end{SCfigure}%
}

% 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

%example:
%\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}


\newcommand{\TabBild}[5][tb]{
\begin{figure}[#1]
\centering
\renewcommand{\arraystretch}{0} % removes rowspacing
\begin{tabular}{c@{}c}%  @{} removes the columnspacing
#5%
\end{tabular}
\setcapwidth[c]{.9\textwidth}% usefull?
\caption[#3]{#4}% \caption[shortcaption]{caption}
\label{fig:#2}
\end{figure}
}
% param5  :
%\includegraphics{fig/NN-pol-N5p}%
%\includegraphics{fig/NN-pol-N6p}\\%
%\includegraphics{fig/NN-pol-N5s}%
%\includegraphics{fig/NN-pol-N6s}\\%

\newcommand{\pBild}[3]{
\begin{figure}[p]
\centering
\includegraphics{fig/#1}%  the '%' is important!!! , removed width [width=#3]
\setcapwidth[c]{0.9\textwidth}% usefull?
\caption[#2]{#3}% \caption[shortcaption]{caption}
\label{fig:#1}
\end{figure}
}

\newcommand{\cTabelle}[6][htbp]{
\begin{table}[#1]
  \centering
  %\vspace{3mm}
  \begin{tabular}{#5}
    #6
  \end{tabular}
  \setcapwidth[c]{0.9\textwidth}% usefull?
  \caption[#3]{#4}% caption above table???
  \label{tab:#2}
\end{table}
}

\newcommand{\scTabelle}[6][htbp]{
\begin{SCtable}[][#1]
  \centering
  \caption[#3]{#4}
  \label{tab:#2}
  %\vspace{3mm}
  \begin{tabular}{#5}
    #6
  \end{tabular}
\end{SCtable}
}
% usage:
% \cTabelle{htbp}{shortcaption}{caption}{label}{lr}
% {
% nicht & viel\\
% }

% print the number of the last equation
% \lasteqn[n] -> (n+1)th last; (n = optional)
\newcommand{\lasteqn}[1][0]{
  (\arabic{section}.\addtocounter{equation}{-#1}\arabic{equation}\addtocounter{equation}{#1})
}
% print the number of the next equation
% \nexteqn[n] -> last + n (n = optional)
\newcommand{\nexteqn}[1][1]{
  (\arabic{section}.\addtocounter{equation}{#1}\arabic{equation}\addtocounter{equation}{-#1})
}