%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% common HEADER for LaTeX and pdfLaTeX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt,twoside,a4paper]{article}
\usepackage{ifthen}                 %%% package for conditionals in TeX
\usepackage{fancyhdr}               %%% for more fancy page headers
\usepackage{longtable}              %%% for tables longer than one page
\usepackage{afterpage}              %%% figures not before first reference
\usepackage[normal,footnotesize,bf]{caption2} %%% more fancy captions for
%                                                 figure- and table-captions
\usepackage[square]{natbib}         %%% natbib-style for bibliography
\usepackage[nottoc]{tocnatbibind}   %%% make entry of LoF, LoT, and Ref in ToC
%                                       but still use natbib-style
\settocbibname{References}          %%% Title of bibliography
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SWITCH FOR PDFLATEX or LATEX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
\ifx\pdfoutput\undefined %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LATEX %%%
%%%
\usepackage[dvips]{graphicx}       %%% graphics for dvips
\DeclareGraphicsExtensions{.eps}   %%% standard extension for included graphics
\usepackage[ps2pdf]{thumbpdf}      %%% thumbnails for ps2pdf
\usepackage[ps2pdf,                %%% hyper-references for ps2pdf
bookmarks=true,%                   %%% generate bookmarks ...
bookmarksnumbered=true,%           %%% ... with numbers
hypertexnames=false,%              %%% needed for correct links to figures !!!
breaklinks=true,%                  %%% breaks lines, but links are very small
linkbordercolor={0 0 1},%          %%% blue frames around links
pdfborder={0 0 112.0}]{hyperref}%  %%% border-width of frames 
%                                      will be multiplied with 0.009 by ps2pdf
%
\hypersetup{
pdfauthor   = {Patrick J\"{o}ckel <joeckel@mpch-mainz.mpg.de>},
pdftitle    = {Cosmogenic 14CO as tracer for atmospheric
chemistry and transport},
pdfsubject  = {Dissertation},
pdfkeywords = {radiocarbon, 14CO, cosmogenic source,
atmospheric tracer, 3-dimensional atmospheric transport
and chemistry model, hydroxyl radical, OH, advection,
cross tropopause transport, stratosphere-troposphere exchange,
response time, solar cycle, solar activity, solar proton events},
pdfcreator  = {LaTeX with hyperref package},
pdfproducer = {dvips + ps2pdf}
}
%%%
\else %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PDFLATEX %%%
%%%
\usepackage[pdftex]{graphicx}      %%% graphics for pdfLaTeX
\DeclareGraphicsExtensions{.pdf}   %%% standard extension for included graphics
\usepackage[pdftex]{thumbpdf}      %%% thumbnails for pdflatex
\usepackage[pdftex,                %%% hyper-references for pdflatex
bookmarks=true,%                   %%% generate bookmarks ...
bookmarksnumbered=true,%           %%% ... with numbers
hypertexnames=false,%              %%% needed for correct links to figures !!!
breaklinks=true,%                  %%% break links if exceeding a single line
linkbordercolor={0 0 1}]{hyperref} %%% blue frames around links
%                                  %%% pdfborder={0 0 1} is the default
\hypersetup{
pdfauthor   = {Patrick J\"{o}ckel <joeckel@mpch-mainz.mpg.de>},
pdftitle    = {Cosmogenic 14CO as tracer for atmospheric 
chemistry and transport},
pdfsubject  = {Dissertation},
pdfkeywords = {radiocarbon, 14CO, cosmogenic source,
atmospheric tracer, 3-dimensional atmospheric transport
and chemistry model, hydroxyl radical, OH, advection,
cross tropopause transport, stratosphere-troposphere exchange,
response time, solar cycle, solar activity, solar proton events},
}
%                                  %%% pdfcreator, pdfproducer, 
%                                      and CreatioDate are automatically set
%                                      by pdflatex !!!
\pdfadjustspacing=1                %%% force LaTeX-like character spacing
%
\fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF CONDITION %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Some settings for the page-Layout (not neccessarily needed !!!)
\addtolength{\oddsidemargin}{+6mm}    %%% increase left margin on odd sides ...
\addtolength{\evensidemargin}{-20mm}  %%% ... decreaase on even sides for ...
%                                     %%% ... later binding the document
\addtolength{\topmargin}{-3mm}        %%% reduce top margin
\setlength{\textheight}{22.2cm}       %%% set height and ...
\setlength{\textwidth}{15cm}          %%% ... width for text
\setlength{\captionmargin}{5mm}       %%% additional margins for captions
%
\renewcommand{\textfraction}{0}       %%% for these magic numbers ...
\renewcommand{\topfraction}{1}        %%% ...
\renewcommand{\bottomfraction}{1}     %%% ... have a look into your ...
\renewcommand{\floatpagefraction}{0}  %%% ... LaTeX-Book
%
\renewcommand{\baselinestretch}{1.10} %%% increase line spacing
%
\raggedbottom                         %%% do NOT increase spaces between
%                                         paragraphs in order to fill always
%                                         the whole page
%
\renewcommand{\arraystretch}{1.15}    %%% space for text-arrays
\parindent0mm \parskip1ex plus0.3ex minus0.25ex 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% enumeration of figures, tables and equations 
% like 3.5 for 5th figure/equation/table in section 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\@addtoreset{equation}{section}
\@addtoreset{figure}{section}
\@addtoreset{table}{section}
\def\thefigure{\thesection.\@arabic\c@figure}
\def\thetable{\thesection.\@arabic\c@table}
\def\theequation{\thesection.\@arabic\c@equation}
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% space between text and page-numbers in List of Figures, Tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{1em}{3em}}
\renewcommand*\l@table{\@dottedtocline{1}{1em}{3em}}
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set parameters for Table of Contents
% here (article-style):
%       entries for section(1), subsection(2), subsubsection(3),
%       DOWNTO paragraph(4) into Table of Contents and Bookmarks,
%       similar for enumeration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define and set flag for including color/grey-level figures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newboolean{color}
\setboolean{color}{true}        %%% use color figures
%\setboolean{color}{false}      %%% use gray-level figures
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set pagestyle of fancy-header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL,OR]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
%
\fancypagestyle{plain}{
 \fancyhead{}
 \fancyhead[EL,OR]{\bfseries\thepage}
 \renewcommand{\headrulewidth}{0pt}
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BEGIN DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%
%Set an additional Bookmark to the first Page
\pdfbookmark[1]{Preamble}{prea}
Include your title-page here.
\cleardoublepage                %%% start again on odd page
%
% Table of Contents:
\pagenumbering{roman}           %%% Roman page numbers for ToC
\pdfbookmark[1]{Contents}{toc}  %%% additional bookmark for ToC
\thispagestyle{plain}           %%% uses the above defined fancy page-header
\tableofcontents
\markboth{Table of Contents}{Table of Contents} %%% for the page header
\cleardoublepage                %%% start again on odd page
\pagenumbering{arabic}          %%% from now on Arabic page numbers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
Put your document text here !

Include graphics with

%% \begin{figure}
%% \ifthenelse{\boolean{color}}
%%   {\centerline{\includegraphics[width=14cm]{img01/img}}}
%%   {\centerline{\includegraphics[width=14cm]{img01g/img}}}
%%   \caption[Short caption for List of Figures]
%%           {Long caption for text}
%%   \label{img01}                 
%% \end{figure}

% Running LaTeX:
% If color=true (see above) this will include the file img.eps from
% the subdirectory img01, if color=false from the subdirectory img01g.
% Running pdfLaTeX:
% If color=true (see above) this will include the file img.pdf from
% the subdirectory img01, if color=false from the subdirectory img01g.
%

An in-text link to this figure can be created by ...
see Figure~\ref{img01}.

The same works with equations and tables.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% List of Figures:
\thispagestyle{plain}          %%% uses the above defined fancy page-header
\listoffigures
\clearpage
%
% List of Tables:
\thispagestyle{plain}          %%% uses the above defined fancy page-header
\listoftables
\cleardoublepage
%
% Bibliography:
\thispagestyle{plain}          %%% uses the above defined fancy page-header
\bibliographystyle{jgr}        %%% uses jgr.sty for in-text citations
\bibliography{my_references}   %%% uses my_references.bib for bibliography
\cleardoublepage
%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
