%%% imported from MAD-8
% *******************************************************************

% set the indentation at the beginning of a paragraph to zero
% for better lisibility in a manual style
\setlength{\parindent}{0pt} % Default is 15pt.
 
\pagestyle{headings}
 
% heading for the \chapter command.
\makeatletter
\def\@makechapterhead#1{{
   \parindent 0pt\raggedright\LARGE \bf
   \ifnum \c@secnumdepth >\m@ne
      \@chapapp{} \thechapter.\ \ \fi
   #1\par\nobreak\vskip 20pt
}}
 
% heading for the \chapter* command.
\def\@makeschapterhead#1{{
   \parindent 0pt\raggedright\LARGE \bf
   #1\par\nobreak\vskip 20pt
}}
 
% titles for the lists of figures and tables:
\def\listoffigures{
   \section*{List of Figures}
   \@starttoc{lof}
}
\def\listoftables{
   \section*{List of Tables}
   \@starttoc{lot}
}
 
\makeatother
 
% description lists:
\def\madlist{\list{}{
   \setlength{\labelwidth}{2.3cm}
   \setlength{\leftmargin}{2.5cm}
   \let\makelabel\madlabel}
}
 
\let\endmadlist\endlist
 
\def\madlabel#1{#1\hfill}
 
\def\eqref#1{Eqn.~\ref{#1}}
\def\epem{e${}^+\)-e${}^-$}
 
% automatic indexing of keywords:
\def\ttitem#1{\item[{\tt #1}]\index{#1@{\tt #1}}}
\def\ttitemn#1{\item[{\tt #1}]}
%\def\ttindex#1{{\tt #1}\index{#1@{\tt #1}}}
\def\ttindex#1{\index{#1@{\uppercase{\tt #1}}}}

\def\madsection#1{\section{#1}\index{#1@{\uppercase{\tt #1}}}\label{sec:#1}}
 
% MAD command specifications:
\newcommand{\madbox}[1]{
   \begin{quote}
      \tt
      \fbox{
         \begin{minipage}{0.95\textwidth}
            \begin{tabbing}
               #1
            \end{tabbing}
         \end{minipage}
      }
   \end{quote}
}
 
% MAD command examples:
\newcommand{\madxmp}[1]{
   \begin{quote}
      \tt
      \begin{tabbing}
         #1
      \end{tabbing}
   \end{quote}
}
 
% Some Mathematical Symbols and Operators
\def\sign{\mathop{\mathrm{sign}}\nolimits}
\def\Tr{\mathop{\mathrm{Tr}}\nolimits}
\def\ad{{\sl Ad\/}}
\def\adphsp{$\{{:}f{:}\}$}
\def\eqdef{\stackrel{def}{=}}
\def\gappeq{\stackrel{>}{\approx}}
\def\lieop#1{{:}{#1}{:}}
\def\lietran#1{e^{{:}{#1}{:}}}
\def\map#1{$\cal #1$}
\def\numclass#1{\mathrm\bf{#1}}
\def\order{order}
\def\phsp{\{Z\}}
\def\pbkt#1#2{\sum_{k=1}^3\left(
  {\partial #1\over\partial q_k}{\partial #2\over\partial p_k} -
  {\partial #1\over\partial p_k}{\partial #2\over\partial q_k}
\right)}
 
\def\aux{\left(p_x^2+p_y^2+\frac{p_t^2}{\beta^2\gamma^2}\right)}
\def\solaux{\left((p_x+ky)^2+(p_y-kx)^2+\frac{p_t^2}{\beta^2\gamma^2}\right)}
 
\def\vbar{\overline{v}}
\def\wbar{\overline{w}}
 
% `array' environment using display style
\long\def\eqarray#1{\vcenter{\let\\=\cr\openup1\jot
  \halign{&\strut$\,\displaystyle{##}\;$\hfil\crcr#1\crcr}}}
 
% `array' environment using display style for matrices
\long\def\madarray#1{\null\vcenter{\let\\=\cr\openup1\jot
  \halign{&\strut\hfil$\>\displaystyle{##}\>$\hfil\crcr#1\crcr}}}
 
% left align displayed equations
\def\[#1\]{$$\indent\leftline{$\displaystyle{#1}$}\hss$$}
 
\tabskip=0pt plus 1fill

%%% End imported from MAD-8

%%% Handy abbreviations
\newcommand{\madeight}{{\tt MAD-8}\xspace}
\newcommand{\madnine}{{\tt MAD-9}\xspace}
\newcommand{\mad}{{\tt MAD-X}\xspace}
\newcommand{\madx}{{\tt MAD-X}\xspace}
\newcommand{\ptc}{{\tt PTC}\xspace}
