%
% $Id: aipcheck.tex,v 1.7 2002/01/11 19:50:46 frank Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Testing for potential problems with this class
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\ifproblem
\newif\iftimesok

\makeatletter
\def\IfStandaloneCheck{\def\next{aipcheck}
  \edef\currjob{\jobname}
  \edef\next{\meaning\next}
  \edef\currjob{\meaning\currjob}
  \ifx\currjob\next
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\makeatother

\typeout{***********************************************}
\typeout{*}
\typeout{* Testing if all files required for the aipproc}
\typeout{* class are available ...}
\typeout{*}
\typeout{***********************************************}

\typeout{*}
\typeout{* Looking for LaTeX2e ... }
\ifx\documentclass\undefined
 \typeout{*}
 \typeout{* Sorry this is a fatal error:}
 \typeout{*}
 \typeout{* The aipproc class can only be used with LaTeX2e which is}
 \typeout{* the standard LaTeX since 1994!}
 \typeout{*}
 \typeout{* Please make sure that your version of LaTeX is up-to-date}
 \typeout{* before attempting to use this class.}
 \typeout{*}
 \expandafter\stop
\else
 \typeout{* ... ok }
\fi


\def\next#1/#2/#3\next{#1#2}
\typeout{*}
\typeout{* Testing that LaTeX2e is not too old ... }
\ifnum\expandafter\next\fmtversion\next<199612 \relax
 \typeout{* ... what a vintage! }
 \typeout{*}
 \typeout{* Sorry this is a fatal error:}
 \typeout{*}
 \typeout{* The aipproc class can only be used with a recent version}
 \typeout{* of LaTeX2e. Your version is dated \fmtversion\space --- but}
 \typeout{* at least the 1996/12/01 version is required!}
 \typeout{*}
 \typeout{* Please make sure that your version of LaTeX is up-to-date}
 \typeout{* before attempting to use this class.}
 \typeout{*}
 \expandafter\stop
\else
 \ifnum\expandafter\next\fmtversion\next<199806 \relax
   \typeout{* ... probably ok }
   \typeout{*}
   \typeout{* Your version of LaTeX2e is quite old --- the aipproc class}
   \typeout{* hasn't been tested with your release.}
   \typeout{*}
   \typeout{* We believe that it will probably work, but if you encounter}
   \typeout{* problems you will need upgrade your installation.}
   \typeout{*}
   \typein{* Type <return> to continue ...}
   \problemtrue
 \else
   \typeout{* ... ok }
 \fi
\fi


\typeout{*}
\typeout{* Looking for aipproc.cls ... }
\IfFileExists{aipproc.cls}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* Before you can use the aipproc class you have to unpack}
     \typeout{* it from the documented source.}
     \typeout{*}
     \typeout{* Run LaTeX on the file 'aipproc.ins', e.g.,}
     \typeout{*}
     \typeout{* \space\space latex aipproc.ins}
     \typeout{*}
     \typeout{* or whatever is necessary on your installation to process}
     \typeout{* a file with LaTeX. This should unpack a number of files for you:}
     \typeout{*}
     \typeout{* aipproc.cls \space and \space aip-*.clo}
     \typeout{*}
     \typeout{* After that retry processing this guide.}
     \typeout{*}
     \stop
}

\typeout{*}
\typeout{* Looking for aipxfm.sty ... }
\IfFileExists{aipxfm.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The aipxfm.sty file which is part of the aipproc distribution}
     \typeout{* must be installed in a directory which is searched by LaTeX.}
     \typeout{*}
     \typeout{* Please install this file and retry.}
     \typeout{*}
     \stop
}

\typeout{*}
\typeout{* Looking for aip-8s.clo ... }
\IfFileExists{aip-8s.clo}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The aip-8s.clo file which is part of the aipproc distribution}
     \typeout{* must be installed in a directory which is searched by LaTeX.}
     \typeout{*}
     \typeout{* Please install this file and retry.}
     \typeout{*}
     \stop
}

\typeout{*}
\typeout{* Looking for aip-8d.clo ... }
\IfFileExists{aip-8d.clo}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The aip-8d.clo file which is part of the aipproc distribution}
     \typeout{* must be installed in a directory which is searched by LaTeX.}
     \typeout{*}
     \typeout{* Please install this file and retry.}
     \typeout{*}
     \stop
}


\typeout{*}
\typeout{* Looking for aip-6s.clo ... }
\IfFileExists{aip-6s.clo}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The aip-6s.clo file which is part of the aipproc distribution}
     \typeout{* must be installed in a directory which is searched by LaTeX.}
     \typeout{*}
     \typeout{* Please install this file and retry.}
     \typeout{*}
     \stop
}


\typeout{*}
\typeout{* Looking for aip-arlo.clo ... }
\IfFileExists{aip-arlo.clo}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The aip-arlo.clo file which is part of the aipproc distribution}
     \typeout{* must be installed in a directory which is searched by LaTeX.}
     \typeout{*}
     \typeout{* Please install this file and retry.}
     \typeout{*}
     \stop
}

\typeout{*}
\typeout{* Looking for fixltx2e.sty ... }
\IfFileExists{fixltx2e.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found, trying fix2col.sty instead ... }
     \typeout{*}
     \IfFileExists{fix2col.sty}
	 {
	  \typeout{* ... ok }
	 }
	 {
	  \typeout{* ... not found! }
	  \typeout{*}
	  \typeout{* Sorry this is a fatal error:}
	  \typeout{*}
	  \typeout{* Your LaTeX distribution contains neither fixltx2e.sty}
	  \typeout{* nor fix2col.sty.}
	  \typeout{*}
	  \typeout{* This means that it is either too old or incompletely}
	  \typeout{* installed.}
	  \typeout{*}
	  \typeout{* fixltx2e.sty is part of the standard LaTeX distribution}
	  \typeout{* since 1999; fix2col.sty is an earlier version of this}
	  \typeout{* package.}
	  \typeout{*}
	  \typeout{* Best solution is to get the latest LaTeX distribution.}
	  \typeout{* If this is impossible for you, download fix2col.sty.}
	  \typeout{* You can get this software from a CTAN host.}
          \typeout{* Refer to http://www.ctan.org and search for "fix2col".}
	  \typeout{*}
	  \typeout{* After you have updated your LaTeX distribution}
	  \typeout{* retry processing this guide.}
	  \stop
     }
}

\typeout{*}
\typeout{* Looking for fontenc.sty ... }
\IfFileExists{fontenc.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The fontenc package, which is part of standard LaTeX}
     \typeout{* (base distribution) has to be installed at the site to}
     \typeout{* run the aipproc class.}
     \typeout{*}
     \typeout{* The fact that it cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* improperly.}
     \typeout{*}
     \typeout{* Please make sure that your version of LaTeX is okay}
     \typeout{* before attempting to use this class. The LaTeX distribution}
     \typeout{* contains the file "ltxcheck.tex" which can be used to}
     \typeout{* test the basic functionality and integrity of your installation.}
     \typeout{*}
     \stop
    }

\typeout{*}
\typeout{* Looking for calc.sty ... }
\IfFileExists{calc.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Sorry this is a fatal error:}
     \typeout{*}
     \typeout{* The calc package, which is part of standard LaTeX}
     \typeout{* (tool distribution) has to be installed at the site}
     \typeout{* to run the aipproc class.}
     \typeout{*}
     \typeout{* The fact that it cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts.}
     \typeout{*}
     \typeout{* Please make sure that the tools distribution of LaTeX}
     \typeout{* is installed before attempting to use this class.}
     \typeout{*}
     \typeout{* (You might be able to get calc.sty separately for your}
     \typeout{* installation if you are unable to upgrade to a recent}
     \typeout{* distribution for some reason.)}
     \typeout{*}
     \stop
    }

\typeout{*}
\typeout{* Looking for varioref.sty ... }
\IfFileExists{varioref.sty}
    {
     \typeout{* ... ok }
     \gdef\variorefoptionifavailable{varioref,}
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Problem detected:}
     \typeout{*}
     \typeout{* The varioref package, which is part of standard LaTeX}
     \typeout{* (tool distribution) is not installed at this site.}
     \typeout{*}
     \typeout{* The fact that it cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts.}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but }
     \typeout{* you cannot make use of the options "varioref" or "nonvarioref".}
     \typeout{*}
     \typeout{* Please also note that the aipguide.tex documentation}
     \typeout{* normally uses the "varioref" option to show its}
     \typeout{* effects (which  will now fail).}
     \typeout{*}
     \typein{* Type <return> to continue ...}
     \problemtrue
     \gdef\variorefoptionifavailable{}
     \let\vpageref\pageref
     \let\vref\ref
    }

\typeout{*}
\typeout{* Looking for times.sty ... }
\IfFileExists{times.sty}
    {
     \begingroup
% load times and forget it immediately again
       \RequirePackage{times}
       \global\expandafter\let\csname ver@times.sty\endcsname\relax    
       \long\def\next{ptm}
       \ifx\rmdefault\next
         \typeout{* ... ok }
         \gdef\psnfssproblemoption{}
         \endgroup
         \timesoktrue
       \else
         \endgroup
     \typeout{* ... obsolete! }
     \typeout{*}
     \typeout{* Serious problem detected:}
     \typeout{*}
     \typeout{* The times package, which is part of standard LaTeX}
     \typeout{* (psnfss distribution) is obsolete at this site.}
     \typeout{*}
     \typeout{* The fact that it contains incorrect code either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts with old files remaining!}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but}
     \typeout{* you have to specify the option "cmfonts" which result in}
     \typeout{* documents which are not conforming to the AIP layout specification!}
     \typeout{*}
     \typeout{* You can also try using the class in the following way:}
     \typeout{*}
     \typeout{* \space\space \string\documentclass[cmfonts]{aipproc}}
     \typeout{* \space\space \string\usepackage{times}}
     \typeout{* \space\space ...}
     \typeout{*}
     \typeout{* With luck this will result in Times Roman output but chances}
     \typeout{* are that you will get a larger number of error messages in}
     \typeout{* which case you have to remove the \string\usepackage declaration.}
     \typeout{*}
     \typein{* Type <return> to continue ...}
          \problemtrue
          \gdef\psnfssproblemoption{cmfonts}
          \def\textdegree{$^\circ$}            % used below but now
                                               % not setup
       \fi
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Serious problem detected:}
     \typeout{*}
     \typeout{* The times package, which is part of standard LaTeX}
     \typeout{* (psnfss distribution) can not be found.}
     \typeout{*}
     \typeout{* The fact that this package cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts!}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but }
     \typeout{* you have to specify the option "cmfonts" which result in}
     \typeout{* documents which are not conforming to the AIP layout specification!}
     \typeout{*}
     \typein{* Type <return> to continue ...}
     \problemtrue
     \gdef\psnfssproblemoption{cmfonts,}
    }

\iftimesok % don't bother testing other font options if times already
           % bad

\typeout{*}
\typeout{* Looking for t1ptm.fd or T1ptm.fd ... }
\IfFileExists{t1ptm.fd}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found, trying T1ptm.fd ... }
     \IfFileExists{T1ptm.fd}
          {
           \typeout{* ... ok }
          }
          {
           \typeout{* ... not found}
           \typeout{* Serious problem detected:}
           \typeout{*}
           \typeout{* The times package, which is part of standard LaTeX}
           \typeout{* (psnfss distribution) is available but the corresponding}
           \typeout{* .fd file (defining how to load Times Roman) is missing.}
           \typeout{*}
           \typeout{* The fact that this package is only partially installed}
           \typeout{* means that you LaTeX installation is unable to use Times}
           \typeout{* Roman fonts!}
           \typeout{*}
           \typeout{* You can use the aipproc class without this package but }
           \typeout{* you have to specify the option "cmfonts" which result in}
           \typeout{* documents which are not conforming to the AIP layout}
           \typeout{* specification!}
           \typeout{*}
           \typein{* Type <return> to continue ...}
           \problemtrue
           \timesokfalse
           \gdef\psnfssproblemoption{cmfonts,}
          }
    }

\fi


\newcommand\CheckFDFile[3]{%
  \typeout{*}
  \typeout{* Looking for #1#3.fd or #2#3.fd ... }
  \IfFileExists{#1#3.fd}
    {
     \typeout{* ... ok }
    }
    {
     \IfFileExists{#2#3.fd}
      {
       \typeout{* ... ok }
      }
      {\problemtrue
       \typeout{* ... not found! }
      }
    }
}

\iftimesok % don't bother testing other font options if Times already bad

%\CheckFDFile{ot1}{OT1}{ot1ztmcm}
%\CheckFDFile{oml}{OML}{omlztmcm}
%\CheckFDFile{oms}{OMS}{omsztmcm}
%\CheckFDFile{omx}{OMX}{omxztmcm}

\typeout{*}
\typeout{* Looking for mathptm.sty ... }
\IfFileExists{mathptm.sty}
    {
     \typeout{* ... ok }
     \CheckFDFile{ot1}{OT1}{ptmcm}
     \CheckFDFile{oml}{OML}{ptmcm}
     \CheckFDFile{oms}{OMS}{pzccm}
     \CheckFDFile{omx}{OMX}{psycm}
     \ifproblem
      \typeout{*}
      \typeout{* Problem detected:}
      \typeout{*}
      \typeout{* The mathptm package, which is part of standard LaTeX}
      \typeout{* (psnfss distribution) was found but some or all of its}
      \typeout{* support files describing which fonts to load are missing!}
      \typeout{*}
      \typeout{*}
      \typeout{* The fact that this package is only partially installed}
      \typeout{* means that the mathptm package cannot be used!}
      \typeout{*}
      \typeout{* You can use the aipproc class without this package but }
      \typeout{* you have to specify the option "nomathfonts" so that}
      \typeout{* math formulas will be typeset using Computer Modern.}
      \typeout{*}
      \typein{* Type <return> to continue ...}
      \problemtrue
      \gdef\psnfssproblemoption{nomathfonts,}
     \else
      \typeout{*}
      \typeout{* Looking for mathptmx.sty ... }
      \IfFileExists{mathptmx.sty}
       {
        \typeout{* ... ok }
        \CheckFDFile{ot1}{OT1}{ztmcm}
        \CheckFDFile{oml}{OML}{ztmcm}
        \CheckFDFile{oms}{OMS}{ztmcm}
        \CheckFDFile{omx}{OMX}{ztmcm}
        \ifproblem
	  \typeout{*}
	  \typeout{* Problem detected:}
	  \typeout{*}
	  \typeout{* The mathptmx package, which is part of standard LaTeX}
	  \typeout{* (psnfss distribution) was found but some or all of its}
	  \typeout{* support files describing which fonts to load are missing!}
	  \typeout{*}
	  \typeout{*}
	  \typeout{* The fact that this package is only partially installed}
	  \typeout{* means that the mathptmx package cannot be used!}
	  \typeout{*}
	  \typeout{* You can use the aipproc class without this package but }
	  \typeout{* you have to specify the option "mathptm" (no x) so that}
	  \typeout{* math formulas use the older version with upright greek letters.}
	  \typeout{*}
	  \typein{* Type <return> to continue ...}
	  \problemtrue
	  \gdef\psnfssproblemoption{mathptm,}
        \fi
       }
       {
	\typeout{* ... not found! }
	\typeout{*}
	\typeout{* Problem detected:}
	\typeout{*}
	\typeout{* The mathptmx package, which is part of standard LaTeX}
	\typeout{* (psnfss distribution) can not be found.}
	\typeout{*}
	\typeout{* This is unfortunate but not a disaster as the older}
	\typeout{* version of the package "mathptm" (no x) seems to exist.}
	\typeout{*}
	\typeout{* You can use the aipproc class without this package but }
	\typeout{* you have to specify the option "mathptm" so that}
	\typeout{* math formulas use the older version with upright greek letters.}
	\typeout{*}
	\typein{* Type <return> to continue ...}
	\problemtrue
	\gdef\psnfssproblemoption{mathptm,}
       }
      \fi
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Problem detected:}
     \typeout{*}
     \typeout{* The mathptm package, which is part of standard LaTeX}
     \typeout{* (psnfss distribution) can not be found.}
     \typeout{*}
     \typeout{* The fact that this package cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts!}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but }
     \typeout{* you have to specify the option "nomathfonts" so that}
     \typeout{* math formulas will be typeset using Computer Modern.}
     \typeout{*}
     \typein{* Type <return> to continue ...}
     \problemtrue
     \gdef\psnfssproblemoption{nomathfonts,}
    }

\typeout{*}
\typeout{* Looking for mathtime.sty ... }
\IfFileExists{mathtime.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* The mathime package can not be found.}
     \typeout{*}
     \typeout{* This is not a serious problem because this package is}
     \typeout{* only of interest if you own the commerical MathTime fonts.}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but }
     \typeout{* you cannot use the "mathtime" option of the class.}
     \typeout{*}
     \typein{* Type <return> to continue ...}
     \problemtrue
    }
\else
\fi % iftimesok

\typeout{*}
\typeout{* Looking for graphicx.sty ... }
\IfFileExists{graphicx.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Problem detected:}
     \typeout{*}
     \typeout{* The graphics package, which is part of standard LaTeX}
     \typeout{* (graphics distribution) can not be found.}
     \typeout{*}
     \typeout{* The fact that this package cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts!}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but }
     \typeout{* you cannot use commands like \protect\includegraphics
                or \protect\resizebox}
     \typeout{* in this case.}
     \typeout{*}
     \typeout{* Please note that you will get a further error message below}
     \typeout{* about: "graphicx.sty not found" because the class will try}
     \typeout{* to load this package! Type return in response to that error.}
     \typeout{*}
     \typeout{* As a result the illustrations in aipguide will look strange.}
     \typeout{*}
     \typein{* Type <return> to continue ...}

     \gdef\resizebox##1##2{}
     \gdef\includegraphics{\textbf{graphics package missing:}}
     \problemtrue
    }

\typeout{*}
\typeout{* Looking for textcomp.sty ... }
\IfFileExists{textcomp.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Problem detected:}
     \typeout{*}
     \typeout{* The textcomp package, which is part of standard LaTeX}
     \typeout{* (base distribution) can not be found.}
     \typeout{*}
     \typeout{* The fact that this package cannot be found either means that}
     \typeout{* this LaTeX release is too old or that it was installed}
     \typeout{* only in parts!}
     \typeout{*}
     \typeout{* You can use the aipproc class without this package but }
     \typeout{* you will always get the error: "textcomp.sty not found"}
     \typeout{* because the class will try to load this package!}
     \typeout{* Type return in response to that error.}
     \typeout{*}
     \typein{* Type <return> to continue ...}

     \def\textdegree{$^\circ$}         % used below but now
                                       % not set up
     \problemtrue
    }


\typeout{*}
\typeout{* Looking for url.sty ... }
\IfFileExists{url.sty}
    {
     \typeout{* ... ok }
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Problem detected:}
     \typeout{*}
     \typeout{* The url package, which should be part of a good LaTeX}
     \typeout{* distribution, can not be found.}
     \typeout{*}
     \typeout{* Without this package you will not be able to use the \string\url}
     \typeout{* command. Try to download this package from a CTAN  host.}
     \typeout{* Refer to http://www.ctan.org and search for "url".}
     \typeout{*}
     \typein{* Type <return> to continue ...}

     \problemtrue
    }


\makeatletter

\typeout{*}
\typeout{* Looking for natbib.sty ... }
\IfFileExists{natbib.sty}
    {
     \IfStandaloneCheck
       {\begingroup
        \let\@listi\relax
        \let\thebibliography\@empty
        \let\bibstyle\@empty
        \RequirePackage{natbib}
        \@ifpackagelater{natbib}{1999/05/29}
	  {
           \typeout{* ... ok }
	  }{
           \typeout{* ... might be too old! }
           \typeout{*}
           \typeout{* Your version of the natbib package might be too}
           \typeout{* old to be usable. This class was designed to}
           \typeout{* work with the version 7.0 dated 1999/05/28}
           \typeout{*}
           \typeout{* If problems occur download a}
           \typeout{* recent version from a CTAN host.}
           \typeout{*}
           \typeout{* Refer to http://www.ctan.org and search for "natbib".}
           \typeout{*}
           \typein{* Type <return> to continue ...}

           \global\problemtrue
	  }
        \endgroup
        }{}
    }
    {
     \typeout{* ... not found! }
     \typeout{*}
     \typeout{* Serious problem detected:}
     \typeout{*}
     \typeout{* The natbib package, which should be part of a good LaTeX}
     \typeout{* distribution, can not be found.}
     \typeout{*}
     \typeout{* Without this package you will not be able to use certain}
     \typeout{* citation styles. See the aipguide documentation!}
     \typeout{*}
     \typeout{* Especially the layout for ARLO requires this package!}
     \typeout{*}
     \typeout{* Try to download this package from a CTAN  host.}
     \typeout{* Refer to http://www.ctan.org and search for "natbib".}
     \typeout{*}
     \typein{* Type <return> to continue ...}

     \problemtrue
    }

\makeatother


\typeout{*}
\typeout{* ... finished testing}
\typeout{*}
\ifproblem
\typeout{* The tests have revealed some problems in your TeX installation.}
\typeout{*}
\typeout{* Please review the above comments carefully and read the file}
\typeout{* README for further information.}
\typeout{*}
\typeout{*****************************************************************}
\typein{* Type <return> to continue ...}
\else
\typeout{****************************************************************}
\typeout{*}
\typeout{* The tests have reveiled no problems in your TeX installation.}
\typeout{*}
\typeout{****************************************************************}
\fi


% if this file is run standalone stop otherwise continue

\makeatletter
\IfStandaloneCheck
 {
\typeout{*}
\typeout{* This document only produces terminal output.}
\typeout{*}
\stop
 }
 {
\AtBeginDocument{\relax\ifx\xfm@address@loop\@undefined
  \typeout{***************************}
  \typeout{* Oooops ... you seem to have picked up an obsolete}
  \typeout{* aipproc.cls file from a previous installation!}
  \typeout{*}
  \typeout{* Please check that LaTeX finds the right one.}
  \typeout{*}
  \typeout{* Sorry have to give up ....}
  \typeout{***************************}
  \stop
 \fi}
 }
\makeatother

\endinput
%%
%% This is file `template-6s.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% template.raw  (with options: `6s')
%% 
%% Template for the LaTeX class aipproc.
%% 
%% (C) 1998,2000,2001 American Institute of Physics and Frank Mittelbach
%% All rights reserved
%% 
%%
%% $Id: template.raw,v 1.8 2002/06/02 15:34:15 frank Exp $
%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Please remove the next line of code if you
%% are satisfied that your installation is
%% complete and working.
%%
%% It is only there to help you in detecting
%% potential problems.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\input{aipcheck}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SELECT THE LAYOUT
%%
%% The class supports further options.
%% See aipguide.pdf for details.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[
    ,final            % use final for the camera ready runs
%%  ,draft            % use draft while you are working on the paper
%%  ,numberedheadings % uncomment this option for numbered sections
%%  ,                 % add further options here if necessary
  ]
  {aipproc}

\layoutstyle{6x9}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FRONTMATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\title{Azimuthal Asymmetries: \\ Access to Novel Structure 
Functions~\footnote{Presented at the 15th International Spin Physics 
Symposium (Spin 2002), Brookhaven National Laboratory, September 9-14, 
2002.}}


\author{K. A. Oganessyan}{
 address={INFN-Laboratori Nazionali di Frascati, Enrico Fermi 40,
  I-00044 Frascati, Italy}
  ,altaddress={DESY, Notkestrasse 85, 22603 Hamburg, Germany}
}

\author{L. S. Asilyan}{
  ,address={INFN-Laboratori Nazionali di Frascati, Enrico Fermi 40,
  I-00044 Frascati, Italy}
}

\author{E. De Sanctis}{
  ,address={INFN-Laboratori Nazionali di Frascati, Enrico Fermi 40,
  I-00044 Frascati, Italy}
}

\author{V. Muccifora}{
  ,address={INFN-Laboratori Nazionali di Frascati, Enrico Fermi 40,
  I-00044 Frascati, Italy}
}

\begin{abstract}
One of the most interesting consequence of non-zero intrinsic 
transverse momentum of partons in the nucleon is the nontrivial 
azimuthal dependence of the cross section of hard scattering processes. 
Many of the observable asymmetries contain unknown functions which 
provide essential information on the quark  and gluon structure.  
Several  of them have  been studied in the last few years; we discuss 
their qualitative and quantitative features in semi-inclusive DIS.
\end{abstract}

\maketitle

\subsection{Introduction}

The study of the structure of hadrons, bound states of
quarks and gluons, in the context of quantum chromodynamics 
(QCD), is one of the challenges of elementary particle 
physics requiring new nonperturbative approaches in the 
field theory. 

This talk focuses on a discussion of correlations between 
the spins of hadron or quark and the momentum of the quark 
with respect of that of the hadron in polarized hard scattering 
processes. Signatures of these correlations appear in 
high-energy scattering processes as correlations between 
the azimuthal angles of the (transverse) spin and the 
(transverse) momentum vectors. 
 
In particular, we discuss single-spin (transversely polarized 
target or longitudinally polarized beam) and double-spin (longitudinally 
polarized beam and transversely polarized target) azimuthal asymmetries 
in single hadron electroproduction in DIS. 

\begin{figure}
  \includegraphics[height=.3\textheight]{az_n.eps}
  \caption{The kinematics of semi-inclusive DIS: $k_1$ ($k_2$) 
is the 4-momentum of the incoming (outgoing) charged lepton, 
$Q^2=-q^2$, where $q=k_1-k_2$, is the 4-momentum of the virtual 
photon. The momentum $P$ ($P_h$) is the momentum of the target 
(observed) hadron. The scaling variables are $x=Q^2/2(P\cdot q)$, 
$y=(P\cdot q)/(P\cdot k_1)$, and $z=(P\cdot P_h)/(P\cdot q)$.  
The momentum $k_{1T}$ ($P_{h\perp}$) is the incoming lepton (observed hadron) 
momentum component perpendicular to the virtual photon momentum direction, 
and $\phi$ is the azimuthal angle between $P_{h\perp}$ and $k_{1T}$,  
$S_T$ is the target spin vector and $\phi_S$ is its azimuthal angle. }
\end{figure}


%The complete tree-level description expression 
%containing contributions from twist-two and twist-three distribution 
%and fragmentation functions in semi-inclusive DIS has been given in 
%Ref.~\cite{TM}. 

The general form of the factorized cross sections of hard scattering 
process is written as~\cite{QS}
\begin{equation}
d\sigma = H^0 \otimes f_2 \otimes f^{'}_2 
+ {1 \over Q^n} H^1 \otimes f_2 \otimes f^{'}_{2+n} + {\cal O}
{ \left( {1 \over Q^{n+1}} \right) }, 
\label{FCS}
\end{equation}
with $n=1$ and $2$ for the polarized and unpolarized case, respectively. 
The perturbatively calculable coefficient functions are denoted $H^0, 
H^1$ and are convoluted with the nonperturbative soft parts $f_t, f'_t$, 
where $t$ denotes the twist. The cross section is related to  
helicity-dependent amplitudes 
${\cal{A}}_{\Lambda\lambda,\Lambda'\lambda'}$~\cite{JAF1}, 
which describes a process where a target of helicity $\Lambda$ 
emits a parton of helicity $\lambda$, and the scattered parton with 
helicity $\lambda'$ is reabsorbed by a hadron of helicity $\Lambda'$. 
In the spin-1/2 case, due to helicity conservation, parity and 
time invariance, for each twist assignment there are three 
independent 
helicity amplitudes. The familiar distribution functions~\footnote{The 
asterisk indicates bad component of quark/gluon field.} 
$f_1 \Leftrightarrow ({\cal A}_{+\,+,+\,+}+{\cal A}_{+\,-,+\,-})$, 
$g_1 \Leftrightarrow ({\cal A}_{+\,+,+\,+}-{\cal A}_{+\,-,+\,-})$, 
and $g_T \Leftrightarrow ({\cal A}_{+\,{+}^{*},+\,-})$ can be measured 
in inclusive DIS. The chiral-odd nature of  
$h_1 \Leftrightarrow ({\cal A}_{+\,-,-\,+})$, 
$h_L \Leftrightarrow ({\cal A}_{+\,{+}^{*},+\,+}-{\cal A}_{+\,-,+\,-})$, 
and 
$e \Leftrightarrow ({\cal A}_{+\,{+}^{*},+\,{+}}+{\cal A}_{+\,-,+\,-})$
makes their experimental determination difficult. Since electroweak 
and strong interactions conserve chirality, these functions cannot occur 
alone, but have to be accompanied by a second chiral odd quantity. For 
this reason, up to now no experimental information on these functions 
is available.

\subsection{Transverse target single-spin azimuthal asymmetry}

To access the transversity distribution function, $h_1$ (also commonly 
denoted $\delta q$), in semi-inclusive DIS off transversely polarized 
nucleons (see the relevant kinematics in Fig.1), one can measure the 
azimuthal angular dependences in the production of leading spin-0 
or (on average) unpolarized hadrons from transversely polarized quarks 
with nonzero transverse momentum. This production is described 
by the intrinsic transverse momentum dependent fragmentation function 
$H_1^{\perp}(z)$, which is chiral-odd and also  T-odd, i.e., 
non-vanishing only due to final state interactions~\cite{COL}. 
Due to its chiral-odd structure it is a natural partner to isolate 
chiral-odd distribution functions, such as $h_1$, $h_L$, and $e$. 
It is worthy to note that a clean separation of current 
and target fragmentation effects in the data is 
required~\cite{BERG,MULD}.      

The observable moment is defined as the appropriately weighted integral 
over $\phi$ of the cross section asymmetry~\footnote{The first and second 
subscripts indicate the polarizations of beam and target,  
respectively. We use $U$ for unpolarized, $L$ for longitudinally 
polarized and $T$ for transversely polarized particles.}:

\begin{equation}
A^{\sin(\phi+\phi_S)}_{UT} \equiv 
\frac{\int d\phi \sin(\phi+\phi_S) \left[ d\sigma^{\Uparrow}
-d\sigma^{\Downarrow} \right]} 
{{1 \over 2} \int d\phi \left [ d\sigma^{\Uparrow}+
d\sigma^{\Downarrow} \right]}, 
\label{AS}
\end{equation}
where $\Uparrow (\Downarrow)$ denotes the up (down) 
transverse polarization of the target in the virtual-photon frame. 
This asymmetry is given by~\cite{COL,AK,TM}: 
\begin{equation}
\label{UA}
A^{\sin(\phi+\phi_S)}_{UT} \propto \frac{h^u_1(x)}{f^u_1(x)} 
\cdot \frac{H_1^{\perp(1)u}(z)}{D^u_1(z)}.  
\end{equation}

An indication of a non-zero $H^{\perp (1)}_1(z)$ comes from 
the single spin asymmetry measured for pions produced in 
semi-inclusive DIS of leptons off a longitudinally polarized 
target at HERMES~\cite{HERM}. 

  \begin{figure}
  \includegraphics[height=.2\textheight]{kno.eps}
  \caption{{\bf a)} The transversity distribution $\delta u(x)\equiv 
   h^u_1(x)$ and {\bf b)} the ratio of the fragmentation functions 
   $H^{\perp (1) u}_1(z)$ over $D_1(z)$ as they would be measured at 
   HERMES~\cite{KNO,HIN}. The hatched bands show projected systematic 
   uncertainties. } 
\end{figure}

A larger asymmetry with a transversely polarized target is 
expected~\cite{OBDN,BAC}. However, the existence of the competing 
mechanism, which, due to asymmetric distribution of quarks 
transverse momenta in a hadron, also gives a transverse spin 
asymmetry at leading twist~\cite{BROD,COLN}, turns the transversity 
measurement challenging. For distinguishing the different mechanisms 
and for its complete description ($x$-dependence at large $x$, 
$Q^2$-evolution, etc.) results from different scattering processes 
and different kinematics are required. New data from HERMES and 
COMPASS measurements on transversely polarized targets will give 
possibility to measure the transversity~\cite{KNO}. Fig.2 show the 
expected accuracies for the reconstruction of $h^u_1(x)$ and 
$H^{\perp (1) u}_1(z)/D_1(z)$ at HERMES with transversely polarized 
proton target~\cite{KNO,HIN}. 
In addition, analysis of data from $e^{+}e^{-} \to \pi^{+}\pi^{-}X$ 
process, which expected to show a similar azimuthal correlations is 
under way at the BELLE B-factory 
at KEK~\cite{BELLE}. 

\subsection{Beam single-spin azimuthal asymmetry}

 \begin{figure}
\includegraphics[height=0.2\textheight]{xdep_bag.eps}
\includegraphics[height=0.2\textheight]{zdep_bag.eps} 
\end{figure}  
\begin{figure}
  \includegraphics[height=0.2\textheight]{s2_x_bag.eps}
  \includegraphics[height=0.2\textheight]{s2_z_bag.eps}
  \caption{The single beam spin $A^{sin\phi}_{LU}$ and the 
single target spin $A^{sin2\phi}_{UL}$ asymmetries 
for $\pi^+$ production as a function of $x$ and $z$. Data are 
from  HERMES experiment~\cite{HERM}. Error bars show the statistical 
and the systematical uncertainties.} 
\end{figure}
  
At order $1/Q$ a $\sin\phi$ asymmetry was predicted~\cite{LM} for 
longitudinally polarized beam and unpolarized target. It probes the 
interaction-dependent distribution function $\tilde{e}(x)$ 
($\tilde{e}(x) = e(x) - {m \over M} {f_1(x) \over x}$)~\cite{TM,LM} 
in combination with the above mentioned fragmentation function 
$H^{\perp}_1$. It is important to notice  
that this asymmetry is related to the left-right asymmetry in the hadron 
momentum distribution with respect to the electron scattering plane, 
\begin{equation}
A_{LU} = \frac{\int_0^\pi d\phi d\sigma 
- \int_\pi^{2\pi} d\phi d\sigma}{\int_0^\pi d\phi d\sigma 
+ \int_\pi^{2\pi} d\phi d\sigma}, 
\label{A2}     
\end{equation}  
which is $2/\pi$ times $A^{\sin\phi}_{LU}$,
\begin{equation}
A^{\sin\phi}_{LU} = \frac{\int d\phi \sin \phi [d\sigma^{\rightarrow} 
- d\sigma^{\leftarrow}]}
{{1 \over 2} \int d\phi [d\sigma^{\rightarrow}
+d\sigma^{\leftarrow }]} \quad \propto \frac{\sum_a e^2_a  
\tilde{e}^a(x) H_1^{\perp (1) a}(z)}
{\sum_a e^2_a f_1^a(x) D_1^{a}(z)}. 
\label{LU}
\end{equation}
%\begin{equation}
%A^{\sin\phi}_{LU} \propto \frac{\sum_a e^2_a  
%\tilde{e}^a(x) H_1^{\perp (1) a}(z)}
%{\sum_a e^2_a f_1^a(x) D_1^{a}(z)}.
%\label{LU}
%\end{equation}
 
To evaluate this asymmetry as well as the single target-spin $\sin2\phi$ 
asymmetry, $A^{sin2\phi}_{UL}$~\cite{TM,DNO}, we use the MIT bag 
model~\cite{JAF2} as input.
 
For the weighted T-odd fragmentation function, $H^{\perp(1)}_1(z)$, 
we use the Collins ansatz~\cite{COL} for the analyzing power with 
the factor $\eta=1.6$~\cite{OBDN}. The $x$- and $z$-dependences of the 
$A^{sin\phi}_{LU}$ and $A^{sin2\phi}_{UL}$ for $\pi^+$ are shown 
in Fig.3. The asymmetry $A^{sin\phi}_{LU}$ amounts to about 3{\%}, while 
$A^{sin2\phi}_{UL}$ is larger (about 6{\%}). This is in disagreement 
with the asymmetries measured by HERMES~\cite{HERM}, which, as shown 
in the figure, are consistent with zero within the errors. This clearly 
indicate the necessity of a serious improvement of MIT bag model.     

\subsection{Double-spin azimuthal asymmetry}

The double spin azimuthal asymmetry is related to the $g_T(x)($$g_2(x))$ 
distribution function.  

Accounting for transverse momenta of the quarks, a longitudinal quark spin
asymmetry exists in a transversely polarized nucleon target.
The relevant leading twist distribution $g_{1T}(x, p_T^2)$ can be
determined from the measurement of this asymmetry in semi-inclusive 
DIS~\cite{TM,KM,OMD} in the case of longitudinally polarized beam 
and transversely polarized target.

The observable $\cos(\phi-\phi_S)$ moment in the 
cross section is defined in the following way
\begin{equation}
A^{\cos(\phi-\phi_S)}_{LT}= 
\frac{\int d\phi \cos (\phi - \phi_S) \cdot [ \sigma^{\leftarrow \Uparrow}+\sigma^{\rightarrow \Downarrow}
-\sigma^{\leftarrow \Downarrow}-\sigma^{\rightarrow \Uparrow}]} 
{\int d\phi \cdot [\sigma^{\leftarrow \Uparrow}
+\sigma^{\rightarrow \Downarrow} 
+\sigma^{\leftarrow \Downarrow}+\sigma^{\rightarrow \Uparrow}]}
\label{ASMY}
\end{equation}
\begin{equation}
A^{\cos(\phi-\phi_S)}_{LT} \propto \frac{\sum_a e^2_a g_{1T}^{(1)}(x)\, z\, D_1(z)}
{\sum_a e^2_a f_1(x) D_1(z)}. 
\label{ASMY1}
\end{equation}

  \begin{figure}
  \includegraphics[height=0.2\textheight]{clt_x.eps}
  \caption{The double-spin asymmetry $A^{cos(\phi-\phi_S)}_
{LT}$ for $\pi^+$ production as a function of $x$.}
\end{figure}     

%\includegraphics[angle=0,width=12pc,height=12pc]{clt_x.eps}
%Fig.5 The double transverse target spin asymmetry $A^{cos(\phi-\phi_S)}_
%{LT}$ for $\pi^+$ production as a function of Bjorken-$x$.  

The $x$-dependence of $A^{cos(\phi-\phi_S)}_{LT}$ calculated for 
$\pi^+$ production is shown in Fig.4~\cite{KM,OMD}: as seen it is a 
sizable asymmetry that  may provide an alternative way to measure 
$g_2(x)$.    

\subsection{Conclusion}

We have discussed the qualitative and quantitative features 
of nontrivial azimuthal dependence of the cross section of the 
semi-inclusive DIS which provided essential information on nucleon 
spin structure.  

\begin{thebibliography}{99}
\bibitem{QS} J.~Qiu and G.~Sterman, Nucl. Phys. B {\bf 353} (1991) 137; 
             Phys. Rev. Lett. {67} (1991) 2264. 
\bibitem{JAF1} R.L.~ Jaffe, . 
\bibitem{COL} J.C.~Collins, Nucl. Phys. B {\bf 396}, 161 (1993).
\bibitem{BERG} Ed.L.~Berger, Preprint ANL-HEP-CP-87-45 (Argonne, IL, 1987).    
\bibitem{MULD} P.J.~Mulders, . 
\bibitem{AK} A.~Kotzinian, Nucl. Phys. B {\bf 441}, 234 (1995).
\bibitem{TM} P.J.~Mulders and R.D.~Tangerman, Nucl. Phys. B {\bf 461} 
(1996) 197 and Nucl. Phys. B {\bf 484} (1997) 538. 
\bibitem{HERM} HERMES Collaboration, A.~Airapetian et al., Phys. Rev. Lett. 
{\bf 84}, 4047 (2000); Phys. Rev. D {\bf 64} (2001) 097101.  
\bibitem{OBDN} K.A.~Oganessyan, et. al., Nucl. Phys. A {\bf 689} (2001) 784. 
\bibitem{BAC}  A. Bacchetta, et.al., Phys. Rev. D {\bf 65} (2002) 094021. 
\bibitem{BROD} S.J.~Brodsky, D.S.~Hwang, I.~Schmidt, Phys. Lett. B {\bf 530} 
(2002) 99. 
\bibitem{COLN} J.C.~Collins, Phys. Lett. B {bf 536} (2002) 43. 
\bibitem{KNO} V.A.~Korotkov, W.-D.~Nowak, K.A.~Oganessyan, Eur. Phys. J. 
        C {\bf 18} (2001) 639. 
\bibitem{HIN} HERMES Collaboration, HERMES Internal Note 00-003. 
\bibitem{BELLE} K. Hasuko, et. al., for the Belle collaboration, 
         these proceedings. 
\bibitem{LM}  J. Levelt, P.J. Mulders, Phys. Lett. B {\bf 338} (1994) 357.  
\bibitem{DNO} E.~De~Sanctis, W.-D.~Nowak, K.A.~Oganessyan, 
Phys. Lett. B {\bf 483} (2000) 69. 
\bibitem{JAF2} R.L.~Jaffe, X.~Ji, Nucl. Phys. B {\bf 375} (1992) 527. 
\bibitem{KM} A.M.~Kotzinian, P.J.~Mulders, Phys. Lett. B {\bf 406}, 373 (1997). 
\bibitem{OMD} K.A.~Oganessyan, P.J.~Mulders, E.~De~Sanctis,  
        Phys.Lett. B {\bf 532} (2002) 87.

\end{thebibliography}

\end{document}

\endinput
%%
%% End of file `spin_kog_2_rev.tex'.

