\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{nouvellea5}[2004/11/20 0.1]

\newif\ifpasrecueil
\pasrecueiltrue

\newif\iffrench
\frenchfalse

\newif\ifchaptitle
\chaptitletrue

\newif\if@romantoc
\@romantocfalse

\newif\iftoc
\tocfalse

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions

\LoadClass[a5paper,twoside,11pt,draft]{book}
\RequirePackage{fancyhdr}
\RequirePackage[includehead,includefoot,
  headheight=15pt,headsep=10pt,
  top=1cm,bottom=1.3cm,
  textwidth=10cm,
  left=2.0cm, twosideshift=.5cm
]{geometry}
\advance\tolerance by \tolerance
\emergencystretch=1em
\hfuzz=1pt

\RequirePackage[latin9]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage{xspace}
%\RequirePackage{longtable}
\RequirePackage{graphicx}

\def\french{
\RequirePackage[frenchb]{babel}
\initiate@active@char{«}
\def«{\og\ignorespaces}%
\def»{{\fg}}%
\renewcommand\contentsname{Sommaire}
}


\def\el{$\ldots$}

\def\final{\setlength\overfullrule{0pt}}

\pagestyle{plain}

\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
\hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \if@romantoc%
    \setlength\@tempdima{5em}%
    \else
    \setlength\@tempdima{1.5em}%
    \fi%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}

\newcommand\notchapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{empty}%
                    \vspace*{4cm}

                    }

\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{empty}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}

\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \ifpasrecueil
                           \ifchaptitle
                             \addcontentsline{toc}{chapter}%
                                     {\protect\numberline{\thechapter}#1}%
                           \else
                             \addcontentsline{toc}{chapter}
                               {\@chapapp\space \thechapter}%
                           \fi
                         \else
                           \addcontentsline{toc}{chapter}{#1}%
                         \fi
                       \else
                         \ifchaptitle
                           \addcontentsline{toc}{chapter}{#1}%
                         \else
                           \addcontentsline{toc}{chapter}
                               {\MakeUppercase{\@chapapp}\space \thechapter}%
                         \fi
                       \fi
                    \else
                       \ifchaptitle
                         \addcontentsline{toc}{chapter}{#1}%
                       \else
                         \addcontentsline{toc}{chapter}
                             {\MakeUppercase{\@chapapp}\space \thechapter}%
                       \fi
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}


\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \begin{center}
      \ifpasrecueil
        \Large\bfseries \thechapter . #1\par\nobreak
      \else
        \Large \bfseries  \MakeUppercase{#1}\par\nobreak
      \fi
      \end{center}
      \par\nobreak
      \vskip 20\p@
    \fi
  }}

\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \centerline{\Large \bfseries  \MakeUppercase{#1}}\par\nobreak
    \vskip 40\p@
  }}

\newcommand\pic[1]{
  \noindent\includegraphics[width=0.99\textwidth,keepaspectratio]{#1}
  \bigskip

}

\newcommand\picv[1]{
  \noindent\includegraphics[angle=90,width=0.99\textwidth,totalheight=.99\textheight,keepaspectratio]{#1}
  \bigskip

}
