This repository has been archived by the owner on Sep 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faq.sty
1281 lines (1256 loc) · 37.5 KB
/
faq.sty
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
% $Id: faq.sty,v 1.140 2014/01/28 18:16:50 rf10 Exp rf10 $
%
% This is the LaTeX package that deals with the eccentricities of mark
% up of the UK TeX FAQ.
%
% uses production LaTeX 2e commands
\NeedsTeXFormat{LaTeX2e}[1994/06/01]% at least!
\ProvidesPackage{faq}[2007/06/08 v2.4 English TeX FAQ macros]
% this package new requires etex
\@ifundefined{eTeXversion}{%
\PackageError{faq}{This package requires e-TeX}{}%
}{}
%
% 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[T1]{fontenc}%
\RequirePackage{lmodern}% for sans fonts
\RequirePackage{mathptmx}
\RequirePackage{textcomp}%
\AtBeginDocument{%
\let\save@textcurrency\textcurrency
\def\textcurrency{%
{%
\fontfamily{lmr}\selectfont
\save@textcurrency
}%
}%
}
\boldmathavailfalse
\IfFileExists{luximono.sty}%
{\RequirePackage[scaled=0.85]{luximono}}% not using cmtt-alike
{\RequirePackage{sub-luximono}}% load whatever
\DeclareRobustCommand{\$}{\char`\$}% otherwise tries to load tctt....
\@ifundefined{Dings}{\RequirePackage{pifont}%
\def\Dings{\nopagebreak{\footnotesize
\dingline{167}}}%
}%
{}%
\DeclareRobustCommand\acro[1]{##1\@{}}
}
% debugging (requires etex, like much of this package)
%\tracingifs=1
% suppress bold maths if they're not available
\ifboldmathavail\else\let\boldmath\@empty\fi
%
% true for pdf output
\newif\ifsinglecolumn
\RequirePackage{ifpdf}
\ifpdf
\PackageInfo{faq}{1-column PDF output\@gobble}
\expandafter\singlecolumntrue
\else
\PackageInfo{faq}{2-column DVI output\@gobble}
\expandafter\singlecolumnfalse
\fi
\ifpdf
% suppress font list from pdftex
\RequirePackage{atveryend}
\AtVeryVeryEnd{\batchmode}
\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=UseNone%
,pdfstartview=FitH%
% ,bookmarks=false%
,bookmarksnumbered%
]{hyperref}
\RequirePackage{pdf14}
\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\bibtex{BibTeX}%
\def\PiCTeX{PiCTeX}%
\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}
\RequirePackage{microtype}
%
% 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}
\let\mf\MF
\DeclareRobustCommand\MP{Meta\-post}
\let\mp\MP
\newcommand\ttype{TrueType}
\newcommand\otype{OpenType}
\let\textlogo\textmd
%
% define substitutes for stupid_names
\newcommand\LaTeXo{\latex\,2.09}
\newcommand\latexo{\latex\,2.09}
\newcommand\AMSTeX{AMS\TeX}
\newcommand\AMSLaTeX{AMS\latex}
\newcommand\amslatex{AMS\latex}
\newcommand\BibTeX{Bib\TeX}
\newcommand\bibtex{Bib\TeX}
\newcommand\PiCTeX{PiC\TeX}
\newcommand\pictex{PiC\TeX}
\newcommand\texlive{\TeX{} Live}
% and...
%
% ifthenelse for the undefined references
\RequirePackage{ifthen}
%
% tables are all long'uns
\RequirePackage{booktabs}
%
% we define conditional stuff using Eijkhout's package
\RequirePackage{comment}
\def\CommentCutFile{tmp/comment.cut} % use this in place of ./comment.cut
\excludecomment{htmlversion}
\includecomment{typesetversion}
\ifpdf
\includecomment{pdfversion}
\includecomment{wideversion}
\includecomment{hyperversion}
\excludecomment{flatversion}
\excludecomment{dviversion}
\excludecomment{narrowversion}
\else
\excludecomment{pdfversion}
\excludecomment{wideversion}
\excludecomment{hyperversion}
\includecomment{flatversion} % non-hyper
\includecomment{dviversion}
\includecomment{narrowversion}
\fi
%
% define commands that behave differently according to the above
% \begin{hyperversion}
% \newcommand\quotify[1]{``#1''}
% \end{hyperversion}
% \begin{flatversion}
% \let\quotify\@firstofone
% \end{flatversion}
%
% dummy environment for separating the intro
\newenvironment{introduction}{}{}
%
% but we also want short versions, like LaTeX2HTML's
\let\htmlonly\@gobble
\let\nothtml\@firstofone
\let\latexhtml\@firstoftwo
\ifpdf
\let\narrowonly\@gobble
\let\wideonly\@firstofone
\let\hyperflat\@firstoftwo
\else
\let\narrowonly\@firstofone
\let\wideonly\@gobble
\let\hyperflat\@secondoftwo
\fi
\let\hyperonly\wideonly
\let\flatonly\narrowonly
%
% 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
%
% 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\plaintex{Plain \TeX{}}
\providecommand\miktex{MiKTeX}
\providecommand\texshop{\ProgName{TeXshop}}
\providecommand\texworks{\ProgName{TeXworks}}
%
\newcommand\ctan{\acro{CTAN}}
\newcommand\tex{\TeX{}}
%
\newcommand\macosx{Mac \acro{OS}/X}
%
%% \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\eTeX{e-\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}
\let\eTeX\etex % some day all the old format will have gone...
\newcommand\ExTeX{Ex\TeX}
\newcommand\NTS{NTS}
\newcommand\PDFTeX{PDF\TeX}
\newcommand\pdftex{PDF\TeX}
\newcommand\LuaTeX{Lua\TeX}
\newcommand\luatex{Lua\TeX}
\newcommand\lualatex{Lua\LaTeX}
\newcommand\xetex{XeTeX}
\newcommand\xelatex{XeLaTeX}
%\newcommand\TeXXeT{TeX-{}-XeT}
\newcommand\AllTeX{(La)\TeX}
\newcommand\alltex{(La)\TeX}
\newcommand\CONTeXT{Con\TeX{}t}
\newcommand\context{Con\TeX{}t}
\newcommand\PDFLaTeX{PDF\LaTeX}
\newcommand\pdflatex{PDF\latex}
\renewcommand\LaTeX{La\TeX}
\newcommand\latex{La\TeX}
\newcommand\twee{2e}
\renewcommand\LaTeXe{\LaTeX\twee}
\newcommand\latexe{\LaTeX\twee}
%
% 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#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
\ifpdf
\let\nolinkURL\nolinkurl % unlinked version
\else
\let\nolinkURL\url % there ain't no linking
\fi
% 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
}
\let\progname\ProgName
%%\else
%% \DeclareUrlCommand\@ProgName{\def\UrlFont{\rmfamily\itshape}}
%% \DeclareRobustCommand\ProgName{\@ProgName}
%%\fi
\let\Package\ProgName % pro tem
\let\package\Package
\let\Class\Package % ...
\let\class\Class
\let\FontName\Package % ...
% \let\fontname\FontName % ahh, ... no!
% another little oddity (from doc.sty originally, iirc)
\newcommand\meta[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}}
%
% ISBN references
\def\ISBN{\@ifstar\@ISBNstar\@ISBN}
\def\@ISBNstar#1#2{\acro{ISBN}-10~#1, \acro{ISBN}-13~#2}
\def\@ISBN#1{\acro{ISBN}-10~#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}%
}%
\@faq@disposeopt
}
\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}%
}%
\@faq@disposeopt
}
\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}%
}%
\@faq@disposeopt
}
\else
\let\CTANfile\CTANdirectory
\fi
%
% get rid of optional catalogue pointer in \CTAN(directory|file)
\newcommand\@faq@disposeopt{%
\@ifnextchar[\@faq@gobbleopt{}% ]
}
\def\@faq@gobbleopt[#1]{}
%
% Make reference to a CTAN package
%
% counters for the undefined references and repeated labels
\newcounter{CTAN@unrefs}
\newcounter{CTAN@replabs}%
%
% the command itself
\newcommand{\CTANref}[1]{%
\@ifundefined{ctan-#1}{%
\PackageWarning{CTAN}{Undefined reference: #1}%
\stepcounter{CTAN@unrefs}%
\futurelet\@let@token\faq@zap@trailing@opt
}{%
\csname ctan-#1\endcsname
\expandafter\let
\expandafter\faq@cat@ref\csname ctan-catref-#1\endcsname
}%
\futurelet\@let@token\faq@check@trailing@opt
}
\newcommand\faq@check@trailing@opt{%
\ifx\@let@token[%
\expandafter\faq@collect@catref
\else
\let\faq@catref\@empty%
\fi
}
\def\faq@collect@catref[#1]{\edef\faq@catref{\noexpand
\url{\faq@fixed@cataddr#1.html}%
}%
}%
\def\faq@fixed@cataddr{ help/Catalogue/}%
\newcommand\faq@zap@trailing@opt{\ifx\@let@token[%
\expandafter\@gobble@opt\fi
}
\def\@gobble@opt[#1]{}
%
% href to a ctan package
\ifpdf
\DeclareRobustCommand{\CTANhref}[2]{\@ifundefined{ctan-#1}{%
\PackageWarning{CTAN}{Undefined reference: #1}%
\stepcounter{CTAN@unrefs}%
}{{%
\def\@CTAN##1##2##3{http://mirror.ctan.org/##2}%
\href{\csname ctan-#1\endcsname}{#2}%
}}}
\else % DVI version
\DeclareRobustCommand{\CTANhref}[2]{\@ifundefined{ctan-#1}{%
\PackageWarning{CTAN}{Undefined reference: #1}%
\stepcounter{CTAN@unrefs}%
}{{%
% \def\@ctan@path##1{\expandafter\httpify\LocalCTAN!##1}
\def\@ctan@path##1{\LocalCTAN##1}
\edef\@tempa{\csname ctan-#1\endcsname}%
\expandafter\href\expandafter{\@tempa}{#2}%
}}}
\fi
%
% this is surely temporary
\def\httpify ftp://ftp#1!{http://www#1}
%
% 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
\bgroup
\@makeother\_%
\scantokens{#1}%
\unskip
\egroup
\/\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}
%
% 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
\edef\l@stl@bel{\@gobbletwo#1}%
\qu@stion{#2}%
\def\reserved@a{#1}%
\ifx\reserved@a\@empty
\PackageWarning{faq}{Question "#2" has no label}%
\else
\Qlabel{#1}%
\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}}
%
% \paragraph: has appeared in a submission, so let's give it a faq
% definition...
\renewcommand\paragraph{\@startsection{paragraph}%
4%
\z@
{1.25ex \@plus 1ex \@minus.2ex}%
{-1em}
{%
\normalfont
\normalsize
\bfseries
}}
%
% alias questions make a little perl script to set up a hash array
% that takes one from old question to current one.
\newcount\aliasfile
\aliasfile=-1
\newcommand\AliasQuestion[1]{%
\ifnum\aliasfile<0
\newwrite\aliasfile
\immediate\openout\aliasfile aliasquestion.list
\immediate\write\aliasfile {\faq@percent old_label_to_new = (}%)
\AtEndDocument{%(
\immediate\write\aliasfile{);}%
\immediate\write\aliasfile{1;}%
}%
\else
\immediate\write\aliasfile {,}% finish previous line
\fi
\immediate\write\aliasfile{"\@gobbletwo#1","\l@stl@bel"}%
}
{%
\catcode`\!=\the\catcode`\%%
\catcode`\%=\the\catcode`\+!
\gdef\faq@percent{%}!
}
%
\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