%\filename{refmacros.tex}
%\edited{last by stolfi on Sun Jul 26 11:05:49 1987}

% Macros for bibliographic reference lists
% Roughly compatible with the GS catalog format (bibmacros.tex)
% To be \input by commonformat.tex

\catcode`@=11 \endlinechar=-1

  \message{references ...}

  % References to bibliography

    % Usage: ... this result was also proved by R. Foobar\r[Foo85,Foo86c].

    \def\r[#1]{{$^{[#1]}$}}

  % Bibliography entries:

    % Usage:
    %   \ref\r[\here\Ref{1}] \date{...}
    %     \auth{Boojum, C. D.}
    %     \tit{Salting jubjubs in glue.}
    %     \pub{J. of Beavers and Butchers V. 1 N. 357 (1999).}
    %     \rem{Charming; reminds me of smiles and soap.}
    %     \top{bandersnatch, jubjub, glue, railroad bonds.}
    %   \endref

    % Items \date, \rem, \top are optional.
    % Inside a reference, characters
    % < and > are ignored; use \gtr and \lss instead.
    
    \newif\ifrefcrunch \refcrunchfalse 
    
    % Set \refcrunchtrue to omit line breaks between \auth, \tit, \pub.
    
    \newglue\refvglue % extra vertical skip between references
    \newdimen\refindent % indentation of references
    \newdimen\refremindent % indentation of reference remarks

    {\catcode`\<=\active
      \gdef\ignoreanglebrackets{\catcode`\<=\active\def<##1>{##1}}
    }

    \def\ref\r[#1]{\par\penalty-400\vskip\refvglue
      \begingroup
        \leftglue=\refindent
        \parindent=0pt
        \hfuzz=10pt
        \hmode
        \hbox to 0pt{\hss[#1]\quad}
        \ignoreanglebrackets
        \let\par=\relax      % ignore blank lines between fields
        \def\ref{\endref\ref}% in case \endref is missing.
      }

    \def\endref{\endgraf\endgroup}
   
    \def\date#1{\gdef\bibdate{#1}}

    \def\moddate{} % for compatibility

    \def\auth#1{\unskip{\rm #1:}}

    \def\tit#1{\unskip
      \ifrefcrunch{\quad}\hbreak\suggested\else\brk\fi
      {\bf #1}
    }

    \newcount\pubcount
    \def\pubno{[\number\pubcount] }
    \def\pubit#1{{\rm[#1]}}
    \def\missing{} 

     \def\pub#1{
      \ifrefcrunch
        { }\hbreak\suggested
      \else
        \ifnum\pubcount>0
          { }\hbreak\suggested
        \else
          \unskip\brk
        \fi
      \fi
      \advance\pubcount by 1{\rm #1}
    }

\catcode`@=12 \endlinechar=`\^^M

% END

