summaryrefslogtreecommitdiff
path: root/usergrps/uktug/baskervi/6_1/faq.sty
blob: ce67e7700f00dfe8b7508e80d36e8e653738d449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
% 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