\documentclass[a4paper]{report}

\usepackage[american]{mybabel}
\usepackage[latin1]{inputenc}
\usepackage{a4wide}
\usepackage{myacronym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{myhyperref}
\usepackage{textcomp}
\usepackage{tabularx}
\usepackage{url}
\usepackage{vaucanson-g}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{texi}
\usepackage{misc}

%% Put the TOC, the bibliography and index in the TOC.
\usepackage{tocbibind}

%% ---------------------- %%
%% Mathematical symbols.  %%
%% ---------------------- %%
\renewcommand{\max}{\textrm{max}}
\renewcommand{\min}{\textrm{min}}
\newcommand{\Z}{\texorpdfstring{\ensuremath{\mathbb{Z}}}{Z}}

\newcommand{\newcal}[1]{%
  \expandafter \newcommand \csname #1c\endcsname%
  {\texorpdfstring{\ensuremath{\mathcal{#1}}}{#1}}%
}
\newcal{A}
\newcal{B}
\newcal{C}
\newcal{T}

\newtheorem{theorem}             {Theorem}[chapter]
\newtheorem{definition} [theorem]{Definition}
\newtheorem{remark}     [theorem]{remark}


%% ------------------------ %%
%% Index and Bibliography.  %%
%% ------------------------ %%

% The same argument is output and put in the index.
\usepackage{makeidx}
\makeindex
\newcommand{\Index}[1]{\index{#1}#1}

% Bibliography.
\usepackage{natbib}

\usepackage{mylistings}
\lstset{%
  numbers=left,
  numberstyle=\tiny,
  stepnumber=5,
  numbersep=5pt,
  firstnumber=1,
  basicstyle=\small,
  frame=single,
  language=C++,
  float}

%% Whether the developer's documentation is included.
\newboolean{developer}
\ifx\withDeveloperSection\undefined
  \setboolean{developer}{false}
\else
  \setboolean{developer}{true}
\fi

% Document a figure.
\newenvironment{legend}{%
  \begin{quote}%
    }{%
  \end{quote}%
}

%% Display an interactive session.
\usepackage{alltt}
\newenvironment{shell}
{\begin{alltt}}
{\end{alltt}}

\input version

%% -------------------- %%
%% Vaucanson commands.  %%
%% -------------------- %%

%% A TAF-kit function name (i.e., the first argument for TAF-Kit
%% programs).
\newcommand{\taffn}[1]{\code{#1}}
\newcommand{\tafkit}{\textsc{TAF-Kit}\xspace}
\newcommand{\Vauc}{\textsc{Vaucanson}\xspace}
\newcommand{\TFK}{\tafkit\xspace}%
\newcommand{\TFKv}{\tafkit{} \VcsnVersion\xspace}%

% \begin{fnsection}{NAME}
% -----------------------
% A group of taf-kit functions.
% Putting the ending hline in the end section is tempting, but fails.
\newenvironment{fnsection}[1]{%
  % \item{NAME}{ARGS}{DOC}
  % ----------------------
  % Define a taf-kit function.
  % We use \item because it has Emacs indentation support.
  \renewcommand{\item}[3]{\texttt{##1} \var{##2} & ##3\\}

  \tabularx{\textwidth}{|l|X|}%
    \hline\multicolumn{2}{|c|}{#1} \\\hline%
  }{%
  \endtabularx%
}


%% --------------------------------- %%
%% Automatic generation of content.  %%
%% --------------------------------- %%

% These two commands are recognized by extex which will extract the
% code to run to produce the generated files.  LaTeX will later
% include them.
%
% If you know a simpler means to do that, be my guest...
%
% Note that this system "caches" the result, and uses a Makefile to
% avoid useless recompilation of snippets that did not change.

% This one is not traced, so we can use it to factor definitions
% making the same calls (e.g., includegenerateddot and execdisplay).
%
% Beware that files with an embedded dots in the base name are
% improperly handled: includegraphics tries to interpret it as an extensions.
\newcommand{\includegenerated}[1]{\includegraphics[scale=.6]{#1}}

% This one is scanned by extex.pl.
\newcommand{\includegenerateddot}[1]{\includegenerated{#1}}

% \execcaption{TAG}{COMMAND}
% --------------------------
% Run the COMMAND, which is a Unix pipe, and save the result in a file
% named TAG.tex.  Input it here.  Make explicit the input/output of
% the COMMAND.
%
% If there are redirections, *THEY MUST STICK TO THE FILE*!!!
% Do not pass `echo toto > foo', but `echo toto >foo'.
\newcommand{\execcaption}[2]{\input{#1}}

% \execdisplay{TAG}{PRE-COMMAND}{POST-COMMAND}
% --------------------------------------------
% Run a taf-kit pipe ending with a display, and include the resulting
% automaton.  It will run `PRE-COMMAND display POST-COMMAND >TAG.dot',
% and include the latter.

% Typical use is:
%
% \execdisplay{a1}{vcsn-b}{a1}
%
\newcommand{\execdisplay}[3]{\includegenerated{#1}}

\ifthenelse{\boolean{developer}}{
  \title{The \Vauc \TFKv \\ Developer's Manual}
}{
  \title{The \Vauc \TFKv \\ User's Manual}
}
\author{The \Vauc \textsc{Group}}
\date{\VcsnDate}

%% ---------- %%
%% Document.  %%
%% ---------- %%
\begin{document}

\maketitle

\setcounter{tocdepth}{2}
\tableofcontents

\input{introduction}
\input{installation}
\input{taf-kit}
\ifthenelse{\boolean{developer}}{
  \input{vaucanswig}
  \input{library}
  \input{developer}
}{}

\ifthenelse{\boolean{developer}}{\appendix}{}

\input{automata}

\ifthenelse{\boolean{developer}}{
  \input{theory}
  \input{xml}
  \input{specification}

  \printindex

  \bibliographystyle{apalike}
  \bibliography{vaucanson.bib}
}{}

\end{document}


%%% Local Variables:
%%% mode: latex
%%% ispell-local-dictionary: "american"
%%% TeX-master: t
%%% End:
