% Displayed elements: notes etc., and also lists.
% Copyright (C) 1993, 1994 Gary Houston
% This program may be copied and modified under the terms of the 
% GNU General Public License version 2.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gfdisplay}[1994/08/13 gf displayed text defaults]

% Notes.
\newcommand{\fps@note}{hbtp}
\newcommand{\ftype@note}{4}
\newcommand{\ext@note}{notes}
\newcommand{\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 failed with LaTeX 2.09: untested with 2e.
\DeclareRobustCommand{\note}[2]
 {\def\el@ment{FN}\def\@arg{#1}%
  \ifx\el@ment\@arg
    \footnote{#2}%
  \else
    \footnotemark
    \edef\@currentlabel{\@thefnmark}%
    \@float{note}\normalfont\parindent 1em\noindent
    \makebox[1.8em][r]{$\m@th^{\@thefnmark}$}#2\end@float
  \fi
 }

% First argument gives the "resp" attribute -- may be empty.
\DeclareRobustCommand{\annotate}[2]
 {\footnotemark
  \edef\@currentlabel{\@thefnmark}%
  \@float{note}\normalfont\parindent 1em\noindent
  \makebox[1.8em][r]{$\m@th^{\@thefnmark}$}%
  \ifx\empty#1\else#1: \fi
  #2\end@float
 }

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

\newenvironment{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.
 }
 {\vspace{\topsep}\endgroup
 } % \par is already present.

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