-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrproc.tex
210 lines (186 loc) · 6.99 KB
/
trproc.tex
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
% -*- mode: fundamental; -*-
% trproc.tex - XeTeX format for proceedings.
% Copyright © 2010 CESNET
% Author: Ladislav Lhotka <[email protected]>
% 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 3 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, see <http://www.gnu.org/licenses/>.
\input trcommon
\catcode`_=11 % to hide private macros
\catcode`@=11 % to borrow plain TeX macros
% Allocation of registers
\newcount\part_count % part counter
\newskip\tocnum_skip % space for page numbers in ToC
\newif\ifin_rep % indicates open report
\newif\ifmake_toc % controls output of table-of-contents file
\newif\iffirst_pass % indicates first pass of final run
\newbox\proc_box % citation of the proceedings
\newwrite\toc % table of contents
\newwrite\endp % end pages of report
% Front matter
\def\proceedings{\let\start_page=\empty}
\def\endProceedings{\write_endpage}
\def\citation#1{\def\cite_proc{#1}}
\def\copyrightNotice#1{\def\copyright_notice{#1}}
% Processing modes
\def\finalMode{\handle_option{final_mode}}
\def\final_mode[#1]{\proof_modefalse
\def\opt_val{#1}\def\excl_char{!}
\ifx\opt_val\excl_char \overfullrule=0pt \first_passfalse
\input endpages
\else
\first_passtrue
\immediate\openout\endp=endpages
\fi}
\def\cleanPage{\bgroup\footline={}%
\def\makeheadline{\vbox to 0pt{\skip0=\topskip
\advance\skip0 by -2.75\baselineskip \vskip\skip0
\hbox to \hsize{\hfill}\vss}%
\nointerlineskip}\null\vfill\eject\egroup}
% Foot line
\footline={\ifinfo_down
\ifnum\pageno<0 \hfil\folio\hfil \else
\box\proc_box\fi\fi}
\def\part#1{\par\vfill\eject
\write_endpage\let\start_page=\empty
\incr\part_count
\ifodd\pageno\else
\ifproof_mode
\advancepageno
\else
\cleanPage
\fi
\fi
\edef\part_label{\uppercase\expandafter{\romannumeral\part_count}}
\ifmake_toc\write_toc_part{\part_label}{#1}{\noexpand\folio}\fi
\null\vfill
{\rightRunHead={\hfil}\twentyonePoint\bf
\centerline{Part~\part_label}
\vskip15mm
\vbox{\leftskip=3em plus 1fill \rightskip=3em plus 1fill
\parfillskip=0pt \noindent#1}\vfill\eject}}
% For Preface and such
\def\looseChapter#1{\par\eject\ifodd\pageno\else\advancepageno\fi
\null
\title_pagetrue
\leftRunHead={{\normalSize\rm\folio}\kern2em{\petit\it#1}}
\rightRunHead={{\petit\it#1}\kern2em{\normalSize\rm\folio}}
\leftline{\seventeenPoint\bf #1}
\vskip1cm
\ignorespaces}
\def\endLooseChapter{\vfil\supereject}
\def\write_endpage{\ifx\start_page\empty\else
{\decr\pageno
\immediate\write\endp{%
\string\defMacro{to_\start_page}{\number\pageno}}}\fi}
\def\report{\ifin_rep
\errmessage{Previous report not finished yet!}\fi
\par\vfill\eject
\ruler_count=0
\foot_count=0 \auth_count=0
\@uthors={}
\let\short_title=\empty
\ifproof_mode\else\write_endpage\fi
\ifodd\pageno\else
\ifproof_mode \advancepageno \else
\cleanPage
\fi
\fi
\ifproof_mode\else
\edef\start_page{\romannumeral\pageno}
\setbox\proc_box=\vbox{
\ifproof_mode\hbox{\vii_rm \number\day.\number}\else
\vtop{\baselineskip=9pt \vii_rm
\hbox{\cite_proc, p.~\number\pageno--\iffirst_pass??\else
\macro{to_\start_page}\fi}
\hbox{{\normalSize ©}~\copyright_notice}}\fi}%
\fi
\in_reptrue \title_pagetrue}
\def\endReport{\in_repfalse\vfill\supereject}
\def\makeTitle{\edef\the_title{\the\titl@}%
\ifmake_toc\expandafter\write_toc_article\expandafter{\the_title}%
{\the\auth_names}{\noexpand\folio}\fi
\leftRunHead={{\petit{\normalSize\rm\folio}\kern2em%
{\sc\ifnum\auth_count>3
\first_author~et~al.\else \the\auth_names\fi}}}%
\rightRunHead={{\petit\it\ifx\short_title\empty
\the\titl@\else\short_title\fi\kern2em{\normalSize\rm\folio}}}%
\box\title_box
\vskip\aboveauthors_skip
\vbox{\leftskip=3em plus 1fill \rightskip=3em plus 1fill
\parfillskip=0pt
\normalSize\noindent\sc\the\@uthors}
\iffirst_affil\else\box\affil_box\fi
\vskip\belowauthors_skip}
% Table of contents macros (0=part, 1=article)
\tocnum_skip=1cm plus1fil minus.5cm
\def\tocPart#1#2#3{\medskip\line{\bf
Part~#1: #2 \hrulefill\hbox to\tocnum_skip{\hfil#3}}\nobreak\medskip}
\def\tocReport#1#2#3{\vbox{\hyphenpenalty=10000
\parfillskip=0pt \advance\rightskip by\tocnum_skip
\noindent{\it#1}\dotfill\rlap{\hbox to\tocnum_skip{\hfil#3}}\par
\noindent #2}
\medskip}
\def\makeToc{\make_toctrue\immediate\openout\toc=toc-new}
\def\write_toc_part#1#2#3{\suppress_expansion{#2}%
\edef\pris{\write\toc{\string\tocPart{#1}{\token_string}{#3}}}%
\pris}
\def\write_toc_article#1#2#3{\suppress_expansion{#1}%
\edef\pris{\write\toc{%
\string\tocReport{\token_string}{#2}{#3}}}%
\pris}
\def\suppress_expansion#1{{%
\aftergroup\def\aftergroup\token_string\aftergroup{%
\assign_next#1\end_tokens}}}
\def\suppress_auth_exp#1{{%
\aftergroup\def\aftergroup\auth_string\aftergroup{%
\assign_next#1\end_tokens}}}
\def\assign_next{\futurelet\pris\analyze_next}
\def\analyze_next{\ifx\pris\end_tokens
\else\ifcat\noexpand\pris\space
\aftergroup\space\let\pris=\kill_token
\else\ifcat\noexpand\pris\bgroup
\aftergroup{\let\pris=\kill_token
\else\ifcat\noexpand\pris\egroup
\aftergroup}\let\pris=\kill_token
\else\let\pris=\copy_token\fi\fi\fi\fi \pris}
\def\kill_token{\afterassignment\assign_next\let\pris= }
\def\copy_token#1{%
\ifcat\noexpand#1\relax\aftergroup\noexpand
\aftergroup\noexpand\aftergroup\noexpand
\else\ifcat\noexpand#1\noexpand~\aftergroup\noexpand
\aftergroup\noexpand\aftergroup\noexpand\fi\fi
\aftergroup#1\assign_next}
\def\end_tokens\end_tokens{}
\def\tocEntry#1#2#3#4{%
\ifcase#1\vskip1.5ex plus2pt minus1pt \ctoc_line{1.5em}{}{#3}{#4}%
\or\vskip1.5ex plus 0.3ex\ctoc_line{1.5em}{#2}{#3}{#4}
\or\stoc_line{1.5em}{2.5em}{#2}{#3}{#4}%
\or\stoc_line{4em}{3.5em}{#2}{#3}{#4}%
\or\stoc_line{7.5em}{1em}{#2}{#3}{#4}%
\else\message{Unknown type of toc-entry}%
\fi
\vskip0pt plus1pt
\ignorespaces}
\def\ctoc_line#1#2#3#4{\line{\bf\hbox to#1{#2\hfil}#3\hfil#4}}
\def\stoc_line#1#2#3#4#5{\line{\hskip#1\relax
\hbox to#2{#3\hfil}#4\leaders\hbox to 1em{\hss.\hss}\hfil#5}}
% Parameters
\hsize=130mm \hoffset=12mm
\vsize=516pt \voffset=26.5mm
\let\normalSize=\tenPoint
\let\petit=\ninePoint
\def\titleFont{\fourteenPoint\bf}
\def\sectionFont{\twelvePoint\bf}
% Final setup
\parameter_setup
\proofMode
\catcode`\_=8 % make _ again subscript symbol
\catcode`@=12 % at signs are no longer letters