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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
|
% This is a LaTeX2e package for the UKTUG FAQ document.
%
% uses production LaTeX 2e commands
\NeedsTeXFormat{LaTeX2e}[1994/06/01]% at least!
\ProvidesPackage{faq}[2002/10/01 v2.3 English TeX FAQ macros]
%
% something affecting fonts: do we use only freely available fonts
% (i.e., are we going to make the postscript of this publicly
% available?); the config file could change this setting if
% necessary. things affected herein are the definition of \MP (for
% metapost), which isn't currently doable with free fonts, and
% suppression of boldface versions of the logo fonts.
\newif\ifpublicversion \publicversiontrue
%
% what fonts are we going to typeset in?
\newif\ifboldmathavail
\InputIfFileExists{faqfont.cfg}% must set \ifboldmathavail if necessary
{\typeout{FAQ -- loading font configuration file faqfont.cfg}}
{%
\RequirePackage{lmodern}% for sans fonts
\RequirePackage{mathptmx}
\RequirePackage[T1]{fontenc}%
\boldmathavailfalse
\RequirePackage[scaled=0.85]{luximono}% not using cmtt-alike
\RequirePackage{textcomp}%
\DeclareRobustCommand{\$}{\char`\$}% otherwise tries to load tctt....
\@ifundefined{Dings}{\RequirePackage{pifont}%
\def\Dings{\nopagebreak{\footnotesize
\dingline{167}}}%
}%
{}%
\DeclareRobustCommand\acro[1]{##1\@{}}
}
% suppress bold maths if they're not available
\ifboldmathavail\else\let\boldmath\@empty\fi
%
% switches (potentially) to be set according to status
\newif\ifpdf
\newif\ifsinglecolumn
%
% Status values
\providecommand{\Status}{0}
\ifcase\Status\relax
% 0: default case is do nothing
% \typeout{faq.sty: default output using \ifprivate private\else
% public\fi\space fonts}
\singlecolumnfalse
\pdffalse
\or
% 1: pdf output using public fonts
\typeout{faq.sty: 1-col pdf output using public fonts}
\singlecolumntrue
\pdftrue
\let\multicols\@gobble
\let\endmulticols\relax
\or
% 2: pdf output using public fonts, two columns
\typeout{faq.sty: 2-col pdf output using public fonts}
\singlecolumnfalse
\pdftrue
\fi
%
% if we're doing pdf, set up hyperref package and backdoors that avoid
% its sillier byproducts...
\ifpdf
\@ifundefined{pdfavoidoverfull}{}{\pdfavoidoverfull=1}
\let\@faq@@url\url
\urldef\DebianSocialContract\@faq@@url
{http://www.debian.org/social_contract#guidelines}
\RequirePackage[pdftex%
,colorlinks%
,pdftitle=The\ UK\ TeX\ FAQ%
,linkcolor=blue%
,pdfpagemode=None%
,pdfstartview=FitBH%
% ,bookmarks=false%
,bookmarksnumbered%
]{hyperref}
\usepackage{thumbpdf}
\pdfstringdefDisableCommands{%
\let\cs\psd@cs
\def\csx#1{\textbackslash#1}%
\def\marg#1{\textbraceleft#1\textbraceright}%
\let\acro\@firstofone
\let\ProgName\@firstofone
\let\Package\@firstofone
\def\meta#1{<#1>}%
%
\def\WYSIWYG{WYSIWYG}%
\def\AMSTeX{AmSTeX}%
\def\BibTeX{BibTeX}%
\def\PiCTeX{PiCTeX}%
\def\CDROM{CD-ROM}%
\def\TeXXeT{TeXXeT}%
\def\MLTeX{ML-TeX}%
\def\MP{MetaPost}%
\def\dots{...}%
\def\obracesymbol{\{}%
\def\cbracesymbol{\}}%
\def\,{}%
}%
\begingroup
\lccode`\~=`\|%
\lowercase{\endgroup
\def\psd@cs~#1~{\textbackslash#1}%
}%
% adding table of contents to bookmarks
\let\Orig@tableofcontents\tableofcontents
\def\tableofcontents{%
\pdfbookmark[1]{\contentsname}{contents}%
\Orig@tableofcontents
}%
% adding \subsection*{Finding the Files}
\AtBeginDocument{%
\let\Orig@subsection\subsection
\def\subsection{%
\@ifstar{\bookmark@subsectionstar}{\Orig@subsection}%
}%
}%
\def\bookmark@subsectionstar#1{%
\advance\Hy@linkcounter by 1\relax
\pdfbookmark[2]{#1}{subsectionstar.\the\Hy@linkcounter}%
\Orig@subsection*{#1}%
}%
\fi
%
% general support
%\RequirePackage{calc}
%
% code for handling logo font
%% \RequirePackage{mflogo}
%% \ifpublicversion
%% \renewcommand{\MP}{Meta\-Post}
%% \let\faq@@MF\MF
%% \def\faq@bx{bx}
%% \DeclareRobustCommand{\MF}{{%
%% \ifx\f@series\faq@bx
%% \expandafter\textmd%
%% \fi
%% {\faq@@MF}%
%% }%
%% }
%% \fi
\DeclareRobustCommand\MF{Meta\-Font}
\DeclareRobustCommand\MP{Meta\-Post}
\let\textlogo\textmd
%
% get texnames package (as amended)
%\RequirePackage{stupid_names}
% define substitutes for stupid_names
\newcommand\LaTeXo{\LaTeX\,2.09}
\newcommand\AMSTeX{AMS\TeX}
\newcommand\AMSLaTeX{AMS\LaTeX}
\newcommand\BibTeX{Bib\TeX}
\newcommand\PiCTeX{PiC\TeX}
%
% ifthenelse for the undefined references
\RequirePackage{ifthen}
%
% tables are all long'uns
\RequirePackage{booktabs}
%
% we define html only stuff using Eijkhout's package
\RequirePackage{comment}
\excludecomment{htmlversion}
\ifpdf
\includecomment{pdfversion}
\excludecomment{dviversion}
\includecomment{wideversion}
\excludecomment{narrowversion}
\else
\excludecomment{pdfversion}
\includecomment{dviversion}
\includecomment{narrowversion}
\excludecomment{wideversion}
\fi
%
% but we also want a `short' version, like LaTeX2HTML's
\let\htmlonly\@gobble
%
% the Baskerville and other logos and abbreviations
\providecommand\BV{\emph{Baskerville}}
\providecommand\DANTE{\acro{DANTE}}
\providecommand\MSDOS{\acro{MS-DOS}}
\providecommand\CDROM{\acro{CD-ROM}}
\providecommand\elatex{e-LaTeX}
\providecommand\miktex{MiKTeX}
%
%% \providecommand\TeXXeT{\TeX-{}-X\lower.5ex\hbox{E}\kern-.1667emT\@}
%\providecommand\MLTeX{ML-\TeX}
%
% provided for consistency's sake
\newcommand\PS{PostScript}
%
% to get \\ into example command arguments
\def\bsbs{\char`\\\char`\\}
%
\def\careof{\leavevmode\hbox{\raise.75ex\hbox{c}\kern-.15em
/\kern-.125em\smash{\lower.3ex\hbox{o}}}}
%
% another silliness:
\providecommand{\textoslash}{\o}
%
% \cs{SMC} \emph{isn't} small caps~--- Barbara Beeton says she thinks
% of it as ``big small caps''. She says (modulo capitalisation of
% things\dots):
% \begin{quote}
% For the things it's used for, regular small caps are not
% appropriate~--- they're too small. Real small caps are
% appropriate for author names (and are so used in continental
% bibliographies), section headings, running heads, and, on
% occasion, words to which some emphasis is to be given. \cs{SMC}
% was designed to be used for acronyms and all-caps abbreviations,
% which look terrible in small caps, but nearly as bad in all caps
% in the regular text size. The principle of using ``one size
% smaller'' than the text size is similar to the design of caps in
% German~--- where they are smaller relative to lowercase than are
% caps in fonts intended for English, to improve the appearance of
% regular text in which caps are used at the heads of all nouns, not
% just at the beginnings of sentences.
% \end{quote}
%
% We define this in terms of the memory of the size currently selected
% that's maintained in \cs{@currsize}: if the user does something
% silly re.~selecting fonts, we'll get the wrong results. The
% following code is adapted from |relsize.sty| by Donald Arseneau and
% Matt Swift, from a 2.09 original by Bernie Cosell. (Note that the
% order of examination of \cs{@currsize} is to get the commonest cases
% out of the way first.)
% \begin{macrocode}
%<!latex2e>\def\SMC{\small}
%<*latex2e>
\DeclareRobustCommand\SMC{%
\ifx\@currsize\normalsize\small\else
\ifx\@currsize\small\footnotesize\else
\ifx\@currsize\footnotesize\scriptsize\else
\ifx\@currsize\large\normalsize\else
\ifx\@currsize\Large\large\else
\ifx\@currsize\LARGE\Large\else
\ifx\@currsize\scriptsize\tiny\else
\ifx\@currsize\tiny\tiny\else
\ifx\@currsize\huge\LARGE\else
\ifx\@currsize\Huge\huge\else
\small\SMC@unknown@warning
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
}
\newcommand\SMC@unknown@warning{\PackageWarning{faq}{Unknown text font
size command -- using \string\small}}
\DeclareRobustCommand\textSMC[1]{{\SMC #1}}
% \end{macrocode}
%
% The \cs{acro} command uses \cs{SMC} as it was originally intended.
% Note that, since most of these things are uppercase-only names, it
% fiddles with the spacefactor after inserting its text. font config
% files may define \cs{acro} otherwise
%
% \begin{macrocode}
\@ifundefined{acro}{%
\DeclareRobustCommand\acro[1]{\textSMC{#1}\@}%
}{}
% \end{macrocode}
%
%\TUGboat (effectively) takes arguments {<empty>}vol(issue)
\DeclareRobustCommand\TUGboat[1]{\expandafter\@TUGboat\ignorespaces}
\def\@TUGboat#1(#2){\textsl{TUGboat} \textbf{#1}(#2)}
%
% The NTS and eTeX (and for consistency Eplain) logos
%% \DeclareRobustCommand\NTS{$\mathcal{N}$\lower.5ex\hbox
%% {$\mathcal{T}$}$\mathcal{S}$\@}
%% \DeclareRobustCommand\eTeX{{$\varepsilon$}-\TeX}
%% \DeclareRobustCommand\Eplain{Eplain}
%% \DeclareRobustCommand\PDFTeX{\acro{PDF}\TeX}
%% \DeclareRobustCommand\PDFLaTeX{\acro{PDF}\LaTeX}
%% \DeclareRobustCommand\CONTeXT{Con\TeX{}t}
\DeclareRobustCommand\YandY{\acro{Y}\&\acro{Y}}
% non-silly names...
\renewcommand\TeX{TeX}
\newcommand\Eplain{Eplain}
\newcommand\eTeX{e-\TeX}
\newcommand\ExTeX{Ex\TeX}
\renewcommand\LaTeX{La\TeX}
\newcommand\AllTeX{(La)\TeX}
\newcommand\CONTeXT{Con\TeX{}t}
\newcommand\PDFTeX{PDF\TeX}
\newcommand\PDFLaTeX{PDF\LaTeX}
\newcommand\twee{2e}
\newcommand\NTS{NTS}
%\newcommand\TeXXeT{TeX-{}-XeT}
%
% Other odds and ends (appear differently in TeX and http or plain
% text
%
% wysiwyg gets capitalised at the beginning of a sentence. not
% entirely reliably...
\DeclareRobustCommand\WYSIWYG{%
\ifvmode
\let\faq@tempa\MakeUppercase
\else
\ifnum\spacefactor>2000
\let\faq@tempa\MakeUppercase
\else
\let\faq@tempa\relax
\fi
\fi
\textsc{\faq@tempa wysiwyg}%
}
%
% Command for doing `square one' :-}
\newcommand\sqfbox[1]{\framebox{\makebox[\totalheight]{#1\/}}}
%
% an arrow used as a hyphen...
\newcommand\arrowhyph{\ensuremath{\rightarrow}\penalty0\hskip0pt\relax}
%
% Here's a \fullline macro that works in lists and so on
\newcommand\fullline[1]{\@tempdima\hsize\relax
\advance\@tempdima-\leftmargin\relax
\advance\@tempdima-\rightmargin\relax
\hb@xt@\@tempdima{#1}%
}
%
% list indentations (narrower than default because two-column, but
% squeezed further to gain a bit more space still)
\setlength\leftmargini {1.8em}
\setlength\leftmarginii {1.2em}
\setlength\leftmarginiii{1em}
\setlength\leftmarginiv {0.8em}
%
% for tidy expression of things with parentheses around them:
\newcommand\parens[1]{(#1)}
\newcommand\oparen{(}%)( [footling around to match brackety things in emacs]
\newcommand\cparen{)}
%
% make the tex logo robust
\edef\@tempa{\noexpand\DeclareRobustCommand\noexpand\TeX{\TeX}}
\@tempa
%
% this piece of fantasy was let loose on an unsuspecting world by
% christina thiele, but i bet she didn't write it ;-)
\edef\diatop{\noexpand\protect\csname diatop \endcsname}
\expandafter\def\csname diatop \endcsname[#1|#2]{%
\leavevmode
{%
\setbox1=\hbox{{#1{}}}\setbox2=\hbox{{#2{}}}%
\dimen0=\ifdim\wd1>\wd2\wd1\else\wd2\fi%
\dimen1=\ht2\advance\dimen1by-1ex%
\setbox1=\hbox to1\dimen0{\hss#1\hss}%
\rlap{\raise1\dimen1\box1}%
\hbox to1\dimen0{\hss#2\hss}%
}%
}%
%
% for han the thanh (who knows whether i've actually got this right; i
% can't use the T5 fonts, which aren't even really publicly available
% yet)
\DeclareRobustCommand{\The}{Th\diatop[\'|\^e]}
%% %
%% % 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}
%% %
%% % Ditto for \AllTeX (as used in TUGboat)
%% \DeclareRobustCommand{\AllTeX}{(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-.075em)%
%% \kern-.075em\TeX}
%% %
%% % A similar game is used in defining an `all LaTeX' sort of thing:
%% \DeclareRobustCommand\twee{2$_{\textstyle\varepsilon}$}
%
% it proves that, for Alan's stuff, the following needs to have been
% done _before_ we define the macros
\RequirePackage{shortvrb}
\MakeShortVerb{\|}
%
% 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:
%
% (new method, using url.sty -- old version using FAQverb stuff
% deleted from comments 2000/03/24)
\newcommand\Email{\begingroup \urlstyle{tt}\Url} % email address
\ifpdf
\def\mailto{\@ifnextchar|\@mailto@vert\@mailto@brace} % url to mail somewhere
\def\@mailto@vert|#1|{\href{mailto:#1}{\Email{#1}}}
\def\@mailto@brace#1{\href{mailto:#1}{\Email{#1}}}
\else
\newcommand\mailto{\begingroup \urlstyle{tt}\Url} % mailable address
\fi
\DeclareRobustCommand\FTP{\begingroup \urlstyle{tt}\Url} % FTP site address
\DeclareRobustCommand\File{\begingroup \urlstyle{tt}\Url} % File name
\DeclareRobustCommand\@ctan@path{\begingroup \urlstyle{tt}\Url} % CTAN path
% (argument in braces)
\ifpdf
\newcommand\@CTAN[3]{\href{#1#2#3}{\@ctan@path{#2}}} % relay via hyperreference
\else
\newcommand\@CTAN[3]{\@ctan@path{#2}} % text-only reference
\fi
\newcommand\Newsgroup{\begingroup \urlstyle{tt}\Url} % newsgroup
\let\URL\url % just a URL
% url.sty defines \path, etc. hyperref may redefine...
\ifpdf
% hyperref has defined \href
\let\FAQ@@href\href
% we actually want to ignore the * in \href*
\def\href{\@ifstar\FAQ@@href\FAQ@@href}
\else
%
% here, latex for printing
\newcommand\href{%
\@ifstar
{\let\@href@text\@empty\@href@a}%
{\def\@href@text{see }\@href@a}%
}
%
% decisions now made about
\newcommand\@href@a{\begingroup
\@makeother\\%
\@makeother\_%
\@makeother\%%
\@makeother\~%
\@makeother\#%
\@href@b
}
%
% enter here in a group with sanitised arg
\newcommand\@href@b[1]{\endgroup
\urldef\@href@tempurl\url{#1}%
\@href@getanchor
}
%
% out of the group again: argument is the anchor
\newcommand\@href@getanchor[1]{#1%
\@ifnextchar@nosp'%
{\@href@getanchorq}%
{ (\@href@text\@href@tempurl)\@let@token}%
}
%
% one quote after the anchor - check for a second
\newcommand\@href@getanchorq{% gobble the first quote
\@ifnextchar@nosp'%
\href@getanchor@qq
{' (\@href@text\@href@tempurl)\@let@token}% restore quote
}
\newcommand\href@getanchor@qq{% gobble the second quote too
{'' (\@href@text\@href@tempurl)}% restore both quotes
}
%
% two quotes after the anchor
\fi
\long\def\@ifnextchar@nosp#1#2#3{%
\let\reserved@d=#1%
\def\reserved@a{#2}%
\def\reserved@b{#3}%
\afterassignment\@ifnch@nosp\let\@let@token= }
\def\@ifnch@nosp{%
\ifstophere\stopherefalse\show\@let@token\fi
\ifx\@let@token\reserved@d
\expandafter\reserved@a
\else
\expandafter\reserved@b
\fi
}
\setcounter{errorcontextlines}{999}
\newif\ifstophere
%%\ifx\DeclareUrlCommand\undefined
\DeclareRobustCommand\ProgName{%
\begingroup
\def\UrlFont{\rmfamily\itshape}\csname Url@do\endcsname
\Url
}
%%\else
%% \DeclareUrlCommand\@ProgName{\def\UrlFont{\rmfamily\itshape}}
%% \DeclareRobustCommand\ProgName{\@ProgName}
%%\fi
\let\Package\ProgName % pro tem
\let\Class\Package % ...
\let\FontName\Package % ...
% another little oddity (from doc.sty originally, iirc)
\newcommand\meta[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}}
%
% ISBN references
\def\ISBN#1{\mbox{\acro{ISBN}}~#1}
%
% Alan's code for CTAN references (now hacked to be capable of urls
% for use in pdf output):
%
% define a location for a package on CTAN
% ignores a leading * (which has meaning for html version only)
% #1 is the package name
% #2 is the CTAN path to the thing
% a package in a directory
\ifpdf
\newcommand{\CTANdirectory}{\@ifstar\@sCTANdirectory\@CTANdirectory}
\else
\newcommand{\CTANdirectory}{\@ifstar\@CTANdirectory\@CTANdirectory}
\fi
\newcommand{\@CTANdirectory}[2]{\@ifundefined{ctan-#1}{%
\expandafter\gdef\csname ctan-#1\endcsname{\@CTAN\LocalCTAN{#2}\CTANDirFmt}%
}{%
\PackageWarningNoLine{faq}{Repeated definition of label: #1}%
\stepcounter{CTAN@replabs}%
}}
\ifpdf
\newcommand{\@sCTANdirectory}[2]{\@ifundefined{ctan-#1}{%
\expandafter\gdef\csname ctan-#1\endcsname{\@CTAN\LocalCTAN{#2}/}%
}{%
\PackageWarningNoLine{faq}{Repeated definition of label: #1}%
\stepcounter{CTAN@replabs}%
}}
\fi
%
% a package in a single file (the same appearance, but the WWW -- and
% ultimately the pdf -- versions are different).
\ifpdf
\newcommand{\CTANfile}[2]{\@ifundefined{ctan-#1}{%
\expandafter\gdef\csname ctan-#1\endcsname{\@CTAN\LocalCTAN{#2}{}}%
}{%
\PackageWarningNoLine{faq}{Repeated definition of label: #1}%
\stepcounter{CTAN@replabs}%
}}
\else
\let\CTANfile\CTANdirectory
\fi
%
% Make reference to a CTAN package
%
% counters for the undefined references and repeated labels
\newcounter{CTAN@unrefs}
\newcounter{CTAN@replabs}%
%
% 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
\csname ctan-#1\endcsname
}}
%
% hook for diagnosing undefined references at the end
\AtEndDocument{\ifthenelse{\theCTAN@unrefs > 0}{%
\PackageWarningNoLine{ctan}{There were \arabic{CTAN@unrefs} undefined
references to CTAN}%
}%
{}%
\ifthenelse{\theCTAN@replabs > 0}{%
\PackageWarningNoLine{ctan}{There were \arabic{CTAN@replabs}
multiply defined 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
\parskip \z@
\itemsep \z@
}%
}%
{\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}}
%
% similarly for ctanrefs environment
\newcommand{\ctanreference}[1]{\hspace\labelsep\normalfont\ttfamily\itshape#1%
\/\normalfont:}
\newenvironment{ctanrefs}{%
\begin{list}{}%
{%
\labelwidth\z@
\itemindent-\leftmargin
\let\makelabel\ctanreference
\topsep 4\p@
\parskip \z@
\itemsep \z@
\@rightskip=\z@\@plus1in\relax
\spaceskip=.3333em\relax
\xspaceskip=.5em\relax
}%
}%
{\end{list}}
%
% compact the itemize, enumerate and description environments
\let\FAQ@@itemize\itemize
\renewcommand\itemize{%
\topsep 0.25\topsep
\FAQ@@itemize
\parskip \z@
\itemsep \z@
}
\let\FAQ@@enumerate\enumerate
\renewcommand\enumerate{%
\topsep 0.25\topsep
\FAQ@@enumerate
\parskip \z@
\itemsep \z@
}
\let\FAQ@@description\description
\renewcommand\description{%
\topsep 0.25\topsep
\FAQ@@description
\parskip \z@
\itemsep \z@
}
%
% and similarly close up verbatim's separation from what surrounds it
\let\FAQ@@verbatim\verbatim
\renewcommand\verbatim{%
\topsep 0.25\topsep
\FAQ@@verbatim
}
%
% \raggedwithindent is useful when we've got an URL or something
% overrunning the end of the line (and this line is terminated with
% \\)
%
% Typical usage is within the argument of a \nothtml command
\newcommand\raggedwithindent{%
\rightskip=\z@\@plus5em\relax
\spaceskip=.3333em\relax
\xspaceskip=.5em\relax
\hangindent=1pc\relax}
%
% 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
%
% or it's the argument to \nothtml
\newcommand\nothtml[1]{#1}
%
% a trivium that appears differently in the two modes
\newcommand\latexhtml[2]{#1}
%
% things needed for the benefit of texfaq2html's `sanitise_line'
\let\textpercent\%
\let\faq@@textbar\textbar
\chardef\faq@vertbar`\|
\renewcommand\textbar{\def\@tempa{cmtt}%
\ifx\@tempa\f@family
\faq@vertbar
\else
\faq@@textbar
\fi
}
%
% redefine \cs{l@section} to require space for itself at the bottom
% of a column
\renewcommand\l@section[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
% "needspace" element here (doesn't work)
% \vskip \z@ \@plus 3\baselineskip
% \penalty -\@highpenalty
% \vskip \z@ \@plus -3\baselineskip
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi
}
%
% subsections: these are a curious half-breed between latex sections
% and subsections -- as designed, i'm not intending there ever to be
% more than 9 per section (hahaha)
\renewcommand\subsection{\@startsection{subsection}%
\tw@
\z@
{-1.5ex \@plus-1ex \@minus-.3ex}%
{1ex \@plus.2ex}%
{\normalfont\large\bfseries
\raggedright}%
}
\renewcommand*\l@subsection[2]{%
\ifnum \c@tocdepth >\@ne
\addpenalty\@secpenalty
\addvspace{0.5em \@plus\p@}%
% "needspace" element here (doesn't work)
% \vskip \z@ \@plus 3\baselineskip
% \penalty -\@highpenalty
% \vskip \z@ \@plus -3\baselineskip
\setlength\@tempdima{2.0em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
%
%
% the question structure
% \Question[label name]{question asked}
% if [label name] present, the named label is assigned with \Qlabel
\newcounter{question}
\newcommand\Question[2][]{%
\ifpdf
\def\annot@label{#1}%
\def\annot@question{#2}%
\fi
\qu@stion{#2}%
\def\reserved@a{#1}%
\ifx\reserved@a\@empty
\PackageWarning{faq}{Question "#2" has no label}%
\else
\Qlabel{#1}%
% \addtocontents{lab}{\protect\QuestionLabel{#1}{#2}{\thepage}}%
\fi
}
\newcommand\qu@stion{\@startsection{question}%
\thr@@
\z@
{-1.25ex \@plus -1ex \@minus -.2ex}%
{0.75ex \@plus .2ex}%
{%
\normalfont
\normalsize
\bfseries
\raggedright
\protected@edef\@svsec{\protect\annot@set\@svsec}%
}%
}
\newcommand*\questionmark[1]{}
\newcommand*\l@question{\@dottedtocline{2}{2.0em}{2.3em}}
%
\long\def\@ReturnAfterFi#1\fi{\fi#1}%
\ifpdf
\newcommand*\toclevel@question{3}%
\let\orig@section\section
\let\orig@subsection\subsection
\let\orig@subsubsection\subsubsection
\def\section{%
\def\toclevel@question{2}%
\orig@section
}
\def\subsection{%
\def\toclevel@question{3}%
\orig@subsection
}
\def\subsubsection{%
\def\toclevel@question{4}%
\orig@subsubsection
}
%
\def\annot@set{%
\ifx\annot@label\@empty
\else
\begingroup
\def\x##1-##2\@nil{\def\annot@label{##2}}%
\expandafter\x\annot@label\@nil
\def\x##1_##2\@nil{%
##1%
\ifx\\##2\\%
\else
\noexpand\textunderscore
\@ReturnAfterFi{\x##2\@nil}%
\fi
}%
\edef\annot@label{\expandafter\x\annot@label_\@nil}%
\edef\NL{\string\n}%
\pdfstringdef\annot@text{%
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=\annot@label\NL
\annot@question
}%
\rlap{%
\kern-10mm\relax
\settoheight{\dimen@}{X}%
\pdfannotlink
width 200mm
height \dimen@
depth 25mm
user {%
/Subtype/Text%
/T(Question \thequestion: \annot@label)%
/Contents(\annot@text)%
}%
\pdfendlink
}%
\endgroup
\fi
}%
\@ifundefined{pdfannotlink}{%
\let\pdfannotlink\pdfstartlink
}{}
\else
\let\annot@set\relax
\fi
%
% \QuestionLabel starts out as a null command (so that inputting a
% .lab file at s.o.d has no effect), but it's then reset to
% \@questionLabel in case the file is going to be read again later
% (e.g., as an appendix), but we don't have a sensible definition of
% _that_ yet, either...
\newcommand{\labellist}{%
\newcommand{\QuestionLabel}[3]{}%
% \@starttoc{lab}%
\let\QuestionLabel\@questionLabel
}
\newcommand{\@questionLabel}[3]{}
%
% \afterquestion is used when the \Question command itself has to be
% inside a group for some reason (e.g., to have it in \boldmath)
\newcommand\afterquestion{%
\global\toks@\expandafter{\the\everypar}%
\edef\@tempa{%
\noexpand\@afterindentfalse
\noexpand\everypar{\the\toks@}%
}%
\expandafter\endgroup\@tempa
}
%
% \cs{Destination} is used immediately after a \cs{Question} command
% in the various add-* files to signify where the question is supposed
% to go
\newcommand\Destination[1]{\begin{center}
\itshape#1
\end{center}
}
%
% we `number' our sections alphabetically
\renewcommand{\thesection}{\Alph{section}}
%
% keywords for questions. these get translated into comments in web
% versions
\newcommand\keywords{\begingroup
\@makeother\\%
\@makeother\^%
\@makeother\_%
\@makeother\%%
\expandafter\endgroup
\@gobble
}
%
% \Qlabel and \Qref: define and refer to labels
\ifpdf
% hyperref version of \label doesn't get set until begin document
\AtBeginDocument{\let\Qlabel\label}
\else
\let\Qlabel\label
\fi
% \Qref[<text before q no>]{<hyper anchor text>}{<question label>}
% (default for arg 1 is "see question"; a conventional null argument
% here is \htmlonly, which gobbles a space)
% produces:
% <text before q no> <question number>
%
% \Qref*... produces
% <hyper anchor text> (<text before q no> <question number>)
%
% the code is supposed to deal correctly with things surrounded by
% double quotes (i.e., ``\Qref*....'' closes the quotes before putting
% the question number in parentheses.
%
% this stuff should be reconsidered to produce more sensible behaviour
% when running pdftex
%
\newcommand\Qref{\@ifstar\@QrefA\@QrefB}
\newcommand\@QrefA[3][see question]{#2%
\def\@QrefAai{#1}%
\def\@QrefAaiii{#3}%
\afterassignment\@QrefAl\let\@tempa= }
\newcommand\@QrefAl{% \@tempa is char after original \Qref's args
% \@QrefAai/\@QrefAaiii are arguments of \Qref
\ifx\@tempa'%
\def\@next{%
\afterassignment\@QrefAQ
\let\@tempa= %
}%
\expandafter\@next
\else
{ (\@QrefAai~\ref{\@QrefAaiii})\@tempa}%
\fi
}
\newcommand\@QrefAQ{% \@tempa is second char after original \Qref's
% arguments (first was a quote character)
\ifx\@tempa'%
'' (\@QrefAai~\ref{\@QrefAaiii})%
\else
{ (\@QrefAai~\ref{\@QrefAaiii})'\@tempa}%
\fi
}
%% \@ifnextchar'{\@QrefAQb{#1}{#2}}{ (#1~\ref{#2})'}}
%% \newcommand\@QrefAQb[3]{% param 3 quote again
%% '' (#1~\ref{#2})}
\newcommand\@QrefB[3][see question]{#1~\ref{#3}}
%
% from doc package, then hacked about by yours truly
\DeclareRobustCommand\csx[1]{{\FAQverbFamily\char`\\#1}}
%\def\cs|#1|{\csx{#1}}
%
% fancier versions of the above
%
% \cmdinvoke\cs<argument sequence>
% \cs typeset as above
% <argument sequence> may consist of optional or mandatory arguments;
% so far only "one mandatory" and "one optional, one mandatory"
% are supported by texfaq2html
%
% the `arguments' are simply typesett \texttt, as yet -- if something
% fancier is needed, there's a bunch of code needs rewriting here...
\DeclareRobustCommand\cmdinvoke{\@ifstar
{\let\@tempa\emph\@scmdinvoke}%
{\let\@tempa\relax\@scmdinvoke}%
}
\def\@scmdinvoke#1{\texttt{\symbol{92}#1}%
\futurelet\@let@token\@cmdinvoke
}
\def\@cmdinvoke{\ifx\@let@token\bgroup
\expandafter\@cmdinvoke@lbrace
\else
\ifx\@let@token[% ]
\expandafter\expandafter\expandafter\@cmdinvoke@lbrack
\fi
\fi
}
\def\@cmdinvoke@lbrace#1{\penalty0\hskip0pt\relax
\texttt{\symbol{123}\@tempa{#1}\symbol{125}}%
\futurelet\@let@token\@cmdinvoke
}
\def\@cmdinvoke@lbrack[#1]{\penalty-150\hskip0pt\relax
\texttt{[\@tempa{#1}]}%
\futurelet\@let@token\@cmdinvoke
}
%
% for writing \cmdinvoke out by hand (in titles)
\def\marg#1{\texttt{\symbol{123}{#1}\symbol{125}}}
% that stuff doesn't work in pdf thumbnails. herewith an alternative
% for label ps@empty:
\DeclareRobustCommand\psatempty{%
\texttt{\string\pagestyle\string{empty\string}}%
}
% minuscule bit more structured markup...
\def\environment#1{\texttt{#1}}
\def\pkgoption#1{\texttt{#1}}
% deal with tabular: special defs to make texfaq2html doable
\let\tbamp&
\def\tbeol{\\}
\def\tbhline{\midrule}
%
% symbols for the braces (which can confuse perl sumfink rotten
\def\obracesymbol{\symbol{123}}
\def\cbracesymbol{\symbol{125}}
%
% 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
|