%***********************************************************************%
% 
%	$Id: custom2e.tex,v 1.4 1999/02/08 01:01:21 jacsib Exp $  
%     Time-stamp: <99/02/08 00:39:49 jacsib>
%
%***********************************************************************%
%
%               User Interface: functions added by JaSi 10/12/96
%                 LaTeX2e Interface
%
%
%   \Pagesize16x24  generates PS for papersize 16cm X 24cm
%                   text size is 110mm x 180mm
%
%   \Pagesize16x24eco  generates PS for papersize 16cm X 24cm
%                   text size is 120mm x 190mm
%
%
%   \figbox{#1}{#2}{#3}{#4}
%           This command creates a centered box, to paste a figure
%           arguments:
%           #1 : x size in mm
%           #2 : y size in mm
%           #3 : caption
%           #4 : label
%
%    \Putimage{#1}{#2}{#3}{#4}{#5}
%           This command creates a centered box, with an EPS figure in it
%           Image starts 2 mm east and north of the SW corner of the
%           frame.
%           arguments:
%           #1 : Expected Image x size in mm
%           #2 : Expected Image y size in mm
%           #3 : caption
%           #4 : label
%           #5 : EPS file
%
%    \putimage{#1}{#2}{#3}{#4}{#5}
%           This command puts an EPS figure in an invisible frame
%           arguments:
%           #1 : Expected Image x size in mm
%           #2 : Expected Image y size in mm
%           #3 : caption
%           #4 : label
%           #5 : EPS file
%
%   \bi     =  \begin{itemize}
%   \ei     =  \end{itemize}
%   \be     =  \begin{enumerate}
%   \ee     =  \end{enumerate}
%   \bd     =  \begin{description}
%   \ed     =  \end{description}
%   \bq     =  \begin{quote}
%   \eq     =  \end{quote}
%   \bQ     =  \begin{quotation}
%   \eQ     =  \end{quotation}
%   \bQ     =  \begin{quotation}
%   \eQ     =  \end{quotation}
%
%   \ifthen{#1}{#2}
%           is just for display
%
%           #1 if clause
%           #2 then clause
%
%   \ret
%           carriage return sign such as <return>
%
%   \thedocnr
% 	    returns file name by default
%
%   \setdocnr{#1}
%           defines document reference #, then you call it with `\thedocnr'
%
%   \setrevisionnr 
%	    defines revision #, then you call it with `\thedocnr'
%
%
%   \footline
%           generates standard footline
%           !!!! to be set after \pagestyle command
%           !!!! does not work with `plain' page style
%
%   \putcorpname{#1}
%           to get the organisation name,
%             if not called then name is Lutecium
%
%
%           Frames generation
%   \singleframe{#1}
%           Here is a single line frame around displayed material
%
%   \doubleframe{#1}
%           Here is a double line frame around displayed material
%
%   \thickframe{#1}
%           Here is a double line frame, with a thick outer one
%           around displayed material
%
%   \Shadow{#1}
%           generates shadows under a frame
%
%
%   \Block{#1}
%           generates a parallepided frame with a shadow at right & bottom
%
%
% 	Tests if command exists
% 	Arguments: #1 : command
%    \ifundefined{commmand} <exits> \else <no exists> \fi
%
%   \hypervref{<label>} unifies vref in LaTeX and LaTeX2HTML
%
%
%   AMS style add ons:
%
%
% !! Warning: file names in \input command must be written using the unix
%             format :  \input{/aaaa/bbbb/cccc}
%
%           END OF USER INTERFACE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   Initializations
%
%  Load ISO 9901 char set
%\input{/home/jacsib/latex/iso1chars}


\sloppy
\setcounter{secnumdepth} {4}
% \fhyph
% \nonfrenchspacing

%
%@ sign turned to character
%
\makeatletter


%
%set new page style: topheading is put higher on the page, foot is lower.
%
%\topmargin -3ex
%\headsep 13ex
%\footskip 10ex

%
% Compatibility with AMSLaTeX
%
%\ifx\undefined\Diamond%
%  \newcommand{\Diamond}{\lozenge}
%\fi

%
% Tests if command exists
% Arguments: #1 : command
% call: \ifundefined{commmand} <exits> \else <no exists> \fi
%
\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}



%
%This command creates a centered box, to paste a figure
%arguments: #1 : x size in mm
%           #2 : y size in mm
%           #3 : caption
%           #4 : label
\newcommand{\figbox}[4]{
  {\setlength{\unitlength}{1mm}
  \begin{figure}
  \centering
  \framebox(#1,#2){}
  \caption{#3}\label{#4}
  \end{figure}}
}


%
%This command creates a centered box, with an EPS figure in it
%arguments: #1 : Image x size in mm
%           #2 : Image y size in mm
%           #3 : caption
%           #4 : label
%           #5 : EPS file
\newcommand{\Putimage}[5]{
  {\setlength{\unitlength}{1mm}
  \begin{figure}
  \centering
  \newcount\n
  \n=#2
  \multiply \n by -1
  \newcount\x
  \newcount\y
  \x=#1
  \y=#2
  \advance \x by 4
  \advance \y by 4
  {\protect\framebox(\x,\y){\put(2,\n) {\epsfig {file=#5,width=#1mm}}}}
  \caption{#3}\label{#4}
  \end{figure}}
}


%
%This command creates a centered box, with an EPS figure in it
%           but with no frame around
%arguments: #1 : Image x size in mm
%           #2 : Image y size in mm
%           #3 : caption
%           #4 : label
%           #5 : EPS file
\newcommand{\putimage}[5]{
  {\setlength{\unitlength}{1mm}
  \begin{figure}
  \centering
  \newcount\n
  \n=#2
  \multiply \n by -1
  {\protect\makebox(#1,#2){\put(0,\n) {\epsfig {file=#5,width=#1mm}}}}
  \caption{#3}\label{#4}
  \end{figure}}
}


\ifundefined{htmlonly}%
  {}%
\else
  {\begin{htmlonly}
    \renewcommand{\putimage}[5]{
      {\setlength{\unitlength}{1mm}
      \begin{figure}
      \centering
      \newcount\n
      \n=#2
      \multiply \n by -1
      {\protect\makebox[#1mm][l]{\put(0,\n) {\epsfig {file=#5,width=#1mm}}}}
      \caption{#3}\label{#4}
      \end{figure}
	}
    }
    \end{htmlonly}
  }
\fi



%
% These commands are shorter commands of useful ones
%
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\newcommand{\be}{\begin{enumerate}}
\newcommand{\ee}{\end{enumerate}}
\newcommand{\bd}{\begin{description}}
\newcommand{\ed}{\end{description}}
\newcommand{\bq}{\begin{quote}}
\newcommand{\eq}{\end{quote}}
\newcommand{\bQ}{\begin{quotation}}
\newcommand{\eQ}{\end{quotation}}






%
%\input ifthen.sty
%

%
% \ifthen command is just for display
%
\newcommand{\ifthen}[2]{

  \

  {\bf if} \hbox{\it #1\/} {\bf then} \hbox{\it #2\/}

  \

}
%

%
%redefinition of oldstyle, removed by latex
%
%\font\teni=cmmi10
%\def\oldstyle{\fam\@ne\teni}

%\begin{latexonly}

%
% \setdocnr defines document #, then you call it with `\thedocnr'
%
\newcommand{\setdocnr}[1] {\def\thedocnr{{\sc\##1}}}

%\end{latexonly}

%
% \setrevisionnr defines revision #, then you call it with `\thedocnr'
%
\newcommand{\setrevisionnr}[1] {\def\thedocnr{{\sc\#\jobname{#1}}}}

%
% \thedocnr defaults to filename
%
\newcommand{\thedocnr}{{\sc\#\jobname}}


% \ret return sign
%
\newcommand{\ret} {{\rm\scriptsize $\langle$return$\rangle$}}



%
%
%define theorem like structure named `Définition'& ...
%
%
%\newtheorem{definition}{Définition}
%\newtheorem{assertion}{Assertion}
%

%            PAGE STYLES
%
% definition of \footline  !!!! to be set after \pagestyle command
%                          !!!! does not work with `plain' page style
\@ifundefined{latexonly}%
  {}
  {\begin{latexonly}}
\if@twoside         % If two-sided printing.
  \def\footline{%
    \def\@rightftmark
          {\hfill\copyright{\sl \unhcopy\thecorpname} \ {\small \thedocnr}}
    \def\@leftftmark
          {\copyright{\sl \unhcopy\thecorpname} \ {\small \thedocnr} \hfill}
    \let\@oddfoot\@rightftmark
    \let\@evenfoot\@leftftmark
  }
\else
  \def\footline{%
    \def\@rightftmark
        {\hfill\copyright{\sl \unhcopy\thecorpname} \ {\small \thedocnr}}
    \let\@leftftmark\@rightftmark
    \let\@oddfoot\@rightftmark
    \let\@evenfoot\@leftftmark
  }
\fi
\def\@rightftmark{}
\def\@leftftmark{}

%
%
%   \putcorpname{#1}
%           to get the organisation name,
%             if not called then name is Lutecium
%
\newbox\thecorpname
\setbox\thecorpname=\hbox{\sl Lutecium\ }

\@ifundefined{latexonly}%
  {}
  {\end{latexonly}}

\newcommand{\putcorpname}[1]{
  \global\setbox\thecorpname=\hbox {\sl #1}}
%

\@ifundefined{latexonly}%
  {}
  {\begin{latexonly}}
%
%
%   Frames generation
%
%   Here is a single line frame around displayed material
%            called by `\singleframe{<text>}
%
\newcommand{\singleframe}[1]{
  {$${\hsize=.7\hsize
    \@jsframe{5mm}{0.4pt}{#1}{5mm} }
  $$}
}

%
%   Here is a double line frame around displayed material
%            called by `\doubleframe{<text>}
%
\newcommand{\doubleframe}[1]{
  {$${\hsize=.7\hsize
    \@jsframe{1mm}{0.4pt}{\@jsframe{5mm}{0.4pt}{#1}{5mm}}{0mm}}
  $$}
}

%
%   Here is a double line frame, with a thick outer one
%   around displayed material
%            called by `\thickframe{<text>}
%
\newcommand{\thickframe}[1]{
  {$${\hsize=.7\hsize
    \@jsframe{1mm}{1.5pt}{\@jsframe{5mm}{0.4pt}{#1}{5mm}}{0mm}}
  $$}
}


%  Frame generator
%             #1 is the distance to the inside material
%             #2 is the thickness of frame
%             #3 is the information
%             #4 is the h distance
%                     that is, otherwise, 1mm too wide
%
\long\def\@jsframe#1#2#3#4{
  \vbox{\hrule height#2
    \hbox
      {\vrule width#2
        \hskip#4
        \vbox{\vskip#1{}
              \hbox{#3}
              \vskip#1}
        \hskip#4
        \vrule width#2}
      \hrule height#2}}
      


%
%     Block: generates a parallepided frame with a shadow
%
\long\def\Block#1{
  $$\hsize=0.7\hsize
    \LoopBlock{\@jsframe{5mm}{0.4pt}{#1}{5mm}}{9}
  $$
}

%
%     Shadow: generates shadows under a frame
%
\long\def\Shadow#1{
  $$\hsize=0.7\hsize
    \BaseBlock{4pt}{2pt}{10pt}{6pt}{\@jsframe{5mm}{0.4pt}{#1}{5mm}}
  $$
}


%
%     For an unknown reason when #2 > 9 it turns to an infinite loop
%
\long\def\LoopBlock#1#2{%
  \begingroup
    \dimen2=0.4pt   %offset increment
    \def\doblock{%
      \expandafter\setbox\expandafter2\BaseBlock
        {\count1\dimen2}{0.4pt}{\count1\dimen2}{0.4pt}{\box2}}%
    \setbox2=\vbox{#1}%   Starting information
    \count1=0
    \loop
      \advance\count1 by 1
      \doblock
      \ifnum\count1<#2
    \repeat
    \box2
  \endgroup
}

%
%     BaseBlock generates rules for shadowing effects
%
%       #1 offset of vertical rule
%       #2 thickness of vertical rule
%       #3 offset of horizontal rule
%       #4 Thickness of horizontal rule
%       #5 information
%
\long\def\BaseBlock#1#2#3#4#5{%
  \vbox{\setbox0=\hbox{#5}%
    \offinterlineskip
    \hbox{\copy0
      \dimen0=\ht0
      \advance\dimen0 by -#1
      \vrule height \dimen0 width#2}%
    \hbox{\hskip#3\dimen0=\wd0
      \advance\dimen0 by -#3
      \advance\dimen0 by #2
      \vrule height #4 width \dimen0}%
  }
}
\@ifundefined{latexonly}%
  {}
  {\end{latexonly}}
%
%   Pagesize16x24  generates PS for papersize 16cm X 24cm
%
%
\def\Pagesize16x24{%
%\def\LysimaquePage{%
  \setlength{\oddsidemargin}{-10.4mm}
  \setlength{\evensidemargin}{-.4mm}
  \setlength{\topmargin}{-10.4mm}
  \setlength{\headheight}{2.1mm}
  \setlength{\headsep}{8mm}
  \setlength{\textheight}{190mm}
  \setlength{\textwidth}{120mm}
  \setlength{\footskip}{6mm}
  \special{papersize=16cm,24cm}
}

\def\pagesize16x24{%
  \setlength{\oddsidemargin}{-5.4mm}
  \setlength{\evensidemargin}{4.6mm}
  \setlength{\topmargin}{-11.4mm}
  \setlength{\headheight}{2.1mm}
  \setlength{\headsep}{14mm}
  \setlength{\textheight}{180mm}
  \setlength{\textwidth}{110mm}
  \setlength{\footskip}{8mm}
  \special{papersize=16cm,24cm}
}


%\newcommand{\LysimaquePage}{
%  \Pagesize16x24
%}


%   hypervref{<label>} unifies vref in LaTeX and LaTeX2HTML
%

\newcommand{\hypervref}[1]{\latex{\vref{#1}}{\html{\htmlref{ici}{#1}}}}

% @ back to special
\makeatother
