summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pracjourn/pracjourn.dtx
blob: 423db39c8a91405de4cb58e2f73b9b3650691d93 (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
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
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
% \iffalse
% Copyright (C) 2004 TeX Users Group.
% 
%    This program is free software; you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation; either version 2 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program; if not, write to the Free Software
%    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
%
%<*driver>
\ProvidesFile{pracjourn.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{pracjourn}
%<*class>
    [2007/08/25 v0.4n PracTeX Journal Class]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{hyperref,multicol}
\EnableCrossrefs
\CodelineIndex
\RecordChanges

\makeatletter
\usepackage{amsmath,amssymb,array,calc,graphicx,hyperref,ifpdf,ifthen,varioref}
\usepackage[osf]{mathpazo}
\renewcommand\sfdefault{lmss}
\renewcommand\ttdefault{lmtt}
\usepackage[T1]{fontenc}
\ifpdf\IfFileExists{microtype.sty}{\usepackage[protrusion=true,expansion=false]{microtype}}{}\fi
\linespread{1.069}      % Palatino needs more space between lines
\frenchspacing         % Remove ugly extra space after punctuation
\hypersetup{colorlinks, breaklinks, linktocpage,
  linkcolor=red, citecolor=red, filecolor=blue, urlcolor=blue}
\setlength\extrarowheight{2pt} % Make tables bearable
% Crude referencing commands:
\newcommand\tabref[1]{Table~\vref{tab:#1}}
\newcommand\figref[1]{Figure~\vref{fig:#1}}
\newcommand\secref[1]{Section~\vref{sec:#1}}
% Various labelling commands:
\newcommand*\name[1]{\textsc{#1}}
\newcommand*\pkg[2][]{\relax
  \edef\@tempa{#1}\relax
  \ifx\@tempa\@empty
    \textsf{#2}\else
    \href{#1}{\textsf{#2}}\fi}
\newcommand*\env[1]{\textsf{#1}}
\let\latin\textit
\def\eg{\latin{e.g.}}
\def\ie{\latin{i.e.}}
\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}}
% Better float parameters: (from the TeX FAQ)
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
% Section heading customisation:
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3ex \@plus -1ex \@minus -.2ex}%
                                   {2ex \@plus 0.2ex}%
                                   {\centering\normalsize\scshape}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-2.5ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus 0.2ex}%
                                     {\centering\normalsize\itshape}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-2ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus 0.2ex}%
                                     {\centering\normalfont\normalsize}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\itshape}}
\let\subparagraph\undefined
\def\@maketitle{%
  \newpage
  {\centering
   {\large\@title\par}\vskip1em
   \textsc\@author\par\vskip1em
   \@date\par}\vskip2em}
% Abstract customisation:
\renewenvironment{abstract}{%
  \begin{trivlist}\item[]
    \setlength\leftskip{0.15\textwidth}
    \setlength\rightskip{0.15\textwidth}
    \small\textit{Abstract}\quad}{\end{trivlist}}                                      
% TOC customisation: Make it two-column to save space;
%   Remove leaders in the TOC, replace with \quad.
\setcounter{tocdepth}{2}
\renewcommand\tableofcontents{%
  \section*{\contentsname}
  \begin{trivlist}\item[]
    \begin{multicols}{2}
      \setlength\parskip{0pt}
      \small
      \@starttoc{toc}%
    \end{multicols}
  \end{trivlist}}
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \raggedright
      \parindent \z@ 
      \rightskip \z@
      \parfillskip \@flushglue
      \leavevmode
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\quad\nobreak#2\hfil\par
    \endgroup
  \fi}
\def\@dottedtocline#1#2#3#4#5{% 
  \ifnum #1>\c@tocdepth \else 
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip \@flushglue
     \parindent #2\relax\@afterindenttrue 
     \interlinepenalty\@M 
     \leavevmode 
     \raggedright
     \@tempdima #3\relax 
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip 
     {#4}\quad\nobreak#5\hfil\par}% 
  \fi}
% Better footnotes:
\let\old@makefntext\@makefntext
\renewcommand\@makefntext[1]{%
  \vspace{2pt}%
  \setlength\parindent{-1.8em}%
  \setlength\leftskip{1.8em}%
  \makebox[1.8em][l]{\normalfont\small\@thefnmark.}#1}
% LOGOS, tuned for Palatino:
\def\TeX{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}

\newcommand\TODO[1]{\marginpar{\raggedright\itshape\color{red}TODO: #1}}

\begin{document}
  \DocInput{pracjourn.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{0}
%
%
% \changes{v0.0}{2004/10/03}{KB: Initial version}
% \changes{v0.2}{2004/11/13}{KB: Palatino, no date printing}
% \changes{v0.3}{2005/01/03}{AO: Add \cmd\TPJissue, \cmd\TPJrevision, \cmd\TPJcopyright}
% \changes{v0.3}{2005/01/03}{AO: Rewrite using \LaTeXe{} idioms}
% \changes{v0.3a}{2005/01/03}{AO: changes to \cmd\TPJissue, \cmd\TPJrevision, \cmd\TPJcopyright}
% \changes{v0.3b}{2005/01/07}{AO: change \cmd\evensidemargin}
%
%
% \GetFileInfo{pracjourn.dtx}
%
% \DoNotIndex{\if}
%
% \title{The \textsf{pracjourn} class}
% \author{%
%  Karl Berry \\
%  Arthur Ogawa\\
%  Will Robertson\\
%  Correspondence to: \texttt{pracjourn@tug.org}}
% \date{\filedate\qquad\fileversion}
%
% \maketitle
%
% \begin{abstract}
%   \noindent\textsf{pracjourn} is a class based on \texttt{article.cls}, 
%   to be used for typesetting articles in The Prac\TeX\ Journal, 
%   \url{http://tug.org/pracjourn}.
% \end{abstract}
%
% \tableofcontents
% 
% \section{Introduction}
%
% The \pkg{pracjourn} \LaTeX{} document class is to be used for
% articles written for the The Prac\TeX\ Journal,
% \url{http://tug.org/pracjourn}.  The source for the document class
% resides at \url{http://tug.org/pracjourn/dtx}, and is also
% available at CTAN.
%
% \section{Usage}
%
% Refer to the sample document, \url{www.tug.org/pracjourn/dtx/pjsample.tex},
% for context. Issue a |\documentclass{pracjourn}| command at
% the beginning of your document as usual. No class options are necessary.
%
% This document class automatically loads the packages 
% \pkg{color}, \pkg{graphicx}, \pkg{hyperref}, and \pkg{textcomp}. 
% These are all standard packages in every \TeX\ distribution.
%
% \subsection{Formatting}
%
% Page metrics are appropriate for printing on either A4 or
%   letter size paper. The type size is 12/15.5 Palatino. 
% Except in exceptional circumstances, please refrain from 
%   using typefaces other than those defined by this class.
%
% Hyperlinks are inserted automatically in the relevant locations in
% a dark blue colour. If you wish to adjust this colour to suit your
% own colour requirements, simply redefine the \texttt{linkcolour}. E.g.,
% to change it to dark red,\\
% \indent|\definecolor{linkcolour}{rgb}{0.7,0.2,0.2}|.
%
% \subsection{Author/article metadata}
%
% All author and article information must be defined before \cmd\maketitle, which 
% should probably be the first thing after |\begin{document}|.
% 
% \DescribeMacro{\author}
% \DescribeMacro{\title}
% \DescribeMacro{\abstract}
% The \cmd\author, \cmd\title, and \cmd\abstract\ commands are used to
%   define those pieces of metadata about the article, and are mandatory.
% Note that the \cmd\abstract\ is a plain old command, \emph{not} an environment.
%
% \DescribeMacro{\noabstract}
% Should you have a reason for not having an abstract,
%     this may be signified by declaring \cmd\noabstract\ instead.
%
% \DescribeMacro{\license}
% It is optional to specify a copyright and/or license declaration, 
%   to be typeset in the footer of the first page, with the \cmd\license\
%   command.\footnote{The \cmd\TPJcopyright\ command, which used to provide this
%   functionality is still provided for backwards compatibility.}
%
% \DescribeMacro{\email}
% \DescribeMacro{\website}
% \DescribeMacro{\address}
% Additional author information may be specified, to be typeset appropriately,
%   with the following commands: \cmd\email, \cmd\website, and \cmd\address.
%   
%   If the \pkg{switcheml} package is installed somewhere that
%     \TeX\ will find it, it is loaded for the purpose of obfuscating
%     the typeset email address. This is done to prevent harvesting by
%     spammers, but if the package cannot be found the email address
%     will by typeset as a hyperlink. 
%
% \DescribeMacro{\hyperlinkemail}
%   Should you wish to typeset your
%     email address as a hyperlink (that is, theoretically harvestable
%     by spammers) despite having \pkg{switcheml} installed, you may
%     simply include the command \cmd\hyperlinkemail\ anywhere before
%     \verb|\begin{document}|.
%
% \subsubsection{Adding more author/article information}
%
% As previously
% mentioned, this class provides the \cmd\email, \cmd\website, and \cmd\address\
% macros for typesetting that information in the header block. These commands are defined 
% in the source code of the class file with (something like) the following:\footnote{\cmd\typesetemail\ is an internal command defined by either \cmd\hyperlinkemail\ or \cmd\obfuscateemail.}
% \begin{quote}
%   |\addinfo[\typesetemail]{Email}|\\
%   |\addinfo[\url]{Website}|\\
%   |\addinfo{Address}|
%  \end{quote}
% Additional blocks my be added on a per-article basis in the same manner.
%
% \DescribeMacro{\addinfo}
% To be specific, the \cmd\addinfo\ command takes one mandatory argument,
% which is the title of the item to be added to the list, and one optional
% argument, which is used to define the formatting of the block.
%
% This command will then define the macro used to input the additional information
% by taking the lowercase of the title of the information and turning it into
% a \TeX\ macro.
%
% \DescribeMacro{\newinfo}
% If lowercasing the heading to create the macro name is impractical 
% (due to accents, for example), then this command can be used instead:
% \begin{quote}
%   |\newinfo\resume[\color{red}]{R\'esum\'e}|
%  \end{quote}
%
% The names used in the article metadata (`Email', `R\'esum\'e', etc.) can be redefined as follows:
% \begin{quote}
%   |\renewcommand\emailname{Email}|\\
%   |\renewcommand\resumename{Resume}|
%  \end{quote}
% These macros are defined automatically by \cmd\addinfo/\cmd\newinfo.
%
% \DescribeMacro{\addinfospace}
% If you wish to add some vertical space after the previous item in the front matter,
% the \cmd\addinfospace\marg{height} command will insert some. This may be necessary
% after multi-line blocks, which require some breathing room.
%
% \DescribeMacro{\clearinfo}
% If you don't like the ordering of the information blocks or you wish to edit
% the formatting of the current setup, the \cmd\clearinfo\ command allows you to start
% fresh and redefine the info blocks however you may wish.
%
% \subsection{Additional user commands}
% \DescribeMacro{\dash} For `smart' dashes in text. Thinly spaced from the text, it ignores surrounding spaces, and permits only succeeding line breaks.
%   \begin{quote}
%  |use like this \dash for consistent dashes|
%   \end{quote}
%   produces `use like this \unskip\thinspace\nobreak\textemdash\thinspace for consistent dashes'.
%
%
% \DescribeMacro{\note} For easier footnotes. This command ignores preceding space, so linebreaks before the footnote text in the source will not give the wrong spacing.
%   \begin{quote}
%  |And here's an example.|\\
%  |  \note{Albeit a trivial one.}|\\
%  |And continuing|
%   \end{quote}
%   produces `And here's an example.
%    \unskip\footnote{Albeit a trivial one.}
%   And continuing'.
%
% \DescribeEnv{itemise} For non-US writers, it is probably more natural
% to use |\begin{itemise}| over what \LaTeX\ provides by default.
%
% \DescribeMacro{\ctanfile}
% \changes{v0.4j}{2006/02/09}{Implemented.}
% \DescribeMacro{\ctanloc}
% \changes{v0.4j}{2006/02/09}{Implemented.}
% These commands are used to refer to online locations and documentation within the Comprehensive \TeX\ Archive Network. Usage is as follows:
% \begin{quote}
%   |\ctanfile{macros/latex/contrib/titlesec/titlesec.pdf}|\\
%   |\ctanloc{macros/latex/contrib/titlesec/}|
% \end{quote}
% It will print the input prefixed with `CTAN:' and provide a hyperlink to the location.
%
% \subsection{TPJ internal commands}
% 
% Two commands are to be used at the direction of the Prac\TeX\
%   production team: \cmd\TPJrevision\ and \cmd\TPJissue. These
%   commands typeset information in the header of the first page
%   relating to the revision number (or date) of the article and the
%   issue number of the journal.
% 
% This document class creates a file \verb+_rev.tex+ in the
%   current directory (if a \cmd\TPJrevision{} statement is present)
%   and reads a file \verb+_iss.tex+, if present.  Please keep a
%   separate directory for each article you develop for TPJ.
%
% \subsection{Logos}
%
% \begingroup
%
% \DeclareRobustCommand\TeX{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}
% \DeclareRobustCommand\LaTeX{L\kern-.32em\raise.37ex\hbox{\scalebox{0.76}{A}}\kern-.15em\TeX}
% \DeclareRobustCommand\LaTeXe{\LaTeX2$_{\textstyle\varepsilon}$}
% \DeclareRobustCommand\BibTeX{B{\textsc i\kern-.025em\textsc b}\kern-.08em\TeX}
% \DeclareRobustCommand\logofamily{%
%   \not@math@alphabet\logofamily\relax
%   \fontencoding{U}\fontfamily{logo}\selectfont}
% \def\textlogo#1{{\logofamily#1}}
% \DeclareRobustCommand\MF{\textlogo{METAFONT}\@}
% \DeclareRobustCommand\MP{\textlogo{METAPOST}\@}
% \DeclareRobustCommand\ConTeXt{C\kern-.03em on\-\kern-.10em\TeX\kern-0.04em t}%
% \DeclareRobustCommand\pdfTeX{pdf\/\TeX}
% \DeclareRobustCommand\pdfLaTeX{pdf\/\LaTeX}
% \DeclareRobustCommand\PS{PostScript}
% \DeclareRobustCommand\PracTeX{Prac\kern-0.07em\TeX}
% \DeclareRobustCommand\TPJ{The \PracTeX\ Journal}
% \DeclareRobustCommand\XeTeX{\relax
%       X\lower.5ex\hbox{\kern-.07em\reflectbox{E}}\relax
%       \kern-.15em\TeX}
% \DeclareRobustCommand\ExTeX{\textrm{\relax
%    \ensuremath{\textstyle\varepsilon\sb{\kern-0.15em\mathcal{X}}}\relax
%    \kern-.15em\TeX}}
% The following logos and abbreviations are defined for your
% convenience: 
% \begin{multicols}{2}\everypar{\parindent0pt\parskip0pt}
% \def\showlogo#1{\@for\@ii:=#1\do{\expandafter\cmd\@ii:\hfill\@ii\endgraf}}
% \noindent\showlogo{\noexpand\TeX,\LaTeX,\LaTeXe,\BibTeX,\MF,\MP,
%   \ConTeXt,\pdfTeX,\pdfLaTeX,\XeTeX,\ExTeX,\PracTeX,\TPJ,\PS}
% \end{multicols}
% \endgroup
%
% \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex}
%
% \section{History}
%
% The first revision of this class was written by Karl Berry.
% KB: Gratefully based on the \texttt{dtxtut} skeleton.
%
% Revised by Arthur Ogawa, 2004/01/03, to include new features, per
% Lance Carnes, as follows:
%
% \begin{enumerate}
% \item Define an \cmd\articleID{} macro which typesets the article
%   identification in a block somewhere on the first page of the
%   article, and which can be used to identify the article/revision
%   date for reader comments.  E.g. if this appears in the article
%   source file:
% \begin{verbatim}
% \author{A.U. Thor}
% \title{Pracjourn Sample}
% \TPJissue{TPJ Vol 1 No 1, 2005-1-15}
% \TPJrevision{2005-2-12}%
% \TPJcopyright{\textcopyright\ 2005 TeX Users Group}
% \end{verbatim}
%   it will become a block of text typeset on the first page of the
%   article.  See
%   e.g. \href{http://www.ams.org/bull/2004-41-04/S0273-0979-04-01032-8/S0273-0979-04-01032-8.pdf}{this example PDF}.
%
% \item Write the information from the argument of the
%   \cmd\articleID{} macro into a file called \verb+_id.tex+.  Put
%   this file in the same directory as the source file, and overwrite
%   any previous files of the same name.
%
% \item Define a \cmd\TPJcopyright{} macro which will print a
%   copyright notice at the bottom of the first page.
%   E.g. \cmd\TPJcopyright\verb+{2005 TeX Users Group}+ will produce
%   ``\copyright2005 TeX Users Group'' in the page footer of the title
%   page.
%
% \item The page measures should work with both Letter and A4 paper
%   sizes.
% \end{enumerate}
%
% Revised again by Will Robertson, mid-2005, to implement some
% extra things. This snow-balled into the current version, a description
% of which here would be redundant.
%
% \clearpage
% \section{Implementation}
%
% The is fairly poorly documented, and the
% class has undergone a multitude of small changes over the TPJ issues
% 2005-4, 2006-1. It should now be fairly stable, and over time it's
% conceivable (but unlikely) that the descriptions herein will be improved.
%
% \subsection{Base class and options}
%
% Use \LaTeX's \pkg{article} class, but at a bigger default type size.
%
% KB: 12pt seems a little too big, 11pt seems a little too small.
% Implementing 11.5pt is not obvious.
%
% \changes{v0.3}{2004/01/03}{AO: Override the default option list of
%   \pkg{article.cls}}
%
% If the document instance calls for options that conflict with the
% following choices, then the document wins.  However our default
% option list is not the same as those of \pkg{article.cls}.
%    \begin{macrocode}
\let\ExecuteOptions@ltx\ExecuteOptions
\def\ExecuteOptions#1{%
 \ExecuteOptions@ltx{letterpaper,12pt,oneside,onecolumn,final}%
}%
\LoadClassWithOptions{article}
\let\ExecuteOptions\ExecuteOptions@ltx
%    \end{macrocode}
%
% \subsection{Metrics}
%
% Default leading (from \texttt{classes.dtx}) for 11pt is 13.6pt
% leading, for 12pt is 14.5pt.  We want more---this factor gives us
% 12pt type on 15.5pt leading.
%    \begin{macrocode}
\linespread{1.069}
%    \end{macrocode}
% 
% Change the text width to something that works for both A4 and
% Letter paper, as well as possible.
%
% xx The vertical dimensions need to be changed as well, perhaps
% for a 9in text height, taking account of the headline and
% footline.
%    \begin{macrocode}
\setlength\textwidth{432pt}
\setlength\oddsidemargin{18pt}% xx depend on letter/a4
\setlength\evensidemargin{18pt}
%    \end{macrocode}
%
% \subsection{Package loading}
%
% Palatino, including math (sc option for true small caps, not in TL
% 2003).  Try for \pkg{mathpazo}; if not available use \pkg{palatino}.
%
% Enable pdf\TeX's margin kerning, if available, but \emph{not} font expansion,
% which increases the size and complexity of the resultant PDF. This side-effect
% may be deemed negligible in the future.
%
% \changes{v0.3}{2004/01/03}{AO: rewrite using \cs{IfFileExists} idiom.}
% \changes{v0.4e}{2005/08/22}{WR: requires the textcomp package}
% \changes{v0.4g}{2005/11/04}{WR: use \pkg{microtype}, if available}
% \changes{v0.4l}{2006/08/14}{WR: use LM fonts if available, with T1 encoding}
%
% The \pkg{textcomp} package is loaded in order to provide a nice looking copyright logo, amongst other things.
%
%    \begin{macrocode}
\IfFileExists{lmodern.sty}{%
  \RequirePackage{lmodern}
  \usepackage[T1]{fontenc}}{}
\IfFileExists{mathpazo.sty}
             {\RequirePackage[sc]{mathpazo}}
             {\renewcommand\rmdefault{ppl}}
\IfFileExists{microtype.sty}{%
  \RequirePackage[protrusion=true,expansion=false]{microtype}}{}
\RequirePackage{textcomp}             
%    \end{macrocode}
% \pkg{hyperref} is used for creating live hyperlinks, as well as
% providing \cmd\url\ for typesetting URLs easily. All hyperlinks
% are coloured in a dark shade of blue.
%    \begin{macrocode}
\RequirePackage{color,hyperref,graphicx}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks,
            linkcolor=linkcolour,citecolor=linkcolour,
            filecolor=linkcolour, urlcolor=linkcolour}
%    \end{macrocode}
% \TODO{update this to use the successor to the switcheml package}
% If the \pkg{switcheml} package is installed in the author's
% system, use it to obfuscate their email address by default. Otherwise, just
% use a hyperlink. The commands to do this are defined in a later section.
%
%
% An author may specify \cmd\hyperlinkemail\ explicitly
% should they not care to obfuscate their email address even with the \pkg{switcheml}
% package installed.
%    \begin{macrocode}
\IfFileExists{switcheml.sty}
             {\RequirePackage{switcheml}
              \AtBeginDocument{\@ifx@undefined{\typesetemail}{\obfuscateemail}{}}}
             {\AtBeginDocument{\@ifx@undefined{\typesetemail}{\hyperlinkemail}{}}}
%    \end{macrocode}
%
%
% \subsection{Amendments from \pkg{article}}
%
% \begin{macro}{\maketitle}
% Printing the date of the last \TeX\ run in the title block does
% not seem warranted---if someone reprocesses the document with no
% changes, we wouldn't want the date to change.
%
% xx use rcs.sty or something?
%
% xx include bibtex id?
%
% \changes{v0.3}{2004/01/03}{AO: reproduce entire definition from
%   \texttt{article.cls}, with modifications.}
% \changes{v0.3}{2004/01/03}{AO: \cmd\thispagestyle{titlepage}. Do
%   not empty out \cmd\@author, \cmd\@title, etc.}
% \changes{v0.4b}{2005/06/26}{WR: removed some twocolumn conditional code.}
% \changes{v0.4b}{2005/06/26}{WR: added check for an abstract}
%    \begin{macrocode}
\renewcommand\maketitle{\par
  \iftpj@noabstract\else
    \@ifx@undefined{\tpj@info@\string\abstract}
      {\ClassError{pracjourn}
        {Please specify an \string\abstract\space before \string\maketitle}
        {It is a PracTeX Journal requirement to include an abstract.   \MessageBreak 
                                                                       \MessageBreak
         If you have exceptional reasons for not having one in this    \MessageBreak
         article, write \string\noabstract\space somewhere before \string\maketitle.}}{}
  \fi
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \newpage
    \global\@topnum\z@   % Prevents figures from going at top of page.
    \@maketitle
    \thispagestyle{titlepage}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}%
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\@maketitle}
%
% \changes{v0.4a}{2005/06/13}{WR: various changes to accommodate extras.}
%    \begin{macrocode}
\def\@maketitle{%
  \newpage
  \null
  \write@ID@aux\read@issue
  \begin{flushleft}
    \let\footnote\thanks
    \begingroup\LARGE \@title  \par\endgroup
    \vspace{2ex}%
    \begingroup\large \@author \par\endgroup
  \end{flushleft}
%    \end{macrocode}
% This is where the extra author information is typeset. As various
% pieces of information are defined, they fill up the \cmd{\tpj@optional@author@info}
% macro, which is subsequently used here as per the definition of the author.
%    \begin{macrocode}
  \tpj@optional@author@info
  \iftpj@noabstract\else
    \vspace{2ex}%
    \tpj@info@container{\abstractname}{\abstract}
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Formatting changes}
% \begin{macro}{\section}
% \begin{macro}{\subsection}
% \begin{macro}{\subsubsection}
% \begin{macro}{\paragraph}
% \begin{macro}{\subparagraph}
% Remove bold from the all the section headings, just for something a
% little different. This is verbatim from \texttt{article.cls} with a
% bunch of \cmd\bfseries's omitted. \TODO{just use titlesec instead}
%    \begin{macrocode}
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                     {-3.5ex \@plus -1ex \@minus -.2ex}%
                                     {2.3ex \@plus.2ex}%
                                     {\normalfont\Large\raggedright}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\raggedright}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\raggedright}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                     {3.25ex \@plus1ex \@minus.2ex}%
                                     {-1em}%
                                     {\normalfont\normalsize\itshape}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                     {3.25ex \@plus1ex \@minus .2ex}%
                                     {-1em}%
                                     {\normalfont\normalsize\itshape}}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% \changes{v0.4i}{2006/01/19}{Added \cs{raggedright} to section headings.}
% \end{macro}
%
% \paragraph{Lists}
% \begin{environment}{itemize}
% \begin{environment}{enumerate}
% \begin{environment}{description}
% \TODO{just use enumitem instead}
% Decrease the amount of vertical space between items in the list environments. To do this, save the old environment macros under new names, and then change the `real' environments to call the originals plus some space-adjusting parameters.
%
%
% Note that description lists shouldn't contain more than on paragraph.
%    \begin{macrocode}
\let\tpj@itemize\itemize     
\let\tpj@enditemize\enditemize 
\let\tpj@enum\enumerate     
\let\tpj@endenum\endenumerate 
\let\tpj@desc\description     
\let\tpj@enddesc\enddescription 
\renewenvironment{itemize}
  {\tpj@itemize\parskip0pt}{\tpj@enditemize}
\renewenvironment{enumerate}
  {\tpj@enum\parskip0pt}{\tpj@endenum}
\renewenvironment{description}
  {\tpj@desc\parskip0pt\parindent1.8em}{\tpj@enddesc}
%    \end{macrocode}
% \changes{v0.4g}{2006/01/05}{Space removed between list items.}
% \end{environment}
% \end{environment}
% \end{environment}
% \begin{environment}{itemise}
% Provide an environment with the correct spelling of `itemize'.
%    \begin{macrocode}
\let\itemise\itemize     
\let\enditemise\enditemize   
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\labelitemi(...)}
% Get rid of the nasty blob that is the \cmd\textbullet, and replace
% it with more unobtrusive dashes.
%    \begin{macrocode}
\renewcommand\labelitemi{\normalfont\bfseries\textendash}
\renewcommand\labelitemii{\normalfont\bfseries\textperiodcentered}
%    \end{macrocode}
% \changes{v0.4g}{2006/01/05}{Itemise bullets changed.}
% \end{macro}
%
% \begin{macro}{\descriptionlabel}
% Change the description label to italics instead of bold.
%    \begin{macrocode}
\renewcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\itshape #1}
%    \end{macrocode}
% \end{macro}
%
% \paragraph{Footnotes}
% Here we change the footnote formatting a little bit from the default. 
% \begin{macro}{\@makefntext}
% Make the footnote number at the bottom of the page not a superscript (recommended by Bringhurst, if you're curious---the superscript is there originally to get the number out of the way, but that's no longer needed when you're labelling the note with the number).
%    \begin{macrocode}
\def\@makefntext#1{%
  \parindent 0em\relax
  \makebox[1.5em][l]{\normalfont\footnotesize\@thefnmark.}#1}
%    \end{macrocode}
% \changes{v0.4f}{2005/10/06}{WR: Removed the footnote superscript.}
% \changes{v0.4g}{2005/11/01}{WR: Added a period after the footnote number.}
% \changes{v0.4l}{2006/08/05}{WR: Fixed number \& text size difference. Oops. Removed \cmd\strut\ to allow \textsf{bigfoot} compatibility.}
% \end{macro}  
%
% \subsection{TPJ additions}
%
% \subsubsection{Boolean logic}
%
% \begin{macro}{\@ifx@empty}
% \begin{macro}{\@ifx@undefined}
% \begin{macro}{\@ifeof}
%   The following three procedures implement part of the boolean logic
%   facility, an expansion-only calculating engine.
%    \begin{macrocode}
\def\@ifx@empty#1{% Implicit #2#3
  \ifx#1\@empty
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}%
\def\@ifx@undefined#1{% Implicit #2#3
  \ifx#1\@undefined
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}%
\def\@ifeof#1{% Implicit #2#3
 \ifeof#1
   \expandafter\@firstoftwo
 \else
   \expandafter\@secondoftwo
 \fi}%
\def\boolean@true#1{\let#1\@firstoftwo}%
\def\boolean@false#1{\let#1\@secondoftwo}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Titlepage pagestyle}
%
% \begin{macro}{\ps@titlepage}
% The \cmd{\ps@titlepage} procedure effects a page style
% called \texttt{titlepage}, which applies only to the title page.
% The \cmd{\titlepage@head} procedure sets type in the page header,
% \cmd{\titlepage@foot} in the page footer.
%
% \changes{v0.3}{2004/01/03}{AO: add page header and footer to title page} 
%    \begin{macrocode}
\def\ps@titlepage{%
  \def\@oddhead{\titlepage@head\hfil}%
  \let\@evenhead\@oddhead
  \def\@oddfoot{\hfil\titlepage@foot}%
  \let\@evenfoot\@oddfoot}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\titlepage@head}
%
% This is the text block before the article title. Changes depending
% on the production stage.
%
% \changes{v0.4b}{2005/06/26}{WR: More conditional text.}
% \changes{v0.4b}{2005/06/26}{WR: Added hyperref link to email article
%   comments for both reviewers and readers.}
% \changes{v0.4c}{2005/06/27}{WR: Tweaked conditionals; revision date is important even after publication!}
% \changes{v0.4c}{2005/06/27}{WR: Added error check for \cmd\TPJrevision\ defined without \cmd\TPJissue.}
% \changes{v0.4d}{2005/07/17}{WR: Make the header \cmd\small.}
% \changes{v0.4e}{2005/07/17}{WR: Removed email comments links.}
% \changes{v0.4k}{2006/02/20}{WR: Simplified \& made smaller.}
%    \begin{macrocode}
\def\titlepage@head{\footnotesize
  \parbox{\linewidth}{%
    \@ifx@empty\@TPJissue{For submission to \TPJ}{\@TPJissue}\par
    \@ifx@empty\@TPJissue
       {\@ifx@empty\@TPJrevision{Draft of \today}{Article revision \@TPJrevision}}%
       {\@ifx@empty\@TPJrevision
          {\ClassError{pracjourn}
            {\string\TPJrevision\space must be defined if 
             \string\TPJissue\space is also}
            {It is a requirement for PracTeX Journal articles to contain\MessageBreak
             revision information for version tracking. Please input this\MessageBreak
             information, or omit \protect\TPJissue.}}
          {Article revision \@TPJrevision}}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\titlepage@foot}
% To typeset the optional copyright declaration by the author.
%
% \changes{v0.4d}{2005/07/17}{WR: Removed \cmd\copyright\ from the copyright 
%   notice and put the whole thing in a lowered \cmd\vbox\ to allow multi-line declarations.}
% \changes{v0.4k}{2006/02/20}{WR: Made smaller.}
%    \begin{macrocode}
\def\titlepage@foot{%
  \vtop{\raggedleft\footnotesize\@TPJcopyright}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
% Better float parameters: (from the TeX FAQ)
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
%    \end{macrocode}
%
% \subsubsection{Additional author/article information}
%
% \begin{macro}{\addinfo}
%
% This command defines a new block of information to be typeset
% in the title block of the document. For every new item, a new
% \cmd{\tpj@info@container} is appended to \cmd{\tpj@optional@author@info}, which
% is called in \cmd{\@maketitle}.
%
%    \begin{macrocode}
\newcommand\addinfo[2][]{%
  \def\@tempa{\new@addinfo{#1}{#2}}%
  \lowercase{\expandafter\@tempa\expandafter{\csname#2\endcsname}}}
\newcommand\new@addinfo[3]{%
  \tpj@define@info@block{#3}%
  \expandafter\newcommand
    \csname\expandafter\@gobble\string#3name\endcsname{#2}%
  \g@addto@macro\tpj@optional@author@info{%
    \tpj@info@container[#1]{\csname\expandafter\@gobble\string#3name\endcsname}{#3}}}
%    \end{macrocode}
% \changes{v0.4d}{2005/07/30}{WR: Name change to user-space.}
% \end{macro}
%
% \begin{macro}{\newinfo}
% E.g., |\newinfo\resume[\resfont]{R\'esum\'e}|
%    \begin{macrocode}
\newcommand\newinfo[1]{%
  \@ifnextchar[{\@newinfo{#1}}{\@newinfo{#1}[]}}
\def\@newinfo#1[#2]#3{%
  \tpj@define@info@block{#1}%
  \expandafter\newcommand
    \csname\expandafter\@gobble\string#1name\endcsname{#3}%
  \g@addto@macro\tpj@optional@author@info{%
    \tpj@info@container[#2]{%
      \csname\expandafter\@gobble\string#1name\endcsname}{#1}}}
%    \end{macrocode}
% \changes{v0.4n}{2007/08/13}{WR: A better \cmd\addinfo}
% \end{macro}
%
% \begin{macro}{\addinfospace}
% Adds some space after the previous item in the frontmatter.
%    \begin{macrocode}
\newcommand\addinfospace[1]{\g@addto@macro\tpj@optional@author@info{\vspace{#1}}}  
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tpj@define@info@block}
%   \changes{v0.4a}{2005/06/13}{WR: Implemented for new \cmd{\@maketitle}.}
% This macro actually does the work of \cmd\addinfo. 
% It takes the name of a piece of info to be typeset in the
% title block of the article.
%
% This is much easier (but uglier, in hindsight |:(| ) than
% |\begin{abstract}...\end{abstract}| contortions
% (cf. \texttt{ltugboat.cls}).
%    \begin{macrocode}
\newcommand\tpj@define@info@block[1]{%
  \newcommand#1[1]{\expandafter\def\csname tpj@info@\string#1\endcsname{##1}}}
%    \end{macrocode}
% \changes{v0.4n}{2007/08/13}{Change for better info blocks}
% \end{macro}
%
% \begin{macro}{\clearinfo}
% If the \cmd{\tpj@optional@author@info} macro needs to be cleared for some reason,\footnotemark
% the \cmd\clearinfo\ command will come quite in handy. This command is also used to
% initialise the macro in question.
% \footnotetext{The only reason I can think of to do this is to re-arrange the order of
%   the items in the title block of the article.}
% \changes{v0.4d}{2005/07/30}{WR: Implemented to allow for re-definition of standard information blocks.}
%    \begin{macrocode}
\newcommand\clearinfo{\let\tpj@optional@author@info\@empty}
\clearinfo
%    \end{macrocode}
% \end{macro}
%
% \paragraph{Optional fields}
%
% These are the default information blocks.
% \cmd\typesetemail\ is defined by one of either \cmd\hyperlinkemail\ or \cmd\obfuscateemail.
%
%    \begin{macrocode}
\addinfo[\typesetemail]{Email}
\addinfo[\url]{Website}
\addinfo[\linespread{0.9}\selectfont]{Address}
%    \end{macrocode}
%
% \paragraph{Abstract} We bypass \cmd\addinfo\ 
% so that the abstract info block is not added 
% to the \cmd{\tpj@optional@author@info} macro.
%
% The abstract block itself is called directly in \cmd{\@maketitle}.
%
%    \begin{macrocode}
\let\abstract\relax
\tpj@define@info@block\abstract
\def\abstractname{Abstract}
%    \end{macrocode}
%
% \begin{macro}{\noabstract}
% However, the abstract may indeed be suppressed if that is the author's wish.
% \changes{v0.4d}{2005/07/25}{WR: Implemented to turn off the abstract.}
%    \begin{macrocode}
\newif\iftpj@noabstract
\newcommand\noabstract{\tpj@noabstracttrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endabstract}
% If an abstract environment is used, give an error. Maybe I should
% just support the environment, instead.
%    \begin{macrocode}
\def\endabstract{%
  \ClassError{pracjourn}
   {Please input the abstract with \string\abstract{...}, before \string\begin{document}}
   {Instead of the \string\begin{abstract}...\string\end{abstract} \MessageBreak 
    environment, use \string\abstract{...}. Paragraphs are allowed!\MessageBreak 
                                                                   \MessageBreak 
    Because the abstract is typeset with the title block,          \MessageBreak 
    it must be input before the \string\begin{document}\space command.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\TPJissue}
% \changes{v0.4k}{2006/02/20}{WR: More user-friendly.}
% \begin{macro}{\TPJrevision}
% \changes{v0.4k}{2006/02/20}{WR: More user-friendly.}
% \begin{macro}{\TPJcopyright}
%
% \changes{v0.3}{2004/01/03}{AO: add commands specifying issue,
%   revision, copyright.} 
%
% The three user-level commands
% \cmd\TPJissue, \cmd\TPJrevision, and \cmd\TPJcopyright{} specify
% the issue, the revision, and the copyright information of the
% document.
%
% Since these commands are like \cmd\author{} and \cmd\title, one
% might wish to disable them upon executing the \cmd\titlepage{}
% procedure. But we do not.
%
% If the document has a \cmd\TPJrevision{} statement, the title page
% header contains words to that effect, otherwise it bears the current
% date.
%
% If the document lacks a \cmd\TPJcopyright{} statement, the title
% page footer contains nothing.
%    \begin{macrocode}
\newcommand{\TPJissue}[2]{\gdef\@TPJissue{\TPJ, #1, No.\,#2}}%
\newcommand{\TPJrevision}[3]{\gdef\@TPJrevision{#1/#2/#3}}%
\newcommand{\TPJcopyright}[1]{\gdef\@TPJcopyright{#1}}%
\let\@TPJissue\@empty
\let\@TPJrevision\@empty
\let\@TPJcopyright\@empty
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\license}
%
% For consistency with the other user commands of this class, \cmd\license\
% is defined as an alias of \cmd\TPJcopyright.
%
% \changes{v0.4d}{2005/07/30}{WR: name change from \cmd\TPJcopyright\
%   for consistency with other commands.}
%
%    \begin{macrocode}
\let\license\TPJcopyright
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\tpj@info@container}
% This is the macro that typesets the optional author info for
% fields defined as above. It splits it all up in minipages, in a
% smaller font and with more compressed leading than the main
% document text.\footnote{\LaTeX's \cmd\@hangfrom\ (or whatever it is) could well
% have been much easier.} It takes the name of the info as a mandatory
% argument, which is used to typeset the info label as well as
% retrieve the actual data from the |\tpj@info@#3| macro (see
% \cmd{\addinfo}).
%
% An optional argument is used as a hook to typeset the info data in
% the equivalent form |#1{#2}|.
%
% For example, to typeset the info defined by the author in the
% \cmd\abstract\ (recall, this is set up due to a corresponding
% |\addinfo{Abstract}{\abstract}|---see above), input
% |\tpj@info@container{Abstract}|. To typeset it, say, in italics,
% it would be possible to write
% |\tpj@info@container[\textit]{Abstract}|.
%
% \changes{v0.4a}{2005/06/13}{WR: Implemented for new \cmd\@maketitle.}
% \changes{v0.4d}{2005/06/29}{WR: Warn if a title block command is used after \cmd\maketitle.}
%
%    \begin{macrocode}
\newcommand\tpj@info@container[3][]{%
%    \end{macrocode}
% After \cmd\maketitle, redefine the info command to return an error.
%    \begin{macrocode}
  \gdef#3{\ClassError{pracjourn}{#2 must be defined BEFORE \string\maketitle}{}}
%    \end{macrocode}
% Now, we typeset the info block, but only if the info has actually been specified by the author.
%    \begin{macrocode}
  \expandafter\ifx\csname tpj@info@\string#3\endcsname\relax\else
    \noindent\small
%    \end{macrocode}
% On the left, right-aligned sans serif item label, e.g., `Abstract':
%    \begin{macrocode}
    \begin{minipage}[t]{0.15\textwidth}
      \noindent\hfill\sffamily#2
    \end{minipage}\hfill
%    \end{macrocode}
% On the right, the content, defined by, e.g., \cmd\abstract:
%    \begin{macrocode}
    \begin{minipage}[t]{0.825\textwidth}
      \linespread{1.0}\selectfont
      \setlength\parindent{1.5em}%
      \noindent\ignorespaces
      \expandafter#1\expandafter{\csname tpj@info@\string#3\endcsname}
    \end{minipage}\par
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Email \& hyperlink macros}
%
% \begin{macro}{\typesetemail}
%
% We define the macro \cmd\typesetemail\ to be used for self-explanatory purposes.
% The class contains methods to define it in one of two ways.
%
% \begin{macro}{\hyperlinkemail}
% 
% The \cmd\hyperlinkemail\ command defines \cmd\typesetemail\ to use the \pkg{hyperref}
% package's facilities to create a hyperlink email address in the output document.
%
% \begin{macro}{\obfuscateemail}
% 
% The \cmd\obfuscateemail\ command defines \cmd\typesetemail\ to use the \pkg{switcheml}
% package's facilities to create a machine-obfuscated email address in the output 
% document.\footnote{The \pkg{switcheml} package defines, among a couple of other things, a macro for
% typesetting email addresses that obfuscates their representation in the PDF file,
% ensuring protection against harvesting email addresses from web-public
% PDF documents.}
%
%    \begin{macrocode}
\newcommand\obfuscateemail{%
  \def\typesetemail##1{\ttfamily\switchemail{##1}}}
\newcommand\hyperlinkemail{%
  \def\typesetemail##1{\ttfamily\tpj@compose@mailto{##1}{Re: PracTeX Journal article}{##1}}}
%    \end{macrocode}  
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\tpj@compose@mailto}
%
% This macro takes three arguments to typeset a mailto email
% hyperlink. The |#1| takes the email address, |#2| takes the
% default subject of the email, and |#3| is the text to appear in
% the output as the hyperlink.
%
% All spaces in the hyperlink source are converted to |%20| to
% accommodate Mac~OS~X's PDF reader; this isn't necessary for Adobe
% Reader. Oh well.
%
% \changes{v0.4b}{2005/06/26}{WR: Implemented; creates a workable mailto
%   hyperlink.}
%
%    \begin{macrocode}
\newcommand\tpj@compose@mailto[3]{%
  \edef\@tempa{mailto:#1?subject=#2 }%
  \edef\@tempb{\expandafter\html@spaces\@tempa\@empty}%
  \href{\@tempb}{#3}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\html@spaces}
% \changes{v0.4b}{2005/06/25}{WR: Implemented to overcome the mailto
%   problems in Mac~OS~X's PDF reader.}  

% This macro takes a string and (hopefully) converts all spaces (or
% is it all whitespace?) to `\%20', creating a string that can be
% used for encoding the subject of the email comments hyperlink in
% \cmd{\titlepage@head}. Using \cmd\catcode, we remove the comment
% ability of the \verb|%| character, making it a normal letter.
% (This code was heavily influenced by the \LaTeX\ kernel's
% \cmd{\zap@space} command.)
%    \begin{macrocode}
\catcode`\%=11
\def\html@spaces#1 #2{#1%20\ifx#2\@empty\else\expandafter\html@spaces\fi#2} 
\catcode`\%=14
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{User commands}
% 
% \begin{macro}{\note}
% \begin{macro}{\dash}
% \begin{macro}{\ctanfile}
% \begin{macro}{\ctanloc}
% Fairly straightforward.
%    \begin{macrocode}
\newcommand\note[1]{\unskip\footnote{#1}}
\DeclareRobustCommand\dash{%
  \unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\pdfstringdefDisableCommands{\renewcommand{\dash}{ - }}
\newcommand\ctanfile[1]{%
  \href{http://www.ctan.org/get?fn=/#1}
       {\path{CTAN:#1}}}
\newcommand\ctanloc[1]{%
  \href{http://www.ctan.org/tex-archive/#1}
       {\path{CTAN:#1}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Logos}
%
% \begin{macro}{\tpf@deflogo}
% Wrapper for both \cmd\DeclareRobustCommand\ and \cmd\pdfstringdefDisableCommand.
%    \begin{macrocode}
\newcommand\tpj@deflogo{\@dblarg\tpj@@deflogo}
\newcommand\tpj@@deflogo[3][\@nil]{%
  \expandafter\DeclareRobustCommand\csname#2\endcsname{#3}%
  \pdfstringdefDisableCommands{%
    \expandafter\def\csname#2\endcsname{#1}}}
%    \end{macrocode}
% \changes{v0.4m}{2006/11/19}{WR: Implemented to improve logo/hyperref handling.}
% \end{macro}
%
% \changes{v0.4a}{2005/06/05}{WR: Incorporated code from \pkg{texnames}
%   and \pkg{mflogo}.}
%
% The \pkg{texnames} and \pkg{mflogo} packages have been incorporated
% into the class in order to remove the dependence on external
% packages and to tune the logos for Palatino. First, here are the
% relevant parts\footnote{No-one still refers to AMSTeX and SLITeX and
%   so on, right?} of \texttt{texnames.sty}, v1.10, tuned for Palatino
% and adapted to use \cs{textsc} where appropriate:
%    \begin{macrocode}
\tpj@deflogo{TeX}{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}
\tpj@deflogo{LaTeX}{L\kern-.32em\raise.37ex\hbox{\scalebox{0.76}{A}}\kern-.15em\TeX}
\tpj@deflogo{LaTeXe}{\LaTeX2$_{\textstyle\varepsilon}$}
\tpj@deflogo{BibTeX}{B{\textsc i\kern-.025em\textsc b}\kern-.08em\TeX}
%    \end{macrocode}
% And now \texttt{mflogo.sty}, unchanged in its entirety:
%    \begin{macrocode}
\DeclareRobustCommand\logofamily{%
  \not@math@alphabet\logofamily\relax
  \fontencoding{U}\fontfamily{logo}\selectfont}
\DeclareTextFontCommand{\textlogo}{\logofamily}
\tpj@deflogo[MetaFont]{MF}{\textlogo{META}\@dischyph\textlogo{FONT}\@}
\tpj@deflogo[MetaPost]{MP}{\textlogo{META}\@dischyph\textlogo{POST}\@}
%    \end{macrocode}
% Now some new definitions. Despite the fact that it makes no
% difference with the main font used for this class, I define
% \cs{pdfTeX} with some italic correction to set a good
% precedent. Compare Computer Modern with and without:
% {\usefont{OT1}{cmr}{m}{n}pdf\/\TeX}
% vs.~{\usefont{OT1}{cmr}{m}{n}pdf\TeX}; I find the former more
% attractive because the ascender of the `f' doesn't collide.
%    \begin{macrocode}
\tpj@deflogo{ConTeXt}{C\kern-.03em on\-\kern-.10em\TeX\kern-0.04em t}%
\tpj@deflogo{pdfTeX}{pdf\/\TeX}
\tpj@deflogo{pdfLaTeX}{pdf\/\LaTeX}
\newcommand\PS{PostScript}
\tpj@deflogo{PracTeX}{Prac\kern-0.07em\TeX}
\newcommand\TPJ{The \PracTeX\ Journal}
\tpj@deflogo{XeTeX}{%
      X\lower.5ex\hbox{\kern-.07em\reflectbox{E}}%
      \kern-.15em\TeX}
\tpj@deflogo{ExTeX}{\textrm{\relax
 \ensuremath{\textstyle\varepsilon_{\kern-0.15em\mathcal{X}}}\relax
 \kern-.15em\TeX}}
%    \end{macrocode}
% \changes{v0.4j}{2006/02/09}{Added \cmd\XeTeX\ logo.}
% \changes{v0.4k}{2006/02/09}{Added \cmd\ExTeX\ logo.}
%
% \subsubsection{Version tracking}
%
% \begin{macro}{\write@ID@aux}
% \changes{v0.3}{2004/01/03}{AO: add ID file}
% Establish an auxiliary file, \verb+_id.tex+, for TPJ tracking information.
% 
%    \begin{macrocode}
\def\write@ID@aux{%
 \@ifx@empty\@TPJrevision{}{%
  \begingroup
   \let\thanks\@gobble
   \immediate\openout\ID@aux _rev.tex
%  \immediate\write\ID@aux{\@percentchar\space 
%    This file generated by the pracjourn document class}%
   \immediate\write\ID@aux{\@TPJrevision}%
   \immediate\closeout\ID@aux
  \endgroup
 }%
}%
\newwrite\ID@aux
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\read@iss@aux} 
%    \begin{macrocode}
\def\read@issue{%
 \openin\@inputcheck _iss.tex
 \@ifeof\@inputcheck{}
   {\ifx\@TPJissue\@empty\else
      \typeout{---------^^J
               pracjourn: \protect\TPJissue\space info overwritten due to _iss.tex file^^J
               ---------}
    \fi
    \read\@inputcheck to\@TPJissue
    \closein\@inputcheck
    \expandafter\parse@iss\@TPJissue\@nil}}
%    \end{macrocode}
% \changes{v0.3}{2004/01/03}{AO: read the "issue" file.}
% \changes{v0.4i}{2006/02/02}{WR: {\ttfamily\char`\_iss.tex} behaviour finally sorted out.}
% \end{macro}
%
% \begin{macro}{\parse@iss}
% \changes{v0.4k}{2006/02/20}{WR: Implemented for better article headers.}
%    \begin{macrocode}
\def\parse@iss TPJ #1 No #2, #3-#4-#5\@nil{%
  \@tempcnta#2\relax
  \protected@xdef\@TPJissue{\TPJ, #1, No.\,\the\@tempcnta}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Miscellaneous}
%
% \begin{macro}{\set@pdfpage}
%   \changes{v0.3}{2004/01/03}{AO: add commands setting pdftex's page
%     metrics from LaTeX's} 
%
% The PDF\TeX{} parameters \cmd\pdfpagewidth\ and
% \cmd\pdfpageheight\ determine the
% CropBox/BleedBox/TrimBox/ArtBox. The procedure \cmd\setpdfpage{}
% sets them to the values of the \LaTeX{} \cmd\paperwidth{} and
% \cmd\paperheight.  If PDF\TeX{} is not the engine, nothing is
% done.
%
% We arrange for the procedure to be executed at Begin Document
% time.
%    \begin{macrocode}
\def\set@pdfpage{%
 \@ifx@undefined\pdfoutput{}{%
  \pdfpagewidth =\paperwidth
  \pdfpageheight=\paperheight
  \relax}}
\AtBeginDocument{\set@pdfpage}
%    \end{macrocode}
% \end{macro}
%
% \makeatother
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \Finale
\endinput