% Displayed elements: notes etc., and also lists.
% Gary Houston.

% Notes.

\def\fps@note{hbtp}
\def\ftype@note{4}
\def\ext@note{notes}
\def\fnum@note{}

% This macro takes two arguments: the element name, which can be used to
% the select style of note, and the note text.
% Fails if the note contains lines of program code.  See
% Jeremy Gibbons, TeX and TUG News, Vol. 2, No. 4, 1993 for a solution
% which does not work here (due to the \protect and the \if.)
\long\def\note#1#2{{\protect\@note{#1}{#2}}}
\long\def\@note#1#2{%
  \def\el@ment{FN}\def\@arg{#1}%
  \ifx\el@ment\@arg
    \footnote{#2}%
  \else
    \footnotemark
    \edef\@currentlabel{\@thefnmark}%
    \@float{note}\rm\parindent 1em\noindent
    \hbox to 1.8em{\hss$\m@th^{\@thefnmark}$}#2\end@float
  \fi
}

% First argument gives the "resp" attribute -- may be empty.
\long\def\annotate#1#2{{\protect\@annotate{#1}{#2}}}
\long\def\@annotate#1#2{%
    \footnotemark
    \edef\@currentlabel{\@thefnmark}%
    \@float{note}\rm\parindent 1em\noindent
    \hbox to 1.8em{\hss$\m@th^{\@thefnmark}$}%
    \ifx\empty#1\else#1: \fi
    #2\end@float
}

% Program listings, more like Texinfo @example than LaTeX verbatim.
\def\tie{\penalty 10000\ }
{\obeyspaces\gdef\sepspaces{\obeyspaces\let =\tie}}
\def\codepar{\leavevmode\@par}

\def\listing#1{\par\vspace{\topsep}\noindent
  \null % Without this, the \parskip below would affect the last \par.
  \begingroup
  \tt\frenchspacing
  \let\par=\codepar
  \obeylines
  \sepspaces
  \parskip = 0pt
  \parindent = 0pt
  \emergencystretch = 0pt
  \@gobble % Ignore the following carriage return.
}

\def\endlisting{\vspace{\topsep}\endgroup} % \par is already present.

% This belongs logically in a gflist.sty file, but it's too trivial.
\def\simplelist{\list{}{}}
\def\endsimplelist{\endlist}
