% +------------------------------------------------------------------------+
% | cgal_manual.sty
% | Common style files and definitions for CGAL User and Reference Manuals
% +------------------------------------------------------------------------+

% Style files used throughout the manuals

% used with LaTeX and also understood by the LaTeX to HTML Converter
\usepackage{cc_manual}
\usepackage{cc_manual_index}
\usepackage{latex_to_html}
\usepackage{path}
\usepackage{alltt}
\usepackage{cprog} % outdated
\usepackage{ifthen}

% used with LaTeX but _not_ understood by the converter
\lcTex{
  \usepackage{makeidx}
  \usepackage{amssymb}
  \usepackage{graphicx}
  \usepackage{epsfig}
  \usepackage{ipe}
  \usepackage{pslatex}
  \usepackage{psfrag}
  \usepackage{rotating}
  \usepackage{longtable}
}

% +------------------------------------------------------------------------+
% Configuration section begin ...
% +------------------------------------------------------------------------+

% CGAL release and date, adapt this to the current release
\newcommand{\cgalrelease}{3.1-I}
% \newcommand{\cgalreleasedate}{November 2003} % use this for public releases
\newcommand{\cgalreleasedate}{\today} % use this for internal releases

% set this to true for generating the pdf version of the manual (using
% ps2pdf from ghostscript).  If this is true when creating postscript,
% the table of contents (and several other things) will be blue.
\newboolean{usehyperref}
\setboolean{usehyperref}{false}

% minitoc and hyperref do not seem to work together so they should not both
% be true
\newboolean{useminitoc}
\setboolean{useminitoc}{true}

% We rather like a less dense table of contents (maybe HTML only)
\setcounter{secnumdepth}{2} % number subsections inclusively
\setcounter{tocdepth}{1}    % toc with sections inclusively

% Make the table of contents use two columns
\lcHtml{\lcTwoColumnToc}

% +------------------------------------------------------------------------+
% ... end configuration section.
% +------------------------------------------------------------------------+

% include hypperref for PDF documents if selected above
\ifthenelse{\boolean{usehyperref}}{
  \lcTex{
  \usepackage[ps2pdf=true,
              colorlinks=true,
              linkcolor=blue,
              bookmarksnumbered=true,
              pdftitle={CGAL Library Manuals},
              pdfkeywords={computational geometry, generic programming,
                           algorithms, software library, C++},
              pdfborder={0 0 0}]{hyperref}%
  }
}{}

% include minitoc if selected above
\ifthenelse{\boolean{useminitoc}}{\lcTex{\usepackage{minitoc}}}
{\newcommand{\minitoc}{}}

% page dimensions
% ---------------
\lcTex{
  \textwidth 15.6cm 
  \textheight 23 cm
  \ifthenelse{\boolean{usehyperref}}{}{\topmargin -14mm}
  \evensidemargin 3mm 
  \oddsidemargin 3mm
  \marginparsep10mm
  \marginparwidth15mm
}

% new reference manual layout with one page for each reference page
% -----------------------------------------------------------------
\gdef\ccNewRefManualStyle{\ccTrue}

% Optionally, package authors and a package release can be shown
% right below the chapter title. Comment out the following lines
% to get back to the default behavior.
% -----------------------------------------------------------------
\def\ccTagChapterAuthor{\ccTrue}
% \def\ccTagChapterRelease{\ccTrue}

% default column layout
% ---------------------
\newcommand{\cgalColumnLayout}{%
    \ccSetThreeColumns{CGAL_Oriented_side}{}{\hspace*{8.5cm}}%
    \ccPropagateThreeToTwoColumns}

% reinitialize some settings before each chapter
% ----------------------------------------------
\newcommand{\cgalReinit}{\cgalColumnLayout}

% The tab marker are aligned with the top of the main text. To align
% them with the page header, the following length definition can be used.
% -----------------------------------------------------------------------
%\setlength{\ccRefTabLift}{12.5mm}

% you may also want to use these commands, but be careful to check that
% other redefinitions of ccRefPageBegin and End don't cause strange problems
% (e.g. if ccAdvanced is used to bracket a ref page)
% -------------------------------------------------------------------------
%\def\ccRefPageBegin{\ccParDims\cgalColumnLayout}
%\def\ccRefPageEnd{\ccParDims\cgalColumnLayout}


% All identifiers reside in CGAL scope by default
% -----------------------------------------------
\ccDefGlobalScope{CGAL::}

% LaTeX settings
% --------------
% create always the index
\makeindex

% relax formatting strictness to avoid many overfull \hbox's etc.
\sloppy

% make LaTeX process the whole manual without stopping for errors
% \batchmode


% Implement the two columns layout for the HTML converted part
% ------------------------------------------------------------

% Define a macro of suitable name that can be tested with the
% \isundefined test of the \ifthenelse macro.
\newcommand{\cgalDeclarePackage}[1]{}

% Group all \entryleft, \entryright, \entryleftright, \package... commands 
% as argument to this macro.
\newcommand{\cgalchapters}[1]{%
  % make a first run over the argument 
  % and declare \ifthen variables for packages
  \newcommand{\entryleft}[1]{}%
  \newcommand{\entryright}[1]{}%
  \newcommand{\entryleftright}[2]{}%
  \newcommand{\packageleft}[1]{\cgalDeclarePackage{##1}}%
  \newcommand{\packageright}[1]{\cgalDeclarePackage{##1}}%
  \newcommand{\packageleftright}[2]{%
    \cgalDeclarePackage{##1}\cgalDeclarePackage{##2}}%
  #1
  \lcTex{%
    \renewcommand{\entryleft}[1]{##1}%
    \renewcommand{\entryright}[1]{}%
    \renewcommand{\entryleftright}[2]{##1}%
    \renewcommand{\packageleft}[1]{\cgalReinit\include{##1/main}}%
    \renewcommand{\packageright}[1]{}%
    \renewcommand{\packageleftright}[2]{\cgalReinit\include{##1/main}}%
    #1
    \renewcommand{\entryleft}[1]{}%
    \renewcommand{\entryright}[1]{##1}%
    \renewcommand{\entryleftright}[2]{##2}%
    \renewcommand{\packageleft}[1]{}%
    \renewcommand{\packageright}[1]{\cgalReinit\include{##1/main}}%
    \renewcommand{\packageleftright}[2]{\cgalReinit\include{##2/main}}%
    #1
  }%
  \lcHtml{\lciIfTwoColumnToc{
      \newcommand{\entryleft}[1]{\lcTocLeft ##1}%
      \newcommand{\entryright}[1]{\lcTocRight ##1}%
      \newcommand{\entryleftright}[2]{%
        \lcTocSync\lcTocLeft ##1\lcTocRight ##2\lcTocSync}%
      \newcommand{\packageleft}[1]{\lcTocLeft \cgalReinit\include{##1/main}}%
      % improve that later
      \newcommand{\packageright}[1]{\lcTocRight \cgalReinit\include{##1/main}}%
      \newcommand{\packageleftright}[2]{%
        \lcTocSync\lcTocLeft\cgalReinit\include{##1/main}%
        \lcTocRight\cgalReinit\include{##2/main}\lcTocSync}%
      #1
    }{%
      \newcommand{\entryleft}[1]{##1}%
      \newcommand{\entryright}[1]{}%
      \newcommand{\entryleftright}[2]{##1}%
      \newcommand{\packageleft}[1]{\cgalReinit\include{##1/main}}%
      \newcommand{\packageright}[1]{}%
      \newcommand{\packageleftright}[2]{\cgalReinit\include{##1/main}}%
      #1
      \renewcommand{\entryleft}[1]{}%
      \renewcommand{\entryright}[1]{##1}%
      \renewcommand{\entryleftright}[2]{##2}%
      \renewcommand{\packageleft}[1]{}%
      \renewcommand{\packageright}[1]{\cgalReinit\include{##1/main}}%
      \renewcommand{\packageleftright}[2]{\cgalReinit\include{##2/main}}%
      #1
    }%
  }%
}

% +------------------------------------------------------------------------+
% | end of cgal_manual.sty
% +------------------------------------------------------------------------+
