\documentclass[DIV16,BCOR1cm,10pt,a4paper,fleqn,twoside]{scrreprt}         % for pdf output
%\documentclass[DIV16,BCOR1cm,10pt,a4paper,fleqn]{scrreprt}         % for pdf output
%\documentclass[DIV16,BCOR1cm,11pt,a4paper,fleqn]{report}         % for pdf output

% To allow automatic selection of the right graphics type ...
% preset \pdfoutput for older latex installation, it is allways definted for
% news ones
\ifx\pdfoutput\undefined
\gdef\pdfoutput{0}
\fi

\newif\ifpdf
\ifnum\pdfoutput=0
% latex is called for dvi output
   \pdffalse
   \usepackage{graphicx}
\else
% pdflatex is called for pdf output
   \pdftrue
   \usepackage[pdftex]{graphicx}
   \usepackage[pdftex]{hyperref}
\fi

\usepackage{textcomp}

%\newcommand{\CDO}{{\bfseries\sffamily CDO\ }}
\newcommand{\CDO}{{\bfseries\sffamily CDO}}
\newcommand{\cdologo}{\includegraphics{logo/cdo_logo}}

% To define headers and footers
\usepackage{fancyhdr}
\pagestyle{fancy}

% Headers and footers personalization using the `fancyhdr' package
\fancyhf{} % Clear all fields

\renewcommand{\headrulewidth}{0.2mm}
\renewcommand{\footrulewidth}{0.2mm}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}

%\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
%\renewcommand{\sectionmark}[1]{\markleft{#1}}

\fancyhead[LO,RE]{\slshape \leftmark}
\fancyhead[LE,RO]{\slshape \rightmark}
\fancyfoot[LE,RO]{\Large\thepage}
%\fancyfoot[LO,RE]{\raisebox{-2.8mm}{\scalebox{0.17}{\cdologo}}}
\fancypagestyle{plain}{%
  \fancyhead{} % get rid of headers
  \renewcommand{\headrulewidth}{0pt}
}

%\setlength{\footnotesep}{0cm}
%\setlength{\footskip}{-2cm}
%\renewcommand{\footnoterule}{\rule{0cm}{0cm}}

\usepackage{exscale}
\usepackage{array,colortbl}    % color table

\usepackage{listings}
\usepackage{longtable}
\usepackage{color}
\definecolor{pcolor1}{rgb}{0.992, 0.980, 0.875}  % rgb: 253/250/223
\definecolor{pcolor2}{rgb}{1.000, 0.925, 0.700}  % rgb: 255/236/278
\definecolor{pcolor3}{rgb}{0.968, 0.756, 0.623}  % rgb: 247/193/159

%\usepackage{ae}               % fuer die "almost european" computer modern fonts
%\usepackage{url}              % Standard-Paket fuer WWW-Adressen

%\typearea{10}                 % Einen sinnvollen Satzspiegel aktivieren


%Usage:
%pdflatex cdo.tex
%pdflatex cdo.tex
%cat > cdo.ist << 'EOF'
%delim_0        "{\\idxdotfill} "
%headings_flag  1
%heading_prefix "{\\centerline {\\Large \\bf "
%heading_suffix "}}"
%EOF
%makeindex -s cdo.ist cdo.idx
%pdflatex cdo
%thumbpdf cdo
%pdflatex cdo


\usepackage{thumbpdf}

%\usepackage{html}

\usepackage{makeidx}

%\ifpdf
%\usepackage[a4paper, colorlinks=true, pdfstartview=FitV, bookmarks=true, linkcolor=blue,
%            citecolor=blue, urlcolor=blue, latex2html=true]{hyperref}
%\fi

\usepackage{hyperref}
\hypersetup{pdftoolbar=true,
            pdfmenubar=true,
            pdfwindowui=true,   
%            pdffitwindow=true,
            pdfauthor={Uwe Schulzweida},
            pdftitle={CDO Climate Data Operators},
            pdfcreator={pdflatex + hyperref},
            pdfstartview=FitV,
%            pdfpagemode=FullScreen,
            a4paper,
            bookmarks=true,
            linkcolor=blue,
            citecolor=blue,
            urlcolor=blue,
            colorlinks=true}

\setlength{\parindent}{0em}
\setlength{\parskip}{1.5ex plus0.5ex minus0.5ex}
\extrarowheight1pt

\makeindex
%\newcommand{\ii}[1]{\textit{#1}}  \newcommand{\nn}[1]{#1n}
%\renewcommand{\dotfill}{\leaders\hbox to 5p1{\hss.\hss}\hfill}
%\newcommand{\idxdotfill}{5p1{\hss.\hss}\hfill}
\newcommand{\idxdotfill}{\ \dotfill \ }
%\def\idxdotfill{\leaders\hbox to.6em{\hss .\hss}\hskip 0pt plus 1fill}
%\MakeShortVerb{\@}

\renewcommand{\indexname}{Operator index}

%\newcommand{\defalabel}[1]{\bf #1\ \ \hfill}
\newenvironment{defalist}[1]
{\begin{list}{}
{\settowidth{\labelwidth}{#1\ \ }
\setlength{\itemsep}{0mm}
\setlength{\itemindent}{0mm}
%\setlength{\listparindent}{25mm}
\setlength{\leftmargin}{\labelwidth}
%\setlength{\leftmargin}{25mm}
\setlength{\labelsep}{2mm}
\addtolength{\leftmargin}{\labelsep}
}}
{\end{list}}
%\renewcommand{\makelabel}{\defalabel}

\newcommand{\miniwidth}{\textwidth}

\setcounter{secnumdepth}{3}

\begin{document}


\begin{titlepage}
\vspace*{50mm}
{\Huge{\CDO}} \ {\Huge\bf User's Guide}

\setlength{\unitlength}{1cm}
\begin{picture}(16,0.4)
\linethickness{1.5mm}
%\put(0,0.1){\line(1,0){15.85}}
\put(0,0.1){\line(1,0){16.3}}
\end{picture}

\begin{flushright}
\large\bf{Climate Data Operators \\ Version 1.5.4 \\ January 2012}
\end{flushright}

\vfill

\Large{\bf Uwe Schulzweida, Luis Kornblueh -- \sl MPI for Meteorology}

\Large{\bf Ralf Quast -- \sl Brockmann Consult}

\begin{picture}(16,1)
\linethickness{1.0mm}
%\put(0,0.7){\line(1,0){15.85}}
\put(0,0.7){\line(1,0){16.3}}
\end{picture}
\end{titlepage}

\tableofcontents

\input{cdo_int}

\input{cdo_con}

\input{cdo_adv}

\input{cdo_ref}

\input{bib}

\input{appendix}

\clearpage
\ifpdf
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}
\printindex
\else
\input{catalog}
\input{alphabetic_list}
\fi
\end{document}
