% This is a LaTeX2e package for the UKTUG FAQ document.
%
\ProvidesPackage{faq}[1994/10/15 UK TUG package for TeX FAQ]
%
% uses production LaTeX 2e commands
\NeedsTeXFormat{LaTeX2e}[1994/06/01] 
%
% version 0.1  RF  1994/09/26
%         0.2  RF  1994/10/09-15
%         0.3  RF  1994/10/16 (after suggestions from Alan Jeffrey)
%         0.4  RF  1994/10/22
%
\def\fileversion{0.6}
\def\filedate{1994/10/29}
%
\typeout{UK TUG FAQ macros v\fileversion, \filedate}
%
% what fonts are we going to typeset in?
\InputIfFileExists{faqfont.cfg}%
      {\typeout{FAQ -- loading font configuration file faqfont.cfg}}%
      {\RequirePackage{times}%
%      % stretchability recommendations from psnfss2e.tex
%      \tolerance800
%      \emergencystretch2em
%      \doublehyphendemerits5000
%      \hfuzz0pt
%      \leftskip0pt minus 1pt
%      \rightskip0pt minus 1pt
%      % use cmtt for typewriter rather than Cou-beastly-rier
       \renewcommand{\ttdefault}{cmtt}}
%
% general support
%\RequirePackage{calc}
%
% code for handling logo font
\RequirePackage{mflogo}
%
% get texnames package (as amended)
\RequirePackage{texnames}
%
% ifthenelse for the undefined references
\RequirePackage{ifthen}
%
% we define html only stuff using Eijkhout's package
\RequirePackage{comment}
\excludecomment{htmlversion}
%
% it proves that, for Alan's stuff, the following needs to have been
% done _before_ we define the macros
\RequirePackage{shortvrb}
\MakeShortVerb{\|}
%
% the Baskerville and other logos
\providecommand\BV{\emph{Baskerville}}
\providecommand\DANTE{DANTE}
\providecommand\MSDOS{MS-DOS}
\providecommand\CDROM{CD-ROM}
\providecommand\TeXXeT{\TeX-{}-X\lower.5ex\hbox{E}\kern-.1667emT\spacefactor1000 }
\providecommand\MLTeX{ML-\TeX}
%
% The NTS and eTeX (and for consistency Eplain) logos
\DeclareRobustCommand\NTS{{\the\textfont2 N}\lower.5ex\hbox
    {\the\textfont2 T}{\the\textfont2 S}}
\DeclareRobustCommand\eTeX{{$\varepsilon$}-\TeX}
\DeclareRobustCommand\Eplain{Eplain}
%
% Other odds and ends (appear differently in TeX and http or plain
% text
\DeclareRobustCommand\WYSIWYG{\textsc{wysiwyg}}
%
% Command for doing `square one' :-}
\newcommand\sqfbox[1]{\framebox{\makebox[\totalheight]{#1\/}}}
%
% 2e's LaTeX logo sets the A in scripstyle jammed up to the top of the T; it
% also has the advantage that it's set in the same font as the
% surrounding text.  However, the esteemed bbeeton says the logo looks
% "squidge awful" in italic text (I agree; and the same is true of its
% behaviour in slanted text)
%
% So here's a version that allows for the slant of the leading L
\DeclareRobustCommand{\LaTeX}{L%
        {\setbox0\hbox{T}%
         \setbox\@tempboxa\hbox{$\m@th$%
                                \csname S@\f@size\endcsname
                                \fontsize\sf@size\z@
                                \math@fontsfalse\selectfont
                                A}%
         \@tempdima\ht0
         \advance\@tempdima-\ht\@tempboxa
         \@tempdima\strip@pt\fontdimen1\font\@tempdima
         \advance\@tempdima-.36em
         \kern\@tempdima
         \vbox to\ht0{\box\@tempboxa
                      \vss}%
        }%
        \kern-.15em
        \TeX}
%
% A command which sets some text in typewriter, with the hyphenchar 
% temporarily set to its first argument \FAQverb\HYPHEN{TEXT}.
% NB: This requires no catcode hackery, so should work inside moving 
% arguments.  It will, however, produce spurious spaces after CSs, and 
% won't allow brace-unmatched input.  It also won't survive going into a 
% moving argument if \HYPHEN won't.
%
\let\FAQverbFamily\ttfamily
\DeclareRobustCommand{\FAQverb}[2]{{%
    \ifvmode\leavevmode\fi
    \lefthyphenmin=256\setlanguage\language
    \FAQverbFamily\hyphenchar\the\font`#1\relax
    \def\@tempa{#2}%
    \expandafter\@faq@strip\meaning\@tempa\@faq@strip
    \hyphenchar\the\font\m@ne
}\setlanguage\language}
\def\@faq@strip#1->#2\@faq@strip{#2}
%
% Document markup:
%
\makeatother   % because @ is a delimiter here, it had better have the
               % same catcode as it will when the macro's invoked
\def\Email|#1@#2|{\FAQverb\-{#1@}\penalty10\FAQverb\.{#2}} % email
\makeatletter
\def\FTP|#1|{\FAQverb\.{#1}}                               % FTP site
\def\File|#1|{\FAQverb\/{#1}}                              % file name
\def\CTAN{\FAQverb\/}                                      % CTAN path
\def\Newsgroup|#1|{\FAQverb\.{#1}}                         % newsgroup
\def\URL|#1://#2/#3|{\FAQverb\.{#1://#2/}\penalty10\FAQverb\/{#3}}
\def\path|#1|{\FAQverb\/{#1}}                              % generic path
%
% same game, slightly different style
\def\ProgName|#1|{%                                        % program name
                  {%
                   \def\FAQverbFamily{\rmfamily\mdseries\itshape}%
                   \FAQverb\_{#1}\/%
                  }%
                 }
%
% ISBN references
\def\ISBN#1{\mbox{ISBN}~#1}
%
% have we read the CTAN references?
\newif\ifnotreadCTAN        \notreadCTANtrue
%
% Alan's code for CTAN references:
%
% define a location for a package on CTAN
% #1 is the package name
% #2 is the CTAN path to the thing
% a package in a directory
\newcommand{\CTANdirectory}[2]{\@ifundefined{ctan-#1}{%
   \expandafter\gdef\csname ctan-#1\endcsname{#2}%
}{%
   \PackageWarning{faq}{Repeated definition of label: #1}%
}}
%
% a package in a single file (the same appearance, but the WWW version is  
% different).
\let\CTANfile\CTANdirectory
%
% Make reference to a CTAN package
%
% counter for the undefined references
\newcounter{CTAN@unrefs}
%
% the command itself
\DeclareRobustCommand{\CTANref}[1]{\@ifundefined{ctan-#1}{%
    \PackageWarning{CTAN}{Undefined reference: #1}%
    \stepcounter{CTAN@unrefs}%
}{%
    \edef\@tempa{\noexpand\CTAN{\csname ctan-#1\endcsname}}\@tempa
}}
%
% hook for diagnosing undefined references at the end
\AtEndDocument{\ifthenelse{\theCTAN@unrefs > 0}{%
    \PackageWarning{CTAN}{There were \arabic{CTAN@unrefs} undefined
      references to CTAN}%
    }%
    {}%
  }
%
% a slight variation of description for lists of book titles
\newcommand{\booklabel}[1]{\hspace\labelsep\normalfont\itshape #1}
\newenvironment{booklist}{\begin{list}{}%
   {\labelwidth\z@ \itemindent-\leftmargin \let\makelabel\booklabel}}%
   {\end{list}}
%
% proglist is the same as booklist if we're using italics for program
% names, but will need hacking otherwise
\newenvironment{proglist}{\begin{booklist}}{\end{booklist}}
%
% the little bit(s) of code that's(re) going to be ignored when the
% html is generated are enclosed by the following two commands
\let\htmlignore\relax
\let\endhtmlignore\relax
%
% A Donald Arseneau marvel:
% \@removefromreset{FOO}{BAR} : removes counter FOO from the list of
%                               counters \cl@BAR to be reset when
%                               counter BAR is stepped.
%                               The opposite of \@addtoreset
\def\@removefromreset#1#2{\let\@tempb\@elt
   \def\@tempa#1{@&#1}\expandafter\let\csname @*#1*\endcsname\@tempa
   \def\@elt##1{\expandafter\ifx\csname @*##1*\endcsname\@tempa\else
         \noexpand\@elt{##1}\fi}%
   \expandafter\edef\csname cl@#2\endcsname{\csname cl@#2\endcsname}%
   \let\@elt\@tempb
   \expandafter\let\csname @*#1*\endcsname\@undefined}
%
% the question structure
% \Question[label name]{question asked}
% if [label name] present, the named label is assigned with \Qlabel
\def\Question{\@ifnextchar[{\@Question}{\subsection}}
\def\@Question[#1]#2{\subsection{#2}\Qlabel{#1}}
%
% now let's hack around a bit in order to make things slightly
% prettier
%
% first: numbering of subsections -- doesn't include section nos, not
% reset for each section
\renewcommand{\thesubsection}{\arabic{subsection}}
\@removefromreset{subsection}{section}
%
% second: sections `numbered' alphabetically
\renewcommand{\thesection}{\Alph{section}}
%
% \Qlabel and \Qref: define and refer to labels
\let\Qlabel\label
\newcommand\Qref[3][see question]{#1~\ref{#3}}
%
% from doc package, then hacked about by yours truly
\DeclareRobustCommand\csx[1]{\def\@tempa{#1}{\FAQverbFamily\char`\\%
    \expandafter\@faq@strip\meaning\@tempa\@faq@strip}}
\def\cs|#1|{\csx{#1}}
%
% for comments during maintenance
\def\Q#1{\footnote{{\ttfamily QUERY: #1}}}
%\def\Q#1{\marginpar{{\ttfamily QUERY: #1}}}
%
% Checking structure (null for now)
\newcommand\checked[2]{}
%
% for Alan's benefit
\newbox\@footnoteenvbox
\newenvironment{footnoteenv}
  {\begin{lrbox}\@footnoteenvbox\reset@font\footnotesize\ignorespaces}
  {\end{lrbox}%
   \footnote{\unhbox\@footnoteenvbox}}
%
% end of package
\endinput