%%% ======================================================================
%%%  @LaTeX-style-file{
%%%     filename        = "seg.sty",
%%%     version         = "0.9",
%%%     date            = "September 9, 1993",
%%%     ISO-date        = "1993.9.9",
%%%     time            = "00.00.00",
%%%     author          = "Martin Karrenbach",
%%%     contact         = "Stanford Exploration Project",
%%%     address         = "366 Mitchell
%%%                        Stanford, CA 94305",
%%%     telephone       = "(415) 723-6007",
%%%     email           = "martin@sep.stanford.edu (Internet)",
%%%     supported       = "maybe",
%%%     archived        = "not yet",
%%%     keywords        = "REVTeX, version 3.0, main style,
%%%                        Society of Exploration Geophysicists",
%%%     codetable       = "ISO/ASCII",
%%%     docstring       = "This is the main society-specific style file for
%%%                        the Society of Exploration Geophysicists 
%%%                        under REVTeX 3.0
%%%                        (release of September 9, 1993)."
%%%
%%% ======================================================================
% ****** Start of file seg.sty ******
%
%
%   This file is part of the SEG files in the REVTeX 3.0 distribution.
%   Version 3.0 of REVTeX, November 10, 1992.
%
%   Copyright (c) 1992 The Society of Exploration Geophysicist.
%
%   See the REVTeX 3.0 README file for restrictions and more information.
%

\typeout{Filename: seg.sty, v0.9 <9 September 1993>}

\def\partname{Part}
\def\contentsname{Contents}
\def\listfigurename{FIGURES}
\def\listtablename{TABLES}
\def\refname{REFERENCES}
\def\indexname{Index}
\def\figurename{FIG.}
\def\tablename{TABLE}
\def\abstractname{\bf ABSTRACT}

\newif\iffirstfig \global\firstfigtrue
\newif\iffirsttab \global\firsttabtrue

\newif\ifflushfiguretoend \global\flushfiguretoendfalse
\ifpreprintsty\global\flushfiguretoendtrue\else\fi
\ifsegabssty\global\flushfiguretoendfalse\else\fi


\def\tightenlines{\def\baselinestretch{1}\small\normalsize}
\let\tighten\tightenlines

\ifx\selectfont\undefined %
\@revmess{message}{NFSS not detected. Assuming OFSS.}
\let\reset@font\relax
\def\mathhexbox{\protect\mathhexbox@}
\def\mathhexbox@#1#2#3{\relax
\ifmmode\mathpalette{}{\m@th\mathchar"#1#2#3}%
\else\leavevmode\hbox{$\m@th\mathchar"#1#2#3$}\fi}
\def\text#1{%
\relax
\ifmmode %
\mathchoice
{\hbox{\everymath{\displaystyle}\rm #1}}%
{\hbox{\everymath{\textstyle}\rm #1}}%
{\hbox{\everymath{\scriptstyle}%
\def\prm{\fam\z@ \the\scriptfont\z@ \relax}%
\def\pit{\fam\itfam \the\scriptfont\itfam \relax}%
\rm #1}%
}%
{\hbox{\everymath{\scriptscriptstyle}%
\def\prm{\fam\z@ \the\scriptscriptfont\z@ \relax}%
\def\pit{\fam\itfam \the\scriptscriptfont\itfam \relax}%
\rm #1}%
}%
\else %
\leavevmode\hbox{#1}%
\fi
}
\def\bbox#1{%
\leavevmode\text{%
\textfont0 \the\textfont\bffam
\scriptfont0 \the\scriptfont\bffam
\scriptscriptfont0 \the\scriptscriptfont\bffam
\@temptokena\everymath \boldmath \everymath\@temptokena
{$\m@th\relax#1$}%
}%
}
\font\fivbf=cmbx5 \font\sixbf=cmbx6 \font\sevbf=cmbx7 \font\egtbf=cmbx8
\expandafter\def\expandafter\ixpt\expandafter{\ixpt
\scriptfont\bffam\sixbf \scriptscriptfont\bffam\fivbf}
\expandafter\def\expandafter\xpt\expandafter{\xpt
\scriptfont\bffam\sevbf \scriptscriptfont\bffam\fivbf}
\expandafter\def\expandafter\xipt\expandafter{\xipt
\scriptfont\bffam\egtbf \scriptscriptfont\bffam\sixbf}
\expandafter\def\expandafter\xiipt\expandafter{\xiipt
\scriptfont\bffam\egtbf \scriptscriptfont\bffam\sixbf}
\expandafter\def\expandafter\xivpt\expandafter{\xivpt
\scriptfont\bffam\tenbf \scriptscriptfont\bffam\sevbf}
\else %
\@revmess{message}{NFSS detected! Assuming NFSS.}
\def\text#1{%
\relax\ifmmode
\mathchoice
{\hbox{{\everymath{\displaystyle}#1}}}%
{\hbox{{\everymath{\textstyle}#1}}}%
{\hbox{{\everymath{\scriptstyle}\let\f@size\sf@size\selectfont#1}}}%
{\hbox{{\everymath{\scriptscriptstyle}\let\f@size\ssf@size\selectfont#1}}}%
\glb@settings
\else
\mbox{#1}%
\fi
}
\def\bbox#1{%
\relax\ifmmode
\mathchoice
{{\hbox{\boldmath$\displaystyle#1$}}}%
{{\hbox{\boldmath$\textstyle#1$}}}%
{{\hbox{\boldmath$\scriptstyle#1$}}}%
{{\hbox{\boldmath$\scriptscriptstyle#1$}}}%
\glb@settings
\else
\mbox{#1}%
\fi
}
\def\mathhexbox{\protect\mathhexbox@}
\def\mathhexbox@#1#2#3{\relax
\ifmmode\mathpalette{}{\m@th\mathchar"#1#2#3}%
\else\leavevmode\hbox{$\m@th\mathchar"#1#2#3$}\fi}
\fi

\input seg1\@ptsize.sty\relax

\def\@chuckoptarg[#1]{}

\def\alph#1{\@alph{\@nameuse{c@#1}}}
\def\@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi}
\def\@ialph#1{\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or
k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or
z\or aa\or bb\or cc\or dd\or ee\or ff\or gg\or hh\or ii\or jj\or
kk\or ll\or mm\or nn\or oo\or pp\or qq\or rr\or ss\or tt\or uu\or
vv\or ww\or xx\or yy\or zz\else\@ctrerr\fi}

\let\slantfrac\frac

%\def\ao{Appl.\  Opt.\ }
%\def\ap{Appl.\  Phys.\ }
%\def\apl{Appl.\ Phys.\ Lett.\ }
%\def\apj{Astrophys.\ J.\ }
%\def\bell{Bell Syst.\ Tech.\ J.\ }
%\def\jqe{IEEE J.\ Quantum Electron.\ }
%\def\assp{IEEE Trans.\ Acoust.\ Speech Signal Process.\ }
%\def\aprop{IEEE Trans.\ Antennas Propag.\ }
%\def\mtt{IEEE Trans.\ Microwave Theory Tech.\ }
%\def\iovs{Invest.\ Ophthalmol.\ Vis.\ Sci.\ }
%\def\jcp{J.\ Chem.\ Phys.\ }
%\def\jmo{J.\ Mod.\ Opt.\ }
%\def\josa{J.\ Opt.\ Soc.\ Am.\ }
%\def\josaa{J.\ Opt.\ Soc.\ Am.\ A }
%\def\josab{J.\ Opt.\ Soc.\ Am.\ B }
%\def\jpp{J.\ Phys.\ (Paris) }
%\def\nat{Nature (London) }
%\def\oc{Opt.\ Commun.\ }
%\def\ol{Opt.\ Lett.\ }
%\def\pl{Phys.\ Lett.\ }
%\def\pra{Phys.\ Rev.\ A }
%\def\prb{Phys.\ Rev.\ B }
%\def\prc{Phys.\ Rev.\ C }
%\def\prd{Phys.\ Rev.\ D }
%\def\pre{Phys.\ Rev.\ E }
%\def\prl{Phys.\ Rev.\ Lett.\ }
%\def\rmp{Rev.\ Mod.\ Phys.\ }
%\def\pspie{Proc.\ Soc.\ Photo-Opt.\ Instrum.\ Eng.\ }
%\def\sjqe{Sov.\ J.\ Quantum Electron.\ }
%\def\vr{Vision Res.\ }

\def\labelenumi{\theenumi.}
\def\theenumi{\arabic{enumi}}

\def\labelenumii{(\theenumii)}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}

\def\labelenumiii{\theenumiii.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}

\def\labelenumiv{\theenumiv.}
\def\theenumiv{\Alph{enumiv}}
\def\p@enumiv{\p@enumiii\theenumiii}

\def\labelitemi{$\m@th\bullet$}
\def\labelitemii{\bf --}
\def\labelitemiii{$\m@th\ast$}
\def\labelitemiv{$\m@th\cdot$}

\def\verse{\let\\=\@centercr
\list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent
\rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]}
\let\endverse\endlist

\def\quotation{\list{}{\listparindent 1.5em
\itemindent\listparindent
\rightmargin\leftmargin \parsep \z@ plus\p@}\item[]}
\let\endquotation=\endlist

\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

\def\descriptionlabel#1{\hspace\labelsep \bf #1}
\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin
\let\makelabel\descriptionlabel}}

\let\enddescription\endlist

\def\titlepage{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
\else \newpage \fi \thispagestyle{empty}\c@page\z@}

\def\endtitlepage{\if@restonecol\twocolumn \else \newpage \fi}

\arraycolsep 3pt %
\tabcolsep 2pt %
\arrayrulewidth .4pt %
\doublerulesep 2pt %

\tabbingsep \labelsep %

\skip\@mpfootins = \skip\footins

\fboxsep = 3pt %
\fboxrule = .4pt %

\newcounter{part}
\newcounter{section}
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
\newcounter{subparagraph}[paragraph]

\def\thepart          {\Roman{part}} %
\def\thesection       {\Roman{section}}
\def\p@section        {}
\def\thesubsection    {\Alph{subsection}}
%\def\p@subsection     {\thesection\,}
\def\p@subsection     {}
\def\thesubsubsection {\arabic{subsubsection}}
\def\p@subsubsection  {\thesection\,\thesubsection\,}
\def\theparagraph     {\alph{paragraph}}
\def\thesubparagraph  {\theparagraph.\arabic{subparagraph}}

\def\acknowledgments{\section*{ACKNOWLEDGMENTS}}
\let\acknowledgements\acknowledgments

%%% Martin   this has a few changes to get rid of sec numbers in sec titles
\gdef\tempc{}% that should be @tempc
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty\else
\refstepcounter{#1}%
\def\@tempa{#8}%
\ifappendixon\if@mainhead\ifsegabssty\else\ifpreprintsty\newpage\fi\fi\fi\fi%
%%%%\ifappendixon\ifpreprintsty\if@mainhead\newpage\fi\fi\fi% 
\ifx\@tempa\empty %
\ifappendixon%
\if@mainhead%
\def\@tempa{APPENDIX }\def\@tempb{}%
\else%
%\def\@tempa{}\def\@tempb{. }%
\def\@tempa{}\def\@tempb{}%
\fi%
\else %
%\def\@tempa{}\def\@tempb{. }%
\def\@tempa{}\def\@tempb{}%
\fi
\else %
\ifappendixon%
\if@mainhead%
%\def\@tempa{APPENDIX }\def\@tempb{--}%
\def\@tempa{APPENDIX }\def\@tempb{\thesection--}%
\else %
%\def\@tempa{}\def\@tempb{. }%
\def\@tempa{}\def\@tempb{}%
\fi
\else %
%\def\@tempa{}\def\@tempb{. }%
\def\@tempa{}\def\@tempb{}%
\fi
\fi
%\edef\@svsec{\@tempa\csname the#1\endcsname\@tempb}\fi
\edef\@svsec{\@tempa\@tempb}%
\gdef\tempc{\if@subsubhead.---\fi}
%%%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup #6\relax
{\hskip #3\relax\@svsec}{\interlinepenalty \@M
%%% MARTIN
%\if@mainhead\uppercase{#8}\else#8\fi\par}%
\if@mainhead\uppercase{#8}\else#8\fi\tempc\par}%
%%%
\endgroup
\csname #1mark\endcsname{#7}\addcontentsline
{toc}{#1}{\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}\fi
#7}\else
\def\@svsechd{#6\hskip #3\relax %
%%% Martin
%\@svsec \if@mainhead\uppercase{#8}\else#8\fi
\@svsec \if@mainhead\uppercase{#8}\else#8\tempc\fi
%%%
\csname #1mark\endcsname
{#7}\addcontentsline
{toc}{#1}{\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}\fi
#7}}\fi
\@xsect{#5}}

\def\@ssect#1#2#3#4#5{\@tempskipa #3\relax
\ifdim \@tempskipa>\z@
\begingroup #4{\hskip #1}{\interlinepenalty \@M
\ifappendixon
\if@mainhead %
\stepcounter{section}%
\def\@tempa{#5}%
\ifx\@tempa\empty %
APPENDIX%
\else %
APPENDIX:\ %
\fi
\fi
\fi
%%% Martin
%\if@mainhead\uppercase{#5}\else#5\fi\par}\endgroup
\if@mainhead\uppercase{#5}\else#5\fi\tempc\par}\endgroup
%%%
\else \def\@svsechd{#4\hskip #1\relax
\ifappendixon
\if@mainhead %
\stepcounter{section}%
\def\@tempa{#5}%
\ifx\@tempa\empty %
APPENDIX%
\else %
APPENDIX:\ %
\fi
\fi
\fi
%%% Martin
%\if@mainhead\uppercase{#5}\else#5\fi}\fi
\if@mainhead\uppercase{#5}\else#5\tempc\fi}\fi
%%%
\@xsect{#3}}

\def\part{\par %
\addvspace{4ex} %
\@afterindentfalse %
\secdef\@part\@spart} %

\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne %
\refstepcounter{part} %
\addcontentsline{toc}{part}{\thepart %
\hspace{1em}#1}\else %
\addcontentsline{toc}{part}{#1}\fi %
{\parindent \z@ \raggedright
\interlinepenalty\@M
\ifnum \c@secnumdepth >\m@ne %
\Large \bf \partname~\thepart%
\par\nobreak %
\fi %
\huge \bf %
#2%
\markboth{}{}\par %
}\nobreak %
\vskip 3ex %
\@afterheading %
} %

\def\@spart#1{{\parindent \z@ \raggedright
\interlinepenalty\@M
\huge \bf
#1\par} %
\nobreak %
\vskip 3ex %
\@afterheading %
} %

\newcount\@indentflag \global\@indentflag=1 %
\newdimen\@eqtoeqnum \@eqtoeqnum=6pt %
\def\@indentamount{%
\ifcase\@indentflag 0pt\or\@centering\or0pt plus1fil\fi\relax
}
\def\FL{\global\@indentflag=0 }
\def\FR{\global\@indentflag=2 }

\newcounter{eqletter} \setcounter{eqletter}{0}

\def\@eqnnum{\hbox{\reset@font\rm(\theequation)}}
\let\make@eqnnum=\@eqnnum %
\def\eqnum#1{\dec@eqnnum \global\def\make@eqnnum{\reset@font\rm(#1)}%
\def\@currentlabel{#1}%
}
\def\inc@eqnnum{\addtocounter{equation}{1}}
\def\dec@eqnnum{\addtocounter{equation}{-1}}
\@definecounter{equation}%
\ifsecnumbers %
\@addtoreset{equation}{section} %
\def\theequation@prefix{\arabic{section}.} %
\else %
\def\theequation@prefix{}
\fi

\def\theequation{\theequation@prefix\arabic{equation}}%

\def\mathletters{%
\inc@eqnnum  \setcounter{eqletter}{0}%
\edef\@currentlabel{\theequation}%
\def\theequation{\theequation@prefix\arabic{equation}\alph{eqletter}}%
\def\inc@eqnnum{\addtocounter{eqletter}{1}}%
\def\dec@eqnnum{\addtocounter{eqletter}{-1}}%
}

\let\endmathletters\relax

\def\[{\relax
\ifmmode\@badmath\else\par\vskip-\lastskip\vskip\abovedisplayskip\fi
\hbox to\hsize\bgroup
\def\label##1{\@revmess{warning}{\string\label{##1} used
in \string\[\space environment after (\theequation)}}%
\hskip\@totalleftmargin\hskip\@indentamount$\displaystyle
}

\def\]{\relax
\ifmmode
$\hskip\@centering\egroup
\else
\@badmath
\fi
\vskip\belowdisplayskip
\global\@indentflag=1 %
\noindent\ignorespaces
}

\newbox\@testboxa
\newbox\@testboxb

\def\equation{\par\vskip-\lastskip\vskip\abovedisplayskip
\inc@eqnnum\let\@currentlabel=\theequation
\setbox\@testboxa=\hbox\bgroup\hskip\@totalleftmargin\hskip\@indentamount
\hbox\bgroup$\displaystyle
}

\def\endequation{$\egroup\hskip\@centering\egroup %
\setbox\@testboxb=\hbox{\make@eqnnum}%
\bgroup
\@tempdima\wd\@testboxa \advance\@tempdima by\wd\@testboxb
\ifcase\@indentflag
\advance\@tempdima by\@eqtoeqnum
\ifdim\@tempdima<\hsize %
\def\@tempa{0}%
\else
\def\@tempa{1}%
\fi
\or
\advance\@tempdima by2\@eqtoeqnum
\ifdim\@tempdima<\hsize %
\def\@tempa{0}%
\else %
\@tempdima\wd\@testboxa \advance\@tempdima by\wd\@testboxb
\advance\@tempdima by\@eqtoeqnum
\ifdim\@tempdima<\hsize %
\def\@tempa{0}%
\setbox\@testboxa\hbox{\hfill\box\@testboxa\kern\@eqtoeqnum}%
\else
\def\@tempa{1}%
\fi
\fi
\or
\advance\@tempdima by2\@eqtoeqnum
\ifdim\@tempdima<\hsize %
\def\@tempa{0}%
\setbox\@testboxb=\hbox{\kern\@eqtoeqnum\make@eqnnum}%
\else
\def\@tempa{1}%
\fi
\fi
\ifnum\@tempa=0 %
\hbox to\hsize{\unhbox\@testboxa\box\@testboxb}%
\else %
\vbox{\hbox to\hsize{\unhbox\@testboxa}%
\vskip6pt %
\hbox to\hsize{\hfil\box\@testboxb}}%
\fi
\egroup
\global\let\make@eqnnum\@eqnnum %
\vskip\belowdisplayskip\noindent\global\@indentflag=1 \global\@ignoretrue
}

\def\eqnarray{\par\vskip-\lastskip\vskip\abovedisplayskip
\inc@eqnnum\let\@currentlabel=\theequation
\global\@eqnswtrue\m@th
\global\@eqcnt\z@
\tabskip\@totalleftmargin\advance\tabskip by\@indentamount\let\\\@eqncr
\halign to\hsize\bgroup\hskip\@centering
$\displaystyle\tabskip\z@{##{}}$&\global\@eqcnt\@ne
\hfil${{}##{}}$\hfil
&\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil
\tabskip\@centering \if@eqnsw\phantom{\make@eqnnum\kern\@eqtoeqnum}\fi
&\llap{##}\tabskip\z@\cr}

\def\endeqnarray{%
\@@eqncr\egroup
\vskip\belowdisplayskip\noindent
\dec@eqnnum\global\@indentflag=1
\global\let\make@eqnnum\@eqnnum %
\global\@ignoretrue
}

\def\nonumber{\global\@eqnswfalse
\def\label##1{\@revmess{error}{\string\label{##1} used
with \string\nonumber\space before (\theequation)}}%
}

\def\@@eqncr{\let\@tempa\relax
\ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}%
\else \def\@tempa{&}\fi
\@tempa \if@eqnsw\make@eqnnum\inc@eqnnum\fi
\global\@eqnswtrue\global\@eqcnt\z@\global\let\make@eqnnum=\@eqnnum\cr
}

\@namedef{eqnarray*}{\def\@eqncr{\nonumber\@seqncr}%
\def\label##1{\@revmess{warning}{\string\label{##1} used
in eqnarray* environment before (\theequation)}}%
\eqnarray}

\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}

\def\tableofcontents{\section*{\contentsname
\@mkboth{\uppercase{\contentsname}}{\uppercase{\contentsname}}}%
\@starttoc{toc}}

\def\l@part#1#2{\addpenalty{\@secpenalty}%
\addvspace{2.25em plus\p@}%
\begingroup
\@tempdima 3em %
\parindent \z@ \rightskip \@pnumwidth %
\parfillskip -\@pnumwidth
{\large \bf %
\leavevmode %
#1\hfil \hbox to\@pnumwidth{\hss #2}}\par
\nobreak %
\endgroup}

\def\l@section#1#2{\addpenalty{\@secpenalty}%
\addvspace{1.0em plus\p@}%
\@tempdima 3.0em %
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\bf %
\leavevmode %
\advance\leftskip\@tempdima %
\hskip -\leftskip %
#1\nobreak\hfil \nobreak\hbox to\@pnumwidth{\hss #2}\par
\endgroup}

\def\l@subsection{\@dottedtocline{2}{3.0em}{2.0em}}
\def\l@subsubsection{\@dottedtocline{3}{5.0em}{1.5em}}
\def\l@paragraph{\@dottedtocline{4}{6.5em}{1.5em}}
\def\l@subparagraph{\@dottedtocline{5}{8.0em}{1.5em}}

%%% change the contents line

%%% Martin
%\def\listoffigures{\section*{\listfigurename
%\@mkboth{\uppercase{\listfigurename}}{\uppercase{\listfigurename}}}%
%\@starttoc{lof}}
\def\listoffigures{%
\ifsegabssty\else%
%\ifnum\c@figure>0%
\newpage\centerline{\bf\large\listfigurename}\@starttoc{lof}
%\fi
\fi%
}

%\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\def\l@figure#1#2{\noindent\figurename~#1}
\def\numberline#1#2{#1. #2\newline\newline}

\def\listoftables{
\ifsegabssty\else%
\section*{\listtablename\@mkboth
{\uppercase{\listtablename}}{\uppercase{\listtablename}}}%
\@starttoc{lot}
\fi%
}
\def\l@table#1#2{\tablename~#1}

\input segbib.sty

\newif\if@restonecol

\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35\p@\twocolumn[\section*{\indexname}]%
\@mkboth{\uppercase{\indexname}}{\uppercase{\indexname}}%
\thispagestyle{plain}\parindent\z@
\parskip\z@ plus.3\p@\relax\let\item\@idxitem}

\def\@idxitem{\par\hangindent 40\p@}

\def\subitem{\par\hangindent 40\p@ \hspace*{20\p@}}

\def\subsubitem{\par\hangindent 40\p@ \hspace*{30\p@}}

\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}

\def\indexspace{\par \vskip 10\p@ plus5\p@ minus3\p@\relax}

\long\def\@makefntext#1{\parindent 5pt\hsize\columnwidth\parskip0pt\relax
\small\def\strut{\vrule width0pt height0pt depth1.75pt\relax}%
$\m@th^{\@thefnmark}$#1}

\def\thefootnote{\fnsymbol{footnote}}

\def\@fnsymbol#1{\ifcase#1\or *\or \dagger\or \ddagger\or
\mathchar "278\or **\or \dagger\dagger
\or \ddagger\ddagger \or \mathchar "278 \mathchar "278\or
***\or\dagger\dagger\dagger\or\ddagger\ddagger\ddagger\or
\mathchar "278 \mathchar "278 \mathchar "278
\else\@ctrerr\fi\relax}

\setcounter{topnumber}{2}
\def\topfraction{.7}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.3}
\setcounter{totalnumber}{3}
\def\textfraction{.2}
\def\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

\long\def\@makecaption#1#2{%
\setbox\@testboxa\hbox{\outertabfalse %
\reset@font\small\rm#1\penalty10000\hskip.5em plus.2em\ignorespaces#2%
}%
\setbox\@testboxb\vbox{\hsize\@capwidth
\ifdim\wd\@testboxa<\hsize %
%%% Martin
%\hbox to\hsize{\hfil\box\@testboxa\hfil}%
%%%
\hbox to\hsize{\box\@testboxa\hfil}%
\else %
\small
\parindent \ifpreprintsty 1.5em \else 1em \fi
\unhbox\@testboxa\par
\fi
}%
\box\@testboxb
} %

\newcounter{figure}
\def\thefigure{\@arabic\c@figure}

\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename\penalty10000\hskip.3em plus .1em\relax\thefigure.}
\if@floats
\def\figure{\let\@capwidth\columnwidth\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\let\@capwidth\textwidth\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}
\else
\def\figure{%
\let\@capwidth\columnwidth
\ifsegabssty\else
\ifpreprintsty\iffirstfig
\newpage\global\firstfigfalse
\fi\clearpage\fi
\fi
\vskip1pc
\def\@captype{figure}%
\interlinepenalty10000 %
\@ifnextchar[{\@chuckoptarg}{}%
}%
\def\endfigure{\goodbreak\vskip1pc}%
\@namedef{figure*}{\figure}%
\@namedef{endfigure*}{\endfigure}%
\fi

\newcounter{table}
%%% Martin
%\def\thetable{\@Roman\c@table}
\def\thetable{\@arabic\c@table}
%%%

{\catcode`\.=13 %
\gdef.{\relax\egroup\def\@flag{1}\setbox1\hbox\bgroup}%
}%

\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename\penalty10000\hskip.3em plus .1em\relax\thetable.}
\if@floats
\def\table{%
\let\@capwidth\columnwidth \def\@tablenotes{}%
\global\tableontrue
\bgroup\parindent=0pt
\outertabtrue
\setcounter{tablenote}{0}%
\@float{table}%
}%
\def\endtable{%
\global\tableonfalse\global\outertabfalse
{\let\protect\relax\small\vskip2pt\@tablenotes\par}\xdef\@tablenotes{}%
\end@float\egroup
}%
\@namedef{table*}{%
\let\@capwidth\textwidth \def\@tablenotes{}%
\global\tableontrue
\bgroup\parindent=0pt
\outertabtrue
\setcounter{tablenote}{0}%
\@dblfloat{table}%
}
\@namedef{endtable*}{%
\global\tableonfalse\global\outertabfalse
{\let\protect\relax\small\vskip2pt\@tablenotes\par}\xdef\@tablenotes{}%
\end@dblfloat\egroup
}%
\else %
\def\table{%
\let\@capwidth\columnwidth \def\@tablenotes{}%
\iffirsttab
\global\firsttabfalse
\ifsegabssty\else
\ifpreprintsty{\newpage\centerline{\bf TABLES}}\fi\fi
\fi
\vskip1pc
\global\tableontrue
\bgroup\parindent=0pt
\outertabtrue
\setcounter{tablenote}{0}%
\def\@captype{table}%
\@ifnextchar[{\@chuckoptarg}{}%
}%
\def\endtable{%
\global\tableonfalse\global\outertabfalse
{\let\protect\relax\small\vskip2pt\@tablenotes\par}\xdef\@tablenotes{}%
\egroup
\vskip1pc plus 1filll \penalty-200 \vskip0pt plus -1filll
}%
\@namedef{table*}{\table}
\@namedef{endtable*}{\endtable}
\fi

\@definecounter{tablenote}
\def\thetablenote{\alph{tablenote}}
\def\@tablenotes{}

\def\@maketnmark{\leavevmode\hbox{$^{\reset@font\rm\@thetnmark}\m@th$}}

\def\tablenote{\@ifnextchar[{\@xtablenote}{\stepcounter{tablenote}%
\begingroup \def\protect{\noexpand\protect\noexpand}%
\xdef\@thetnmark{\thetablenote}\endgroup
\@tablenotemark\@tablenotetext}}

\def\@xtablenote[#1]{\begingroup \c@tablenote #1\relax
\def\protect{\noexpand\protect\noexpand}%
\xdef\@thetnmark{\thetablenote}\endgroup
\@tablenotemark\@tablenotetext}

\long\def\@tablenotetext#1{%
\bgroup
\iftableon\else
\@revmess{error}{tablenotes used outside a table environment,}%
\typeout{\space\space\space\space\space THEY ARE ARE BEING LOST!}%
\fi
\def\protect{\noexpand\protect\noexpand}%
\edef\@tempa{\@maketnmark}%
\expandafter\expandafter\expandafter
\gdef
\expandafter\expandafter\expandafter
\@tablenotes
\expandafter\expandafter\expandafter
{\expandafter\@tablenotes\expandafter\par\@tempa#1}%
\egroup
}

\def\tablenotemark{%
\@ifnextchar[{\@xtablenotemark}{\stepcounter{tablenote}%
\begingroup\def\protect{\noexpand\protect\noexpand}%
\xdef\@thetnmark{\thetablenote}\endgroup
\@tablenotemark}}

\def\@xtablenotemark[#1]{\begingroup \c@tablenote #1\relax
\def\protect{\noexpand\protect\noexpand}%
\xdef\@thetnmark{\thetablenote}\endgroup \@tablenotemark}

\def\@tablenotemark{\leavevmode\ifhmode
\edef\@x@sf{\the\spacefactor}\fi \@maketnmark
\ifhmode\spacefactor\@x@sf\fi\relax}

\def\tablenotetext{\@ifnextchar [{\@xtablenotetext}%
{\begingroup
\def\protect{\noexpand\protect\noexpand}%
\xdef\@thetnmark{\thetablenote}\endgroup
\@tablenotetext}}

\def\@xtablenotetext[#1]{\begingroup \c@tablenote #1\relax
\def\protect{\noexpand\protect\noexpand}%
\xdef\@thetnmark{\thetablenote}\endgroup \@tablenotetext}

\let\tableline\hline

\newdimen\@Ldec \newdimen\@Rdec

\def\dec #1.#2 {\hbox to\@Ldec{\hss#1}\def\test{#2}%
\ifx\test\empty\hbox to\@Rdec{\hfill}\else\hbox to\@Rdec{.#2\hss}\fi
}

\def\setdec #1.#2 {\relax%
\bgroup
\setbox0\hbox{\kern1pt\relax#1}\setbox1\hbox{\kern1pt\relax#2}%
\global\@Ldec\wd0\global\@Rdec\wd1%
\egroup
}

\setdec 000.000 %

\@temptokena={\relax\egroup
\ifnum\@flag=1
\setbox0\hbox{\unhbox0.\unhbox1}%
\fi
\gdef\@flag{1}\setbox1\hbox\bgroup
}%
{\catcode`\.=13\let.\relax
\xdef\@defdot{\def.{\the\@temptokena}}
}

\@temptokena={.}
{\catcode`\.=13
\ifx.\undefined %
\xdef.{\the\@temptokena}
\fi
}

\def\@activatedots{%
\def\@startcenterdot{\begingroup
\relax\gdef\@flag{0 }
\catcode`\.=13\@defdot
\setbox0\hbox\bgroup\ignorespaces}%
\def\@endcenterdot{\unskip\egroup\catcode`\.=12
\ifnum\@flag=0 %
\box0
\else %
\ifdim\wd0=0pt %
 .\box1
\else
\ifdim\wd1=0pt %
\setbox1=\hbox{\phantom{.\copy0}}\box0\box1
\else %
\ifdim\wd0>\wd1
\setbox1\hbox to\wd0{\box1\hfil}%
\else
\setbox0\hbox to\wd1{\hfil\box0}%
\fi
\box0.\box1
\fi
\fi
\fi
\endgroup}%
}

\def\apstable@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
height\arraystretch \ht\strutbox
depth\arraystretch \dp\strutbox
width\z@}\@mkpream{#2}\edef\@preamble{\tabskip\z@ plus 1fil\halign
to\@capwidth%
\bgroup \tabskip\z@ plus1fill \@arstrut
\@preamble\hskip-\tabcolsep \tabskip\z@ plus 1fil
\cr}%
\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox%
\bgroup\let\par\relax\outertabfalse%
\let\@sharp##\let\protect\relax
\@activatedots
\lineskip\z@\baselineskip\z@\@preamble}

\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
height\arraystretch \ht\strutbox
depth\arraystretch \dp\strutbox
width\z@}\@mkpream{#2}\edef\@preamble{\halign\noexpand\@halignto
\bgroup\tabskip\z@\@arstrut\@preamble
\tabskip\z@\cr}%
\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox%
\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi%
\bgroup\let\par\relax%
\let\@sharp##\let\protect\relax
\@activatedots
\lineskip\z@\baselineskip\z@\@preamble}

\def\@arrayclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
\or \or \@addamp \or
\@acolampacol \or \@firstampfalse \@acol \fi
\edef\@preamble{\@preamble
\ifcase \@chnum
\hfil$\relax\@sharp$\hfil \or $\relax\@sharp$\hfil
\or \hfil$\relax\@sharp$\or
\hfil$\relax\@sharp$\hfil \fi}}

\def\@tabclassz{\ifcase \@lastchclass\@acolampacol
\or \@ampacol \or \or \or \@addamp \or \@acolampacol\or
\@firstampfalse \new@tabacol \fi
\edef\@preamble{\@preamble{%
\ifcase \@chnum
\hfil\ignorespaces\@sharp\unskip\hfil
\or \ignorespaces\@sharp\unskip\hfil
\or \hfil\hskip\z@ \ignorespaces\@sharp\unskip
\or\hfil\@startcenterdot\@sharp\@endcenterdot\hfil
\fi}}}

\def\@tabclassiv{\@addtopreamble\@nextchar}

\let\tabbodyfont\small
\def\squeezetable{\let\tabbodyfont\scriptsize}

\def\tabular{\def\@halignto{}\@tabular}

\newif\ifoutertab
\global\outertabfalse

\def\@tabular{%
\ifoutertab
\tabbodyfont\global\@newlistfalse\bgroup
\else
\leavevmode\hbox\bgroup$%
\fi
\let\@acol\@tabacol
\let\@classz\@tabclassz
\let\@classiv\@tabclassiv \let\\\@tabularcr
\ifoutertab
\if@quasitable\else
\vskip2pt\hrule width\@capwidth\vskip2pt\hrule width\@capwidth\vskip2pt
\fi
\expandafter\apstable@tabarray
\else
\expandafter\@tabarray
\fi
}

\def\apstable@tabarray{%
\m@th\@ifnextchar[{\apstable@array}{\apstable@array[c]}%
}

\def\endtabular{\crcr\egroup\egroup
\ifoutertab
\if@quasitable\else
\vskip2pt\hrule width\@capwidth\vskip2pt\hrule width\@capwidth\vskip2pt
\fi
\else
$%
\fi \egroup
}

\def\new@tabacol{\edef\@preamble{\@preamble \hskip0pt%
}}

\newif\iftableon

\def\@mkpream#1{\@firstamptrue\@lastchclass6
\def\@preamble{}%
\def\protect{\noexpand\protect\noexpand}\let\@sharp\relax
\let\@startpbox\relax\let\@endpbox\relax
\let\@startcenterdot\relax \let\@endcenterdot\relax
\@expast{#1}\expandafter\@tfor \expandafter
\@nextchar \expandafter:\expandafter=\@tempa\do{\@testpach\@nextchar
\ifcase \@chclass \@classz \or \@classi \or \@classii \or \@classiii
\or \@classiv \or\@classv \fi%
\iftableon\ifoutertab %
\ifnum\@chclass=4
\@addtopreamble{\tabskip\z@}%
\else
\ifnum\@lastchclass=4
\@addtopreamble{\tabskip\z@ plus1fill}%
\fi
\fi
\fi\fi
\@lastchclass\@chclass}%
\ifcase \@lastchclass \@acol
\or \or \@preamerr \@ne\or \@preamerr \tw@\or \or \@acol \fi}

\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4 \else
\ifnum \@lastchclass=3 5 \else
\z@ \if #1c\@chnum \z@ \else
\if #1l\@chnum \@ne \else
\if #1r\@chnum \tw@ \else
\if #1d\@chnum 3 \else %
\@chclass \if #1|\@ne \else
\if #1@\tw@ \else
\if #1p3 \else \z@ \@preamerr 0\fi
\fi  \fi  \fi  \fi  \fi  \fi \fi %
\fi}

\newif\if@quasitable
\@quasitablefalse

\def\quasitable{%
\@quasitabletrue
\par\vskip\topsep \bgroup
\def\caption##1{\@revmess{warning}{Captions are not supported
for quasitables.}\@revmess{warning}{No caption was set.}}%
\def\tablenotes##1{\@revmess{warning}{Tablenotes are not
supported for quasitables.}%
\@revmess{warning}{No tablenotes were set.}}%
\let\@capwidth\columnwidth
\tableontrue\outertabtrue\parindent0pt\relax}

\def\endquasitable{\par\egroup\vskip\topsep\noindent
\@quasitablefalse \global\@ignoretrue}

\def\@authoraddress{}  \def\@title{} \def\@date{} \def\@preprint{}
\def\and{\unskip, }

\def\preprint#1{%
\ifpreprintsty
\def\@preprint{\noindent\hfill\hbox{#1}\vskip 10pt}%
\fi
}

\def\title#1{\gdef\@title{{\large\bf\centering\ignorespaces#1\vskip2.5pt}}}

%%% Martin   this author stuff is all new
\newcount\authorcount \authorcount=0
\newcount\tempcount   \newcount\authornum

\def\author#1{%
\global\advance\authorcount by 1
\expandafter\gdef\csname author\romannumeral\authorcount\endcsname
{\bf\ignorespaces#1}%
}

\newcount\addresscount \addresscount=0
\newcount\addressnum

\def\address#1{\global\advance\addresscount by 1
\expandafter\gdef\csname address\romannumeral\addresscount\endcsname
{\ignorespaces#1}}

\def\@authoraddress{%
\ifpreprintsty
%
\def\@putauthor{{\csname author\romannumeral\authornum\endcsname}\vskip 1.5pc}%
%
\def\@putaddress{{\it\csname address\romannumeral\authornum\endcsname}\vskip 1.5pc}%
\else
%
\def\@putauthor{\csname author\romannumeral\authornum\endcsname}%
%
\def\@putaddress{\footnote{\csname address\romannumeral\authornum\endcsname}}%
%
\fi
%
\rm\centering\vskip1.5pc% \nobreak
\global\addressnum=0
\global\authornum=0
\global\tempcount=\authorcount
\ifnum\tempcount>1 \advance\tempcount by -1 \fi
\ifpreprintsty{%
\loop \ifnum\authornum<\tempcount \global\advance\authornum by 1%
\@putauthor%
\ifnum\authorcount=\addresscount%
\@putaddress%
\fi%
\repeat%
}\else{%
\loop\ifnum\authornum<\tempcount \global\advance\authornum by 1%
\ifnum\authornum=0\else{, }\fi%
\@putauthor%
\ifnum\authorcount=\addresscount%
\@putaddress%
\fi
\repeat%
}\fi%
%
\loop\ifnum\authornum<\authorcount\global\advance\authornum by 1%
\ifpreprintsty{%
\@putauthor
\ifnum\authornum=\addresscount%
\@putaddress\fi
\ifnum\authornum>\addresscount%
\advance\addresscount by 1 \advance\addressnum by 1%
\@putaddress\fi
}\else{%
{ and }%
\@putauthor%
\ifnum\authornum=\addresscount%
\@putaddress\fi
\ifnum\authornum>\addresscount%
\advance\addresscount by 1 \advance\addressnum by 1%
\@putaddress\fi
}\fi%
\repeat%
\global\addresscount=0\global\authorcount=0%
\par%
}


\def\date#1{\gdef\@date{{\small\rm\centering(\ignorespaces#1\unskip)\par}}}

\def\maketitle{\par
\begingroup
\let\cite\@bylinecite
\def\thefootnote{\fnsymbol{footnote}}%
\if@twocolumn
\twocolumn[\@maketitle\vskip2pc]%
\else
\newpage
\global\@topnum\z@ %
\@maketitle
\fi
\thispagestyle{plain}\@thanks
\endgroup
\def\thefootnote{\arabic{footnote}}%
\setcounter{footnote}{0}%
\let\maketitle\relax \let\@maketitle\relax
\let\@thanks\relax \let\@authoraddress\relax \let\@title\relax
\let\@date\relax \let\thanks\relax
}

\def\@maketitle{%
\@preprint
\@title
\ifdim\prevdepth=-1000pt \prevdepth0pt\fi
\@authoraddress
\@date
\ifpreprintsty
\else
%\footnotetext{\copyright \number\year \ Society of Exploration Geophysicists. All rights reserved.}
\fi
\ifsegabssty
\vskip 1in
{\boxit{\bf Cut and paste the follwing pages 
onto the official SEG expanded abstract form.}}
\if@legalsize
\global\def\@firstlongpage{4}
\vskip 1in
\begin{center}\boxit{Remember to use 8.5 x 14 inch (legalsize) paper for the printout! }\end{center}
\else
\boxit{If you have 8.5 x 14 inch paper available, we suggest you rerun
the document using the ``legalsize'' option: 
{\bf $\backslash$documentstyle~[seg,abstract,legalsize]~\{revtex\}}}
\fi
\newpage\fi
}

\def\abstract{\par
\begin{center}%
%%% Martin Karrenbach
%{\bf \abstractname\par}%
{\abstractname\par}%
\end{center}%
\bgroup
\ifdim\prevdepth=-1000pt \prevdepth0pt\fi
%%% Martin              abstract section is like a normal section, maybe boxed
\hsize\columnwidth%  just spans the column
%\if@twocolumn\leftskip=0.03\columnwidth \rightskip\leftskip\else\fi
%\hsize\textwidth%  make it span two columns
\if@twocolumn\leftskip=0.02\textwidth \rightskip\leftskip\else\fi
%%%
\dimen0=-\prevdepth \advance\dimen0 by17.5pt \nointerlineskip
%\small\vrule width 0pt height\dimen0 \relax
\vrule width 0pt height\dimen0 \relax 
\indent
}

%\def\endabstract{\par\egroup}
\def\endabstract{\par\egroup\ifpreprintsty\else\twocolumn\fi}


\global\let\ifdraft\iffalse \def\draft{\global\let\ifdraft\iftrue}

\def\pacs#1{\par %
\bgroup
\hsize\columnwidth \parindent0pt
\if@twocolumn\else\leftskip=0.10753\textwidth \rightskip\leftskip\fi
\ifdim\prevdepth=-1000pt \prevdepth0pt\fi
\dimen0=-\prevdepth \advance\dimen0 by20pt\nointerlineskip
\vbox to28pt{\small\vrule height\dimen0 width0pt\relax\ifdraft#1\fi\vfill}%
\egroup
\if@twocolumn\vskip1pc\fi
\ifpreprintsty
\penalty10000\vfill
\hbox to\columnwidth{\hfil Typeset using {REV\TeX}}\newpage
\fi
}

\def\keywords#1{%
\@revmess{warning}{APS doesn't use keywords. I'll ignore them.}%
}

\mark{{}{}} %

\def\subsectionmark#1{\markright {#1}}

\if@twoside %
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{}\def\@evenfoot{}%
\def\@evenhead{\rm \thepage\hfil \sl \leftmark}%
\def\@oddhead{{\sl \rightmark}\hfil \rm\thepage}%
\def\sectionmark##1{\markboth {\uppercase{\ifnum \c@secnumdepth >\z@
\thesection\hskip 1em\relax \fi ##1}}{}}%
\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
\thesubsection\hskip 1em\relax \fi ##1}}}
\else %
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{}\def\@evenfoot{}%
\def\@oddhead{{\sl \rightmark}\hfil \rm\thepage}%
\def\sectionmark##1{\markright {\uppercase{\ifnum \c@secnumdepth >\z@
\thesection\hskip 1em\relax \fi ##1}}}}
%%%
\fi

\def\ps@myheadings{\let\@mkboth\@gobbletwo
\def\@oddhead{{\sl\rightmark}\hfil \rm\thepage}%
\def\@oddfoot{}\def\@evenhead{\rm \thepage\hfil\sl\leftmark}%
\def\@evenfoot{}\def\sectionmark##1{}\def\subsectionmark##1{}}

\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}

\ps@plain %
\pagenumbering{arabic} %
\if@twoside\else\raggedbottom\fi %
\if@twocolumn %
\twocolumn
\sloppy
\raggedbottom %
\else
\sloppy
\onecolumn %
\raggedbottom %
\fi

%\if@titlepage
%\@@input titlepag.sty\relax
%\fi

% more goodies for SEG %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% draw a multiline box
\def\boxit#1{\bigskip\vbox{\hrule\hbox{\advance\hsize by-20pt\vrule\kern10pt
\vbox{\medskip\kern5pt#1\bigskip\kern5pt}\kern10pt\vrule}\hrule}}

% smart tensor/vector symbols

% picture environment keeps its old definition
\let\@OrigLatexVector=\vector
\let\@OrigLatexPicture=\picture

% now redefine vector
\def\realbold#1{{\mbox{\boldmath $\bf #1$}}}
\def\@undertilde#1{\oalign{{\realbold{#1}}\crcr\hidewidth
\vbox to .2ex{\hbox{\bf\char126}\vss}\hidewidth}}

\def\vector#1{\ifpreprintsty\@undertilde{#1}\else\realbold{#1}\fi}
\def\tensor#1{\@undertilde{\ifpreprintsty\@undertilde{#1}\else\realbold{#1}\fi}}

\def\picture(#1,#2){%
\let\segvector=\vector%
\let\segtensor=\tensor%
\let\vector=\@OrigLatexVector%
\@OrigLatexPicture(#1,#2)}


% for picture environment we want original latex vector command
% unfortunately revtex has redefined that one

\def\@setupverbatim{
  \tt\baselineskip= 8.5truept\lineskip=1truept
  \lineskiplimit=1truept\topskip=0pt
  \def\par{\leavevmode\egroup\box0\endgraf}
  \obeylines \uncatcodespecials \obeyspaces
  \catcode`\`=\active \catcode`\^^I=\active
  \everypar{
  \startbox}}
\newdimen\w \setbox0=\hbox{\tt\space} \w=8\wd0
\def\startbox{\setbox0=\hbox\bgroup}
{\catcode`\^^I=\active
  \gdef^^I{\leavevmode\egroup
    \dimen0=\wd0
    \divide\dimen0 by\w
    \multiply\dimen0 by\w
    \advance\dimen0 by\w
    \wd0=\dimen0 \box0 \startbox}}
{\obeyspaces\global\let =\ }
{\catcode`\`=\active \gdef`{\relax\lq}}

\def\listing#1{%
\par\bigskip%
\begingroup%
\parskip=0pt\setupverbatim\input{#1}%
\endgroup\bigskip%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% figure inclusion macros  rely on having epsf.sty installed
%%% get it from the dvips distribution

% try to include epsf.sty

\input epsf.sty

% \plot{label}{width=,height=}{caption}

\def\@plot@set@parms#1=#2,{\@namedef{@plot@#1}{#2}}%
\def\@plot@init@parms{%
\def\@plot@bbllx{}\def\@plot@bblly{}%
\def\@plot@bburx{}\def\@plot@bbury{}%
\def\@plot@height{0pt}%
\def\@plot@width{\columnwidth}%
\def\@plot@clip{}}%
\def\@plot@parse@parms#1{%
\@for\@plot@:=#1\do%
{\expandafter\@plot@set@parms\@plot@,}}%

\def\@call@epsf#1#2#3{%
\global\newdimen\@darg%
\@darg=#2\relax\epsfxsize=\@darg%
\@darg=#3\relax\epsfysize=\@darg%
\epsfbox{#1}%
}

% check if a file exists and set a flag accordingly
\newread\@plotfilein
\newif\if@plotfileok
\def\@checkfilein#1{
\openin\@plotfilein=#1
\ifeof\@plotfilein{%
\global\@plotfileokfalse%
\typeout{Warning: No Figure File `#1'.}
}\else{%
\global\@plotfileoktrue%
\typeout{Found File: `#1'.}
}\fi%
\closein\@plotfilein%
}

%%%% SEG plot macro %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\dosegplotit#1#2#3{%
\@plot@init@parms\@plot@parse@parms{#2}%
\begin{figure}%
% here we can have different cases for plot types, currently only epsf
\@checkfilein{#1.ps}
\if@plotfileok
%
\@call@epsf{#1.ps}{\@plot@width}{\@plot@height}%
%
\fi
\setlength{\normalbaselineskip}{.8\normalbaselineskip}%
\caption{#3}%
\label{fig:#1}%
\end{figure}%
}
%
% figures are flushed at the end of the document if in manuscript mode
%
\newtoks\@temppptokena
%
\ifflushfiguretoend
%\ifpreprintsty
\newwrite\plotaux
%
\if@filesw\immediate\openout\plotaux=\jobname.plt%
\immediate\write\plotaux{\relax}\fi%
%%
%
\def\addplotline#1#2#3{%
\if@filesw\begingroup%
%
\addtocounter{flushfig}{1}%
\ifappendixon\edef\@flushfigure{\Alph{section}-\@arabic\c@flushfig}%
\else\edef\@flushfigure{\@arabic\c@flushfig}\fi%
%
\edef\@tempppa{\immediate\write\plotaux{\string\def\string\thefigure{\@flushfigure}}}%
%
\@tempppa%
% works but does not completely expand
\edef\argaa{#1}\edef\argbb{#2}%
\@temppptokena{#3}
\def\@tempppa{\immediate\write\plotaux{\string\newpage\string\dosegplotit{\argaa}{\argbb}{\the\@temppptokena}}}\@tempppa%
\if@nobreak \ifvmode\nobreak\fi\fi\endgroup\fi}%
%
\def\plot#1#2#3{\addplotline{#1}{#2}{#3}}%
\else%
\def\plot#1#2#3{\dosegplotit{#1}{#2}{#3}}%
\fi%
%
% now do the same for figure environment
%
\def\makeinnocent#1{\catcode`#1=12 }
\def\csarg#1#2{\expandafter#1\csname#2\endcsname}

\def\WriteEnvironmentToFile#1{\begingroup
    \def\CurrentEnvironment{#1}%
    \let\do\makeinnocent \dospecials
    \makeinnocent\^^L% and whatever other special cases
    \endlinechar`\^^M \catcode`\^^M=12 \xEnvironment}

{\catcode`\^^M=12 \endlinechar=-1 %
 \gdef\xEnvironment#1^^M{\def\test{#1}
      \csarg\ifx{PlainEnd\CurrentEnvironment Test}\test
          \let\next\endgroup
      \else \csarg\ifx{LaLaEnd\CurrentEnvironment Test}\test
            \edef\next{\endgroup\noexpand\end{\CurrentEnvironment}}
      \else \let\next\xEnvironment %
            \immediate\write\plotaux{#1}
      \fi\fi \next}
}

\def\@includefigure{%
\@ifundefined{figure}{%
\def\figure{}%
\def\figure{}%
}{%
\@ifundefined{figure@orig}{}{%
\let\figure=\figure@orig%
\let\endfigure=\endfigure@orig%
% and also undefine #1@orig and end#1@orig
}}}

\def\@excludefigure{%
\@ifundefined{figure}{}{%
\let\figure@orig\figure%
\let\endfigure@orig\endfigure%
}%
\def\figure{%
%
\addtocounter{flushfig}{1}%
\ifappendixon\edef\@flushfigure{\Alph{section}-\@arabic\c@flushfig}%
\else\edef\@flushfigure{\@arabic\c@flushfig}\fi%
%
\edef\@tempppa{\immediate\write\plotaux{\string\def\string\thefigure{\@flushfigure}}}%
%
\@tempppa%
%
\edef\@tempppa{\immediate\write\plotaux{\string\begin\string{figure\string}}}%
\@tempppa%
\WriteEnvironmentToFile{figure}%
}%
\def\endfigure{%
\edef\@tempppa{\immediate\write\plotaux{\string\end\string{figure\string}}}%
\@tempppa%
}%
{\escapechar=-1\relax%
\csarg\xdef{PlainEndfigureTest}{\string\\endfigure}%
\csarg\xdef{LaLaEndfigureTest}{\string\\end\string\{figure\string\}}%
}}%
%
\ifsegabssty\else\ifpreprintsty\@excludefigure\fi\fi
%\ifpreprintsty\@excludefigure\fi
%
% redefine enddocument to put the figures if in preprintsty
%
\def\enddocument{%
\ifflushfiguretoend
\immediate\closeout\plotaux\@includefigure\listoffigures\input\jobname.plt\fi
\@checkend{document}\clearpage\begingroup%
\if@filesw \immediate\closeout\@mainaux%
\def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
\def\bibcite{\@testdef b}\@tempswafalse \makeatletter\input \jobname.aux%
\if@tempswa \@warning{Label(s) may have changed.  Rerun to get
cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
\makeatother
%
% ****** End of file seg.sty ******
