%
% $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{Transverse spin effects in proton-proton scattering and $Q \bar Q$ production}


\author{S.V.~Goloskokov}{
  address={Bogoliubov Laboratory of Theoretical Physics,
 Joint Institute
for Nuclear Research, Dubna 141980, Moscow region, Russia} }

\begin{abstract}
We discuss transverse spin effects caused by the spin-flip part of
the Pomeron coupling with the proton. The predicted spin
asymmetries in proton-proton scattering and QQ production in
proton-proton and lepton-proton reactions are not small and can be
studied in future polarized experiments.
\end{abstract}

\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MAINMATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

In this report, we discuss what future facilities can be used to
ascertain the existence of the spin spin-flip part of the Pomeron
coupling. The spin structure of the Pomeron was analysed by
different authors (see \cite{gol_mod,gol_kr} and reference
therein). Its manifestation can be investigated in the elastic pp
scattering at low $t$ \cite{kopel}. We shall analyze here the
single spin asymmetries in the elastic $pp$ scattering near the
diffraction minimum and of the $Q \bar Q$ production in the $pp$
reaction. The double spin asymmetries of $Q \bar Q$ production in
lepton-proton reactions for a longitudinally polarized lepton and
a transversely polarized proton will be studied too. It will be
shown that these asymmetries are sensitive to the spin-flip part
of the Pomeron coupling and predicted asymmetries are not small,
about 10\%. They can be used to obtain information about the spin
structure of the Pomeron coupling. To study spin effects in
diffractive reactions, we use the two- gluon exchange model ,
which is directly connected with the Pomeron. On the other hand,
diffractive processes can be expressed in terms of the generalized
or skewed parton distribution (GPD) in the nucleon $F_\zeta(x)$,
$K_\zeta(x)$ \cite{rad-j}. The connection of the two-gluon model
with GPD will be shown.

The two-gluon coupling with the proton can be parametrized in the
form  \cite{golostr}
\begin{eqnarray}\label{ver}
V_{pgg}^{\alpha\beta}(p,t,x_P,l_\perp)&=& B(t,x_P,l_\perp)
(\gamma^{\alpha} p^{\beta} + \gamma^{\beta} p^{\alpha}) \nonumber\\
&+&\frac{i K(t,x_P,l_\perp)}{2 m} (p^{\alpha} \sigma ^{\beta
\gamma} r_{\gamma} +p^{\beta} \sigma ^{\alpha \gamma}
r_{\gamma})+...  .
\end{eqnarray}
Here $m$ is the proton mass. In the matrix structure (\ref{ver})
we wrote only the terms with the maximal powers of a large proton
momentum $p$ which are symmetric in the gluon indices
$\alpha,\beta$. The structure proportional to $B(t,...)$
determines the spin-non-flip contribution. The term $\propto
K(t,...)$ leads to the transverse spin-flip at the vertex.

The spin-dependent cross section of diffractive processes are
expressed in terms of the soft gluon coupling (1), which in the
case of hadron production is convoluted with the hard hadron
production amplitude. The spin asymmetries are expressed in terms
of the functions $B (t , ...)$ and $K (t , . . .)$ integrated over
the gluon transverse momentum $l_\perp$.

The helicity-non-flip and helicity-flip amplitudes of the
polarized proton off the spinless particle (a meson or unpolarized
proton) can be written in terms of the invariant functions $\tilde
B$ and $\tilde K$
\begin{equation}
\label{fnf} F_{++}(s,t)= i s [\tilde B(t)] f(t);\;\; F_{+-}(s,t)=
i s \frac{\sqrt{|t|}}{m} \tilde K(t) f(t),
\end{equation}
where f(t) is determined by the Pomeron coupling with the other
hadron. The functions $\tilde B$ and $\tilde K$ are defined by the
integrated over $l_\perp$ structures from (\ref{ver}).


There are some models that provide  spin-flip effects which do not
vanish at high energies. In the model \cite{gol_mod}, the
amplitudes $K$ and $B$ have a phase shift caused by the soft
Pomeron rescattering effect.  The  vector diquarks in the diquark
model \cite{gol_kr} generate the  $K$ amplitude  which is out of
phase with the Pomeron contribution to the amplitude $B$. The
value $|\tilde K|/|\tilde B| \sim 0.1$ found in
\cite{gol_mod,gol_kr} will be used in our estimations of the
asymmetry in diffractive hadron production.

The single spin asymmetry is determined by
\begin{equation}\label{an}
A_N \sim 2 \frac{\sqrt{|t|}}{m} \frac{\mbox{Im}(B K^*)}{|B|^2}.
\end{equation}
The models \cite{gol_mod,gol_kr} describe the experimental data on
single spin transverse asymmetry $A_N$ \cite{krish} quite well.
Thus, the weak energy dependence of spin asymmetries in exclusive
reactions is now not in contradiction with the experiment
\cite{gol_mod,akch}.

\begin{figure}[h]
  \includegraphics[height=.28\textheight]{golosan}
  \caption{Predictions of the model
\cite{gol_mod} for single-spin transverse asymmetry of the $pp$
scattering at RHIC energies
  \cite{akch}. Error bar indicates expected
 statistical errors for the PP2PP experiment at RHIC.}
\end{figure}

In the diffraction minimum the imaginary part of the amplitude $B$
is equal to zero and the asymmetry is determined by the product
$(\mbox{Re}B\, \mbox{Im}K)$. Thus, the asymmetry near the
diffraction minimum is sensitive to the imaginary part of the
spin--flip $K$, amplitude and study of  the $A_N$ asymmetry in the
PP2PP experiment at RHIC can give a direct information about the
energy dependence of the  amplitude $K$. There are model
predictions for $A_N$ in this region. The model \cite{gol_mod}
predicts a large negative value of $A_N$ asymmetry near the
diffraction minimum which weakly depends on $s$ at the RHIC energy
range \cite{akch} and $A_N$ is of about 10\% for $|t| \sim 3
\mbox{GeV}^2$ (Fig.1). Other model predictions for single-spin
asymmetry at small momentum transfer was discussed in
\cite{predazzi}.



The single spin asymmetry of diffractive $Q \bar Q$ production in
polarized pp reaction was estimated in \cite{golos96}. It was
found that  $A_N$ is determined by Eq. (\ref{an}) which is
modified by the amplitude of hard $Q \bar Q$ production. The
expected value of the single spin asymmetry in this case is about
5\% in the RHIC energy range.

Let us study now diffractive double spin asymmetries of $Q \bar Q$
production in lepton-proton reactions for a longitudinally
polarized lepton and a transversely polarized proton within the
two-gluon model. This model should describe the cross sections of
hard and light quark production  at small $x<0.1$ as well. The
spin-dependent cross section can be written in the form
\begin{equation}
\label{sigma} \frac{d^5 \sigma(\pm)}{dQ^2 dy dx_p dt dk_\perp^2}=
\left(^{(2-2 y+y^2)} _{\hspace{3mm}(2-y)}\right)
 \frac{C(x_P,Q^2) \; N(\pm)}
{\sqrt{1-4(k_\perp^2+m_q^2)/M_X^2}}.
\end{equation}
Here $C(x_P,Q^2)$ is a normalization function which is common for
the spin average and spin dependent cross section; $N(\pm)$ is
determined by a sum of graphs integrated over the gluon momenta
$l$ and $l'$. The  function $N(+)$ determines the spin-average
cross section. It has the form
\begin{equation}\label{np}
N(+)=\left(|\tilde B|^2+|t|/m^2 |\tilde K|^2 \right)
\Pi^{(+)}(t,k_\perp^2,Q^2),
\end{equation}
with
\begin{eqnarray}\label{bqq}
\tilde B \sim \int^{l_\perp^2<k_0^2}_0 \frac{d^2l_\perp
(l_\perp^2+\vec l_\perp \vec r_\perp) }
{(l_\perp^2+\lambda^2)((\vec l_\perp+\vec r_\perp)^2+\lambda^2)}
B(t,l_\perp^2,x_P,...) =  { F}^g_{x_P}(x_P,t,k_0^2)\nonumber\\
\tilde K \sim \int^{l_\perp^2<k_0^2}_0 \frac{d^2l_\perp
(l_\perp^2+\vec l_\perp \vec r_\perp) }
{(l_\perp^2+\lambda^2)((\vec l_\perp+\vec r_\perp)^2+\lambda^2)}
K(t,l_\perp^2,x_P,...) =  { K}^g_{x_P}(x_P,t,k_0^2),
\end{eqnarray}
where $k_0^2 \sim (k_\perp^2+m_q^2)/(1-\beta)$. The connection of
the two-gluon structure functions from (\ref{ver}) with GPD ${
F}^g_{x_P}(x_P,t,k_0^2)$ and ${ K}^g_{x_P}(x_P,t,k_0^2)$  is
written. This connection is general and  is shown for a vector
meson and $Q \bar Q$ production in \cite{golostr}.


The function $N(-)$ which determines the spin-dependent cross
sections looks like
\begin{eqnarray}\label{nm}
N(-)=\sqrt{\frac{|t|}{m^2}} \left(\tilde B \tilde K^*+\tilde B^*
\tilde K\right) [ \frac{(\vec Q \vec S_\perp)}{m}
\Pi^{(-)}_Q(t,k_\perp^2,Q^2) \nonumber\\
 +\frac{(\vec k_\perp \vec
S_\perp)}{m} \Pi^{(-)}_k(t,k_\perp^2,Q^2)].
\end{eqnarray}
The other form of interference between $B$ and $K$ with respect to
(\ref{an}) appears in (\ref{nm}) because we consider here the
double spin effects. The large value of asymmetry will appear for
a small phase shift between the amplitudes.

The asymmetry is approximately proportional to the ratio of
polarized and spin--average gluon distribution functions
\begin{equation}\label{cltqq}
 A_{LT}^{Q \bar Q} \sim C^{Q \bar Q} \frac{{ K}^g_\zeta(\zeta)}
 {{ F}^g_\zeta(\zeta)}
 \;\;\;\mbox{with} \;\zeta=x_P\;\;\mbox{and}\; |\tilde K|/|\tilde B| \sim 0.1
\end{equation}


The spin-dependent contribution to the asymmetry which is
proportional to $\vec k_\perp \vec S_\perp$ in (\ref{nm})  will be
analyzed for the case when the transverse jet momentum $\vec
k_\perp$ is parallel to the target polarization $\vec S_\perp$.
The asymmetry is maximal in this case. To observe this
contribution to asymmetry, it is necessary to distinguish
experimentally the quark and antiquark jets.  If we do not
separate events with $\vec k_\perp$ for the quark jet, e.g., the
resulting asymmetry will be equal to zero because the transverse
momentum of the quark and antiquark are equal and opposite in
sign.
\\[8mm]
\phantom{.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\begin{minipage}{7.2cm}
\includegraphics[height=.24\textheight]{golosf9}
\end{minipage}
\begin{minipage}{0.0cm}
\phantom{aa}
\end{minipage}
\begin{minipage}{7.2cm}
\includegraphics[height=.24\textheight]{golosf10}
\end{minipage}
\\[.3cm]
%\bigskip
\noindent
\begin{minipage}{7.1cm}
{\small{\bf FIGURE 2.}~ {The $A^k_{lT}$ asymmetry in diffractive
heavy $Q \bar Q$ production at $\sqrt{s}=20 \mbox{GeV}$ for
$x_P=0.1$, $y=0.5$, $|t|=0.3 \mbox{GeV}^2$: dotted line-for
$Q^2=0.5 \mbox{GeV}^2$; solid line-for $Q^2=1 \mbox{GeV}^2$;
dot-dashed line-for $Q^2=5 \mbox{GeV}^2$; dashed line-for $Q^2=10
\mbox{GeV}^2$.}}
\end{minipage}
\begin{minipage}{.15cm}
\phantom{aa}
\end{minipage}
\begin{minipage}{7.1cm}
\vspace{-1.4cm} {\small{\bf FIGURE 3.}~ {The $A^k_{lT}$ asymmetry
in diffractive light $Q \bar Q$ production for
$Q^2=5\mbox{GeV}^2$, $x_P=0.1$, $y=0.5$, $|t|=0.3(GeV)^2$ at
$\sqrt{s}=7 \mbox{GeV}$.}}
\end{minipage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%====
\\[.4cm]

The predicted asymmetry for heavy $c \bar c$ production at the
COMPASS energies is shown in Fig.2. The asymmetry for light quark
production is  approximately of the same order of magnitude. The
expected $A_{lT}$ asymmetry for light quark production at HERMES
is shown in Fig.3. The function $C_k^{Q \bar Q}$ in (\ref{cltqq})
is quite large, about 1.5 at the HERMES energy for
$k_\perp^2=1.3\mbox{GeV}^2$, $Q^2=5\mbox{GeV}^2$, $x_P=0.1$,
$y=0.5$, and $|t|=0.3 \mbox{GeV}^2$. The spin--dependent cross
section  vanishes for $Q^2 \to 0$, while the spin--average cross
section is constant in this limit. As a result, the asymmetry can
be estimated as $A_{lT} \propto Q^2/(Q^2+Q^2_0)$ with $Q^2_0 \sim
1 \mbox{GeV}^2$. This shows a possibility of studying the
polarized gluon distribution ${ K}^g_\zeta(x)$ in the COMPASS and
HERMES experiment at $Q^2 \geq 0.5\mbox{GeV}^2$.

The contribution to asymmetry $\propto \vec Q \vec S_\perp$ in
(\ref{nm}) is simpler to study experimentally. The expected
asymmetry in this case is not small too, about 5\% or a little bit
smaller. The predicted $C_Q^{Q \bar Q}$ in (\ref{cltqq}) in this
case is about 0.3. In contrast to the $A^k_{lT}$ term, the
$A^Q_{lT}$ asymmetry has a strong mass dependence \cite{golostr}.

Similar analyses have been carried out for diffractive $J/\Psi$
production which is described by the same two-gluon exchange.
Unfortunately, the double spin $A_{lT}$ asymmetry in this case is
proportional to $x_P$ which is fixed here by $x_P \sim
(m_V^2+Q^2+|t|)/(s y)$. As a result the expected asymmetry is
small and $C_g(J/\Psi) \sim 0.007$ for vector meson production in
the HERMES energy range. It is difficult to expect experimental
study of such small asymmetry.

I this report we have studied the transverse asymmetries caused by
the spin structure of the Pomeron coupling with the proton.
Similar to the low energy experiments \cite{krish} we predict the
large negative asymmetry in the vicinity of the diffractive
minimum in elastic $pp$ scattering at the RHIC energies. If the
weak energy dependence of the asymmetry in this region is found in
the PP2PP experiment at the RHIC, it will give a definite
indication of the spin-dependent Pomeron coupling. Another
possibility is to study the single-spin asymmetry of diffractive
$Q \bar Q$ production at RHIC which is predicted to be about 5\%.


The diffractive hadron leptoproduction for a longitudinally
polarized lepton and a transversely polarized proton at high
energies has been studied. The $A_{lT}$ asymmetry is found to be
proportional to the ratio of structure functions $A_{lT}=C {
K^g}/{ F^g}$. If the Pomeron has a spin structure, the ratio
$K^g/F^g$ should have a weak $x$ dependence at low $x <0.1$. The
$A_{lT}$ asymmetry can be used to get information on the
transverse distribution ${ K}^g_{x_P}(x_P,t)$ from experiment if
the function $C$ in (\ref{cltqq}) is not small. We predict that
 $C_k^{Q \bar Q} \sim 1$  for the term $\propto \vec k_\perp \vec
S_\perp$ and $C_Q^{Q \bar Q} \sim 0.3$ for the contribution
$\propto \vec Q \vec S_\perp$ in the asymmetry (\ref{nm}). We can
see that the expected values of $C$  are quite large and such
asymmetries might be excellent objects to study transverse spin
effects in the proton-- gluon coupling.

The results presented here should be applicable to the reactions
with heavy quarks. For processes with light quarks, our
predictions can be used in the small $x$ region ($x \le 0.1$ e.g.)
where the contribution of quark GPD is expected to be small. In
the case of light quark production   the polarized $u$ and $d$
quark GPD might be studied together with the gluon distribution in
the region of not small $x\ge 0.1$. Such experiments can be
conducted at the  HERMES and COMPASS spectrometers for a
transversely polarized target and future eRHIC. We conclude that
important information on the spin--dependent GPD ${ K}_\zeta(x)$
at small $x$ can be obtained from the asymmetries in diffractive
$pp$ and $lp$ reactions for longitudinally polarized lepton and
transversely polarized hadron targets.

The author is grateful to the Organizing Committee of SPIN2002 for
the local financial support. These report was supported in part by
the Russian Foundation for Basic Research, Grants 00-02-16696 and
02-02-27409.
\begin{thebibliography}{9}
\bibitem{gol_mod}  Goloskokov S.V., Kuleshov S.P., Selyugin O.V.,
           Z. Phys. {\bf C50}  455-464 (1991).
\bibitem{gol_kr} Goloskokov S.V.,  Kroll P., Phys.\ Rev.
          {\bf D60} 014019 \ 1-8 (1999).
\bibitem{kopel}  Buttimore N.H. et al.,  Phys.Rev. {\bf D59} 114010
\ 1-18 (1999);  Kopeliovich B.Z., "PP elastic scattering at low
$t$". This Proceedings.
\bibitem{rad-j} Radyushkin A.V., Phys. Rev,  {\bf D56} 5524-5557 (1997).
 Ji X., Phys.Rev. {\bf D55} 7114-7125 (1997).
\bibitem{golostr} Goloskokov S.V., Euro.\ Phys.\ J. {\bf C24}   413-424 (2002).
\bibitem{krish} Fidecaro G. et al., Phys. Lett.  {\bf B76} 369-373
(1978),  {\bf B105} 309-314 (1981).
\bibitem{akch}  Akchurin N., Goloskokov S.V., Selyugin O.V.,
Int.J.Mod.Phys. {\bf A14}, 253-269 (1999).
\bibitem{predazzi}   Martini A.F., Predazzi E.,  Diffractive
effects in spin-flip pp amplitudes and predictions for
relativistic energies. E-print: .
\bibitem{golos96}Goloskokov S.V., Phys.Rev. {\bf D53} 5995-5999 (1996).


\end{thebibliography}

\end{document}

