summaryrefslogtreecommitdiff
path: root/info/beginlatex/src/tugbook.sty
blob: 06e56e62eb076d624397edc0c5f3eaa70bd6d764 (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
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is tugbook.sty, a LaTeX2e style file to modify the book class
% for typesetting documentation transformed from DocBook XML by the
% docbook-latex XSLT stylesheet. It is used specifically for doing
% computing documentation about typographic systems like LaTeX.
%
% GNU Copyleft 1998, 1999, 2000, 2001, 2002, 2003 Silmaril Consultants
%
% Peter Flynn <peter@silmaril.ie>
%
% You modify use and distribute this file in any way you wish except
% by charging for it or claiming that you wrote it. This header and
% identity must be preserved on all copies and derivatives.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FONTS
%
% Supply default names for the fonts because my own font definitions
% store their own names in these macros, and if you're processing
% this yourself (ie without my fonts) I still want the references to
% font names in the session on fonts to work. These are defaults.
%
\newcommand{\rmfontfamilyname}{Computer Modern Roman}
\newcommand{\sffontfamilyname}{Computer Modern Sans-Serif}
\newcommand{\ttfontfamilyname}{Computer Modern Typewriter}
%
% I invoke pslatex before my private fonts so I get the benefit of the
% narrowed Courier, which is useful. If anyone knows the location of a
% free Prestige Elite (Type 1) font, which was a freebie give-away on
% some DTP CD-ROM in the late 1990s, of which I have lost my copy, I
% would be very grateful to know.
%
% ald721 and hum521 are Bitstream's Aldine (Bembo) and Humanist (Gill)
%\usepackage{pslatex,ald721,hum521}
% carmina and inc901 are also Bitstream for Carmina and Antique Olive
%\usepackage{pslatex,carmina,inc901}
% The pslatex default is narrowed Courier, so say so:
\renewcommand{\ttfontfamilyname}{Courier Narrow}
% These redefinitions seem to be needed (is ly1enc.def faulty?)
% Comment them out if you're not using LY1 (my Bitstream fonts need them)
%\renewcommand{\ae}{\char'032}
%\renewcommand{\AE}{\char'035}
%\renewcommand{\o}{\char'034}
%\renewcommand{\O}{\char'037}
% As you won't have any of them, comment out those lines and UNcomment 
% the following FOUR lines to get Times and Helvetica (\snore):
%\renewcommand{\rmfontfamilyname}{Times}
%\renewcommand{\sffontfamilyname}{Helvetica}
%\renewcommand{\ttfontfamilyname}{Courier}
%\usepackage{pslatex}
% Alternatively you could UNcomment these four lines instead:
\renewcommand{\rmfontfamilyname}{Palatino}
\renewcommand{\sffontfamilyname}{Avant Garde}
\renewcommand{\ttfontfamilyname}{Courier}
\usepackage{pslatex,palatino,avant}
%
% And yes, I do know that pslatex is obsolete and deprecated, and when
% someone gets around to updating it to do things the way they say
% they ought to be, I'll get around to updating this style file.
%
% Anyway, in this case (for TUGboat), I fiddled with the .fd file for
% Avant Garde and decreased the size to 90% because it's a font with
% a very large x-height and it needs to be smaller to sort with
% Palatino. Ditto with the special narrow Courier in pslatex.sty: I
% grew that to 110% because it was too short. Hence there are copies
% of ot1ppl.fd and pslatex.sty in the source directory which should
% override the ones in a normal LaTeX distribution.
%
% Sample line for the font sampler to make it easier to type
%
\newcommand{\alphabet}[2][OT1]{%
	\fontencoding{#1}\fontfamily{#2}\selectfont
	The quick brown fox jumps over the lazy dog}
\newcommand{\shortalphabet}[2][OT1]{%
	\fontencoding{#1}\fontfamily{#2}\selectfont
	The quick brown fox jumps over the}
\newcommand{\dalphabet}[2][OT1]{% German
	\fontencoding{#1}\fontfamily{#2}\selectfont
	Fuch\char'215, Du hast die Gan\char'215\ gestohlen, gib sie wieder her!}
%
% Allow access to ``Light'' variant of the font if available
%
\newcommand{\lite}{\fontseries{l}\selectfont}
%
% Shorthand macros for Metafont, fpTeX, and teTeX, which add
% themselves to the index
%
\newcommand{\mf}{%
	{\fontencoding{U}\fontfamily{zmf}\selectfont METAFONT}%
	\index{metafont@{\fontencoding{U}\fontfamily{zmf}%
		\selectfont METAFONT}}}
\newcommand{\fp}{fp\kern-1pt\TeX\index{fptex@fp\kern-1pt\TeX}}
\newcommand{\te}{te\kern-1pt\TeX\index{tetex@te\kern-1pt\TeX}}
\def\LyX{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\spacefactor1000}%
%
% We work in ISO 8859-1 here
%
\usepackage[latin1]{inputenc}
%
% Define the Euro more carefully than TS1 does
%
\newcommand{\euro}{{\fontencoding{TS1}\fontfamily{cmr}\selectfont\texteuro}}
%
% Smaller paragraph indentation
\setlength{\parindent}{1em}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PACKAGES
%
% You MUST have these installed for this stuff to work. You can get
% all of them from CTAN like I did. 
%
% The page geometry was designed for A4. This (tugbook) version has
% been fiddled to fit on Letter paper for printing in TUGboat.
%
\usepackage{pstricks,pst-char,pst-grad,mdwlist,soul,ragged2e}
\usepackage{graphicx,url,fancybox,fancyvrb,fancyhdr,array,paralist}
% was 396bp wide, 696bp high
%\usepackage[left=1in,textwidth=396bp,marginpar=1in,top=10mm,
%            textheight=696bp,headheight=15bp,bottom=15mm]{geometry}
% textwidth originally 32pc
\usepackage[letterpaper,left=1in,textwidth=32pc,headsep=30pt,twosideshift=0pt,
  textheight=56.5pc,headheight=15bp]{geometry}
%tugboat!
\widowpenalty=10000
\clubpenalty=10000
\parfillskip = .75\hsize plus .06\hsize minus .75\hsize
\renewcommand{\topfraction}{.9}
\renewcommand{\bottomfraction}{.5}
\renewcommand{\floatpagefraction}{.8}
\renewcommand{\textfraction}{.1}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}
\setcounter{page}{115}
%\oddsidemargin\evensidemargin
\spaceskip=3pt plus4.5pt minus1.5pt
%tugboat%
\usepackage{multicol,color,bbding,marvosym,textcomp,type1cm,makeidx}
\usepackage[normalem]{ulem}
%
% Bibliography macros to customise jurabib
%
\usepackage[bibformat=numbered]{jurabib}
\newcommand{\titleof}[1]{\emph{\citefield{title}{#1}}}
\newcommand{\authorof}[1]{\citefield{juraauthor}{#1}}
\newcommand{\dateof}[1]{\citefield{year}{#1}}
\newcommand{\citeauthoryear}[1]{\authorof{#1} \dateof{#1}}
\newcommand{\citeauthortitleyear}[1]{\authorof{#1}, \titleof{#1} \dateof{#1}}
\newcommand{\titlecite}[1]{\titleof{#1}\footnote{\citeauthoryear{#1}}}
%
\DeclareRobustCommand{\LaTeX}{L\kern-.42em%
        {\sbox\z@ T%
         \vbox to1.05\ht\z@{\hbox{\check@mathfonts
                              \fontsize\sf@size\z@
                              \math@fontsfalse\selectfont
                              A}%
                        \vss}%
        }%
        \kern-.2em%
        \TeX}
\DeclareRobustCommand{\sfLaTeX}{L\kern-.24em%
        {\sbox\z@ T%
         \vbox to1.05\ht\z@{\hbox{\check@mathfonts
                              \fontsize\sf@size\z@
                              \math@fontsfalse\selectfont
                              A}%
                        \vss}%
        }%
        \kern-.15em%
        \TeX}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% COLOUR
%
% Pretty colours for the title page and examples. 
% Can't use {named} model because pdflatex can't use it (yet?).
%
\definecolor{midblue}{rgb}{0.145,0.490,0.882} 
\definecolor{myred}{cmyk}{0,1,0.13,0}
\definecolor{grey}{gray}{0.7}
\definecolor{litegrey}{gray}{0.85}
\definecolor{olivegreen}{cmyk}{0.95,0,0.95,0.75}%was {0.64,0,0.95,0.40}
\definecolor{greenyellow}{cmyk}{0.15,0,0.69,0}
\definecolor{pinegreen}{cmyk}{0.92,0,0.59,0.25}
\definecolor{bluegreen}{cmyk}{0.85,0,0.33,0}
\definecolor{lavender}{cmyk}{0,0.48,0,0}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% INDEXING
%
\makeindex
%
% Shorthands to allow auto-indexing of keywords
%
\newcommand{\Linux}{Linux\index{Linux}}
\newcommand{\CTAN}{CTAN\index{CTAN}}
\newcommand{\product}[2][\relax]{%
	\mbox{\textit{#2}}%
	\if#1\relax\index{#2@\string\textit{#2}}\else
		\index{#1@\string\textit{#2}}\fi
	\if#1\relax\index{Products@\string\textbf{Products}!#2@\string\textit{#2}}\else
		\index{Products@\string\textbf{Products}!#1@\string\textit{#2}}\fi}
\newcommand{\package}[1]{%
	\mbox{\textsf{#1}}%
	\index{#1@\string\textsf{#1}}%
	\index{Packages@\string\textbf{Packages}!#1@\string\textsf{#1}}}
\newcommand{\env}[1]{%
	\mbox{\textsf{\bfseries#1}}%
	\index{#1@\string\textsf{\bfseries #1}}%
	\index{Environments@\string\textbf{Environments}!#1@\string\textsf{\bfseries #1}}}
\def\getfirst#1#2\sentinel{\def\firsttok{#1}}
\newcommand{\opt}[1]{\def\firsttok{\relax}%
	\mbox{\textsf{\itshape\lite#1}}%
	\getfirst#1\sentinel
	\ifthenelse{\equal{\firsttok}{1}}
	{\index{1@\string\textsf{\string\itshape\lite #1}}%
	\index{Options@\string\textbf{Options}!1@\string\textsf{\string\itshape\lite #1}}}
	{\index{#1@\string\textsf{\string\itshape\lite #1}}%
	\index{Options@\string\textbf{Options}!#1@\string\textsf{\string\itshape\lite #1}}}}
\newcommand{\counter}[1]{%
	\mbox{\texttt{\itshape #1}}%
	\index{#1@\string\texttt{\itshape #1}}%
	\index{Counters@\string\textbf{Counters}!#1@\string\texttt{\itshape #1}}}
\newcommand{\length}[1]{%
	\mbox{\texttt{\char'134 #1}}%
	\index{#1@\string\texttt{\char'134 #1}}%
	\index{Lengths@\string\textbf{Lengths (Dimensions)}!#1@\string\texttt{\char'134 #1}}}
\newcommand{\command}[1]{%
	\mbox{\texttt{\bfseries\char'134 #1}}%
	\index{#1@\string\texttt{\bfseries\char'134 #1}}%
	\index{Commands@\string\textbf{Commands}!#1@\string\texttt{\bfseries\char'134 #1}}}
\newcommand{\indexcommand}[1]{% like \command but silent (no output)
	\index{#1@\string\texttt{\bfseries\char'134 #1}}%
	\index{Control@\string\textbf{Control sequences}!#1@\string\texttt{\bfseries\char'134 #1}}}
\newcommand{\keyword}[1]{%
	\mbox{\textbf{#1}}%
	\index{#1|textbf}}
% Person-indexing is documented in the text. Read it!
\def\reindex #1 #2\sentinel{\index{#2, #1}}
\newcommand{\person}[1]{#1\reindex #1\sentinel}
\newcommand{\nameindex}[1]{#1\splitname #1\sentinel}
\def\splitname #1 #2\sentinel{\index{#2, #1}}
%
% Some hyphenation oddities :-)  US hyphenation-by-syllable really sucks.
%
\hyphenation{mark-up pro-fes-sio-nal Micro-soft Win-dows Linux
docu-ment docu-ments tabu-lar cross-referencing helico-pter
Post-Script si-mi-lar ad-ministra-tive Ameri-can dri-ver tech-ni-cal
style-sheets chan-ges analy-sis ge-ne-ric found-ries} 
%
% Protected BackSlash needed to allow raggedright etc in tables
%
\newcommand{\pbs}[1]{\let\tmp\\#1\let\\\tmp}
%
% Number sections down to subsubsection level, 
% but show down only as far as subsections in the Table of Contents
%
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{2}
\newcounter{hold} % for tracking continued procedure steps
\def\gfdl{\renewcommand{\thesubsection}{\thechapter.\arabic{subsection}}\let\section\subsection\setcounter{subsection}{-1}\multicolsep=1.5pc}
%
% Adjust paragraph spacing, but only for use after the ToC
%
\newcommand{\textparsettings}{%
	\setlength{\parskip}{1em plus3pt minus3pt}%
	\setlength{\parindent}{0pt}%
}
%
% Reduce space above and below lists
%
\setlength{\partopsep}{0pt}
%
% Now the hairy stuff, redefining LaTeX internals
%
% Redefine the layout for new chapter pages
%
\@openrighttrue
%\renewcommand{\chaptername}{Session}%sessions no longer.
% First, make sure we get genuinely empty pages when the chapter
% starts after a right-hand chapter-finish.
\def\cleardoublepage{\clearpage
			\if@twoside 
				\ifodd
					\c@page
				\else
					\hbox{}\thispagestyle{empty}\newpage
					\if@twocolumn
						\hbox{}\newpage
					\fi
				\fi
			\fi}
% Save blank pages in TUGboat
\renewcommand\chapter{\clearpage
	\thispagestyle{plain}%
	\global\@topnum\z@
	\@afterindentfalse
	\secdef\@chapter\@schapter}
% Redesign the opening of a chapter
%\gdef\thechapter{\Roman{chapter}}
\def\@makechapterhead#1{%
  \vspace*{1cm}%
	  {\parindent \z@ \RaggedRight \normalfont
	    \ifnum \c@secnumdepth >\m@ne
	    \Large{\scshape \@chapapp
	      \ifthenelse{\equal{\@chapapp}{\chaptername}}%
			 {\space \Roman{chapter}}%
			 {\space \thechapter}}%
	    \par\nobreak
	    \vspace*{.5in}
	    \fi
	    \interlinepenalty\@M
	    \sffamily\Huge #1\par\nobreak
	    \vspace*{36pt}}}
%
% Fix appendix switch
%
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@Alph\c@chapter}}
%
% Make a new format for the title page
%
\renewcommand{\maketitle}{\begingroup
	\thispagestyle{empty}%
	\setlength{\parindent}{0pt}%
	\begin{minipage}{32pc}
	  \begin{flushright}
	    {\fontsize{42}{42}\selectfont\bfseries\@newtitle}
	    \par\vspace*{1cm}
	    {\LARGE\bfseries
	     \hbox{\textcolor{blue}{\@subtitle}}\par}
	    \par\vspace*{1in}
	    {\sffamily\LARGE\textbf{\@author}\par}
	  \end{flushright}
	\end{minipage}
	\vfill
	\normalsize{\sffamily\textit{\@date}}
	\par\endgroup}
%
% Extra macros to make the title page work
%
\def\@subtitle{\relax}
\newcommand{\subtitle}[1]{\gdef\@subtitle{#1}}
\def\@newtitle{%
	\pscharpath[linestyle=none,fillstyle=gradient,gradbegin=yellow,
	gradend=green,gradmidpoint=1]{%
		\begin{tabular}{@{}r@{}l@{}l@{}}
			&format\\&format\\&format&\thinspace\phantom{ting}
		\end{tabular}\par}\\
		\begin{tabular}{@{}r@{}l@{\hspace*{1.33pt}}l@{}}%
		  \color{litegrey}\fontsize{36}{36}\selectfont
		  \lite\texttt{\char'134 title\char'173}&%
		  \color{olivegreen}format&%
		  \color{olivegreen}ting
		  \\
		  \color{olivegreen}in&%
		  \color{olivegreen}format&%
		  \color{olivegreen}ion%
		  \color{litegrey}\fontsize{36}{36}\selectfont
		  \lite\texttt{\char'175}
		\end{tabular}\\
	\pscharpath[linestyle=none,fillstyle=gradient,gradbegin=magenta,
	gradend=cyan,gradmidpoint=0]{%
		\begin{tabular}{@{}r@{}l@{}l@{}}
			&format\\&format\\&format&\thinspace\phantom{ting}
		\end{tabular}}}
\def\@oldtitle{%
	\pscharpath[linestyle=none,fillstyle=gradient,gradbegin=white,
	gradend=black,gradmidpoint=.5]{\begin{tabular}{@{}r@{}l@{}}
		&format\\&format\\&format\\
		&\color{blue}format\rlap{ting}\\
		\color{blue}in&\color{blue}format\rlap{ion}\\
		&format\\&format\\&format\end{tabular}}}
%
% Make section/subsection/subsubsection use sans-serif type
% and less space before and after the heading line
%
\renewcommand\section{\@startsection{section}{1}{\z@}%
			{-3ex \@plus -1.5ex \@minus -1ex}%
			{2ex \@plus.2ex}%
			{\normalfont\Large\bfseries\sffamily\RaggedRight}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
			{-2ex\@plus -1ex \@minus -.5ex}%
			{1.5ex \@plus .2ex}%
			{\normalfont\large\bfseries\sffamily\RaggedRight}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
			{-1.5ex\@plus -1ex \@minus -.5ex}%
			{1ex \@plus .2ex}%
			{\normalfont\normalsize\bfseries\sffamily\RaggedRight}}
%
% Define some running heads: for tugbook we have TUG headers at the
% top and our own at the bottom
%
\pagestyle{fancy}
\fancyhead{}
% textwidth is 32pc, TUGboat running head must be 39pc
\setlength{\headwidth}{39pc}
\renewcommand\headrulewidth{.25pt}
\fancyhead[LO]{\fontencoding{OT1}\fontfamily{cmr}\selectfont
  \footnotesize TUGboat Volume 23 (2002), No.\ 2}
\fancyhead[RO]{\fontencoding{OT1}\fontfamily{cmr}\selectfont
  \footnotesize\textit{\@title}\qquad\thepage}
\fancyhead[LE]{\fontencoding{OT1}\fontfamily{cmr}\selectfont
  \footnotesize \thepage\qquad\textit{\@title}}
\fancyhead[RE]{\fontencoding{OT1}\fontfamily{cmr}\selectfont
  \footnotesize TUGboat Volume 23 (2002), No.\ 2}
\fancyfoot[C]{}
\fancyfoot[LE]{\footnotesize\sffamily\lite\leftmark}
\fancyfoot[RO]{\footnotesize\sffamily\lite\rightmark}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[R]{\fontencoding{OT1}\fontfamily{cmr}\selectfont
  \footnotesize \textit{\@title}\qquad\thepage}
\fancyfoot[L]{\fontencoding{OT1}\fontfamily{cmr}\selectfont
  \footnotesize TUGboat Volume 23 (2002), No.\ 2}
\renewcommand{\headrulewidth}{0pt}}
%
% Give access to marginal notes (geometry controls the margins)
%
\newcommand{\marginal}[1]{\marginpar{\hbox to0pt{\hspace*{.7in}\tiny#1\hss}}}
%
% Make a `keycap' icon
%
\newlength{\keywidth}
\newlength{\keyheight}
\newlength{\keydepth}
\newcommand{\key}[1]{\begingroup\small
	\setlength{\fboxsep}{1pt}%
	\settowidth{\keywidth}{\sffamily#1}%
	\ifdim\keywidth<1em\setlength{\keywidth}{1em}\fi
	\settoheight{\keyheight}{Xfl)}%
	\settodepth{\keydepth}{)yj}%
	\ovalbox{\hbox to\keywidth{\hss\sffamily#1\hss
		\vrule height\keyheight depth\keydepth width0pt}}%
	\endgroup}%
% Also make a typewriter-font version
\newcommand{\ttkey}[1]{\begingroup\small
	\setlength{\fboxsep}{1pt}%
	\settowidth{\keywidth}{\ttfamily#1}%
	\ifdim\keywidth<1em\setlength{\keywidth}{1em}\fi
	\settoheight{\keyheight}{Xfl)}%
	\settodepth{\keydepth}{)yj}%
	\ovalbox{\hbox to\keywidth{\hss\ttfamily#1\hss
		\vrule height\keyheight depth\keydepth width0pt}}%
	\endgroup}%
% And a button-bar icon version
\newcommand{\icon}[1]{\begingroup\small
	\setlength{\fboxsep}{1pt}%
	\settowidth{\keywidth}{\sffamily#1}%
	\ifdim\keywidth<1em\setlength{\keywidth}{1em}\fi
	\settoheight{\keyheight}{Xfl)}%
	\settodepth{\keydepth}{)yj}%
	\fbox{\hbox to\keywidth{\hss\sffamily#1\hss
		\vrule height\keyheight depth\keydepth width0pt}}%
	\endgroup}%
% And some utilities to allow description of menu options
\newcommand{\with}{--}
\newcommand{\fby}{~~}
%
% Make slanted fractions for use outside math mode
%
\newcommand{\Frac}[2]{%
	\raisebox{.5ex}{\scriptsize#1}\kern-.25em/%
	\kern-.25em\raisebox{-.333ex}{\scriptsize#2}\thinspace}
%
% Redefine some front matter appearances
%
\renewenvironment{abstract}{%
      \clearpage
      \section*{\abstractname}%
      \@mkboth{\MakeUppercase\@title}{\MakeUppercase\abstractname}}%
     {\par\vfil\null}
%
\renewcommand\tableofcontents{\clearpage
    \section*{\contentsname}%
    \@mkboth{\MakeUppercase\@title}{\MakeUppercase\contentsname}%
    \thispagestyle{plain}\begingroup
    \fontsize{9}{11.5}\selectfont\@starttoc{toc}\par\endgroup}
% appendix numbers were getting too close to the text
\renewcommand*\l@section{\@dottedtocline{1}{2em}{2.5em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{4em}{3.5em}}
% New list of exercises
\newcommand\listofexercises{%
    \section*{Exercises}%
      \@mkboth{CONTENTS}%
              {CONTENTS}%
    \begingroup
    \fontsize{9}{11.5}\selectfont\@starttoc{loe}\par\endgroup}
%
\renewenvironment{thebibliography}[1]{%
  \clearpage\begingroup\section*{\bibname}%
  \@mkboth{\MakeUppercase\@title}{\MakeUppercase\bibname}%
  \list{\@biblabel{\@arabic\c@enumiv}}%
       {\settowidth\labelwidth{\@biblabel{#1}}%
         \leftmargin\labelwidth
         \advance\leftmargin\labelsep
         \@openbib@code
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
       \sloppy\RaggedRight
       \clubpenalty4000
       \@clubpenalty \clubpenalty
       \widowpenalty4000%
       \sfcode`\.\@m}
  {\def\@noitemerr
    {\@latex@warning{Empty `thebibliography' environment}}%
    \endlist\endgroup}
%
% For the index, let the titling be handled by the source code, 
% as there are comments to be included after the title and before
% the index body.
%
\renewenvironment{theindex}
               {\@mkboth{\MakeUppercase\@title}%
                        {\MakeUppercase\indexname}%
		\begin{multicols}{2}%
                \parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem}
               {\end{multicols}\clearpage}
% Add a new description for named prelims
\newcommand{\prelim}[1]{\clearpage
    \section*{#1}\addcontentsline{toc}{section}{#1}%
    \@mkboth{\MakeUppercase\@title}{\MakeUppercase{#1}}}
%
% Fix floating footnotes (c.t.t. 22 Oct 2001 Donald Arseneau)
% Message-ID: <yfi1yjvxnzw.fsf@triumf.ca>, thanks Don.
%
\def\footnoterule{\kern-3\p@
	\nobreak \vfill
	\hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high
%
\newcommand{\tablefootnote}[1]{\raisebox{.667ex}{\kern.1em\scriptsize\ref{#1}}}
%
% Add a fake linebreak for illustration
%
\newcommand{\fakebreak}{\linebreak}
%
% Some artefacts of transformation from XML
%
\newcommand{\mdash}{~--- }
\newcommand{\ndash}{--}
\newcommand{\amp}{\&}
\newcommand{\dito}{\raisebox{-.5ex}{''}}
\newcommand{\guiicon}[1]{{\setlength{\fboxsep}{1pt}%
	\colorbox{grey}{\color{white}\small\textsf{#1}}}}
%
% Change the name of the Abstract
%
\renewcommand{\abstractname}{Summary}
%
% Sidebars, Exercises and Warnings
\newenvironment{sidebar}{%
	\begin{Sbox}\begin{minipage}{.85\textwidth}}%
	{\end{minipage}\end{Sbox}%
		\begin{center}\setlength{\fboxsep}{6pt}%
		\shadowbox{\TheSbox}\end{center}}
\newenvironment{warning}{%
	\begin{Sbox}\begin{minipage}{.85\textwidth}\sffamily\small\RaggedRight}%
	{\end{minipage}\end{Sbox}%
		\begin{center}\setlength{\fboxsep}{6pt}%
		\colorbox{litegrey}{\TheSbox}\end{center}}
% fancybox's thin double lines are too thin for Adobe Acrobat to
% render properly.
\def\@doublebox#1{%
  \begingroup
    \setbox\@fancybox\hbox{{#1}}%
    \fboxrule=.25pt% was .75\fboxrule
    \setbox\@fancybox\hbox{\fbox{\box\@fancybox}}%
    \fboxrule=2\fboxrule
    \fboxsep=\fboxrule
    \advance\fboxsep 2pt% instead of .5pt
    \fbox{\box\@fancybox}%
  \endgroup}
\newcounter{exercise}
\newenvironment{exercise}{\refstepcounter{exercise}%
	\begin{Sbox}\begin{minipage}{.85\textwidth}\sffamily\RaggedRight
		\setlength{\parindent}{1em}%
		\noindent{\scshape\small Exercise \theexercise}}%
	{\end{minipage}\end{Sbox}%
		\begin{center}\setlength{\fboxsep}{6pt}%
		  \doublebox{\TheSbox}%
	        \end{center}}
\newenvironment{example}{%
	\begin{Sbox}\begin{minipage}{.85\textwidth}}%
	{\end{minipage}\end{Sbox}%
		\begin{center}\setlength{\fboxsep}{6pt}%
		\fbox{\TheSbox}\end{center}}
\newlength{\boxedwidth}
\newcommand{\resetboxedwidth}[1]{%
	\setlength{\boxedwidth}{\columnwidth}
	\addtolength{\boxedwidth}{-2.5\fboxsep}
	\addtolength{\boxedwidth}{-2\fboxrule}
	\addtolength{\boxedwidth}{-#1}
        \addtolength{\boxedwidth}{-\leftmargin}}
\newenvironment{sourcecode}[1][0pt]{%
	\setlength{\fboxsep}{1pc}\resetboxedwidth{#1}%
	\begin{Sbox}
	\begin{minipage}{\boxedwidth}}
	{\end{minipage}
	\end{Sbox}
	\begin{center}
	\cornersize*{1pc}\ovalbox{\TheSbox}
	\end{center}}
%
\index{options|see{Class Options}}
\newcommand{\emstrut}{\vrule height1em width0pt}
%
% Macro for menus
%
\newlength{\menuwidth}
\newlength{\menuitemwidth}
\newlength{\menusubitemwidth}
\newlength{\menumaxwidth}
\newlength{\menumaxheight}
\newlength{\menumaxdepth}
\newlength{\menuheight}
\newcommand{\menu}[1]{{\setlength{\fboxsep}{1pt}%
  \setlength{\fboxrule}{.25pt}%
  \settowidth{\menuwidth}{\bfseries #1}%
%	\addtolength{\menuwidth}{2ex}%
  \raisebox{\fboxsep}{\fbox{\hbox to\menuwidth{\scriptsize
	\sffamily\bfseries\vphantom{()}#1\hss\tiny\HandLeftUp}}}}}
\newcommand{\menuitem}[2]{%
  \@ifnextchar[{\@menusubitem{#1}{#2}}{\@menuitem{#1}{#2}}}
\newcommand{\@menuitem}[2]{%
	\settoheight{\menumaxheight}{AhMI(l'}%
	\settodepth{\menumaxdepth}{jJ,)yp}%
	{\scriptsize\sffamily
	\setlength{\fboxsep}{1pt}\setlength{\fboxrule}{.25pt}%
	\settowidth{\menuwidth}{\bfseries #1}%
	\settoheight{\menuheight}{\bfseries\vphantom{()}#1}%
	\addtolength{\menumaxheight}{-\menuheight}%
	\settowidth{\menuitemwidth}{#2}%
	\settodepth{\menumaxdepth}{\vphantom{(yjp)}#2}%
	\ifdim\menuitemwidth>\menuwidth
		\menumaxwidth=\menuitemwidth
	\else
		\menumaxwidth=\menuwidth
	\fi
	\addtolength{\menumaxwidth}{2em}%
	\raisebox{\menumaxheight}{\colorbox{black}{\hbox 
	    to\menumaxwidth{\color{white}\bfseries\vphantom{(yjp)}#1\hss}}}%
	\kern-\menumaxwidth\kern\menuwidth
	\raisebox{-\menumaxdepth}{\fcolorbox{black}{white}{\hbox 
		to\menumaxwidth{\color{black}\vphantom{(yjp)}#2\hss\tiny\HandLeftUp}}}} }
\def\@menusubitem#1#2[#3]{%
	\settoheight{\menumaxheight}{AhMI(l'}%
	\settodepth{\menumaxdepth}{jJ,)yp}%
	{\scriptsize\sffamily
	\setlength{\fboxsep}{1pt}\setlength{\fboxrule}{.25pt}%
	\settowidth{\menuwidth}{\bfseries#1}%
	\settoheight{\menuheight}{\bfseries\vphantom{()}#1}%
	\addtolength{\menumaxheight}{-\menuheight}%
	\settowidth{\menuitemwidth}{#2}%
	\settowidth{\menusubitemwidth}{\itshape #3}%
	\settodepth{\menumaxdepth}{\itshape\vphantom{(yjp)}#3}%
	\ifdim\menuitemwidth>\menuwidth
		\ifdim\menusubitemwidth>\menuwidth
			\menumaxwidth=\menusubitemwidth
		\else
			\menumaxwidth=\menuitemwidth
		\fi
	\else
		\ifdim\menusubitemwidth>\menuwidth
			\menumaxwidth=\menusubitemwidth
		\else
			\menumaxwidth=\menuwidth
		\fi
	\fi
	\addtolength{\menumaxwidth}{2em}%
	\raisebox{\menumaxheight}{\fbox{\hbox to\menumaxwidth{\bfseries
			\vphantom{(yjp)}#1\hss}}}%
	\kern-\menumaxwidth\kern\menuwidth
	\raisebox{\fboxsep}{\fcolorbox{black}{white}{\hbox 
		to\menumaxwidth{\color{black}\vphantom{(yjp)}#2\hss}}}%
	\kern-\menumaxwidth\kern\menuitemwidth
	\raisebox{-\menumaxdepth}{\colorbox{black}{\hbox 
		to\menumaxwidth{\color{white}\itshape\vphantom{(yjp)}#3\hss
		\upshape\tiny\HandLeftUp}}}}}
\newcommand{\smiley}{%
	\smash{\raisebox{.75ex}{%
		\setlength{\tabcolsep}{0pt}\footnotesize
		\begin{tabular}c.\thinspace.\\[-1ex]%
			\texttt{\char'015}\\[-1.1em]%
			$\smile$\\[-1.5em]\large$\bigcirc$\end{tabular}}}}
\def\dotfill{%
  \leavevmode\thinspace
  \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
  \kern\z@}
%
% Set a date and version number for this stylesheet
%
\newcounter{version}
\newcounter{issue}
% History
% v0.1 developed 1999 but never released
% v1.* rewritten 2000 as training document but incomplete
% v2.1 completed December 2001, notified to c.t.t 2001-12-14
% v2.2 finished Yuletide 2001, only minor typos
% v2.3 conversion from SGML to XML started
% v3.0 XML done, front redesigned, loads of changes suggested by readers
% v3.4 revised and reset for TUGboat
\setcounter{version}{3}
\setcounter{issue}{4}
%\newcommand{\releasedate}{November 2001}%2.1
%\newcommand{\releasedate}{December 2001}%2.2
%\newcommand{\releasedate}{March 2002}%2.3
%\newcommand{\releasedate}{January 2003}%3.0
\newcommand{\releasedate}{November 2003}%3.4
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%