Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
1070 kaklik 1
% ctustyle.ex -- the template for typesetting theses at CTU in Prague
2
% --------------------------------------------------------------------
3
% Petr Olsak  Jan. 2013
4
 
5
\def\ctustyleversion{beta(q) Mar.2014}
6
 
7
\message{CTUstyle: Thesis at Czech Technical University in Prague, 
8
         v. <\ctustyleversion>}
9
 
10
%%% Testing versions of csplain / opmac
11
 
12
\def\ctustyleERR#1{\message{ERROR -- #1.}\expandafter\end}
13
 
14
\ifx\chyph\undefined
15
   \expandafter\ifx \csname @@end\endcsname \relax \else % LaTeX's \end 
16
      \expandafter \let\expandafter \end \csname @@end\endcsname \fi
17
   \ctustyleERR {csplain isn't detected, use ``pdfcsplain \jobname'' command}%
18
\fi
19
 
20
\ifx\pdfoutput\undefined
21
   \ctustyleERR {pdfTeX isn't detected, use ``pdfcsplain \jobname'' command}%
22
\fi
23
\pdfoutput=1
24
 
25
\def\tmp#1#2\end{\if$#2$\else 
26
   \ctustyleERR {csplain doesn't read UTF-8 encoding, may be it is an old version}\fi}%
27
\tmp č\end
28
 
29
\newread\testinput
30
\def\testfile#1#2{\openin\testinput=#1
31
   \ifeof\testinput \ctustyleERR {#1 not found, install it from #2}\fi 
32
   \closein\testinput
33
}
34
\testfile{opmac.tex}{petr.olsak.net/opmac.html}
35
\testfile{ams-math.tex}{petr.olsak.net/opmac.html}
36
\testfile{lmfonts.tex}{petr.olsak.net/csplain.html}
37
 
38
\def\totlist{} \def\toflist{}
39
 
40
\def\Xtab#1#2#3{\addto\totlist{\totline{#1}{#2}{#3}}}
41
\def\Xfig#1#2#3{\addto\toflist{\tofline{#1}{#2}{#3}}}
42
 
43
\input opmac
44
 
45
\ifx\remskip\undefined
46
   \ctustyleERR {OPmac older than Jun. 2013. Upgrade from petr.olsak.net/opmac.html}%
47
\fi
48
 
49
%%% Declaration commands:
50
 
51
\newtoks\faculty
52
\newtoks\department
53
\newtoks\title
54
\newtoks\subtitle
55
\newtoks\author
56
\newtoks\supervisor   \let\supervisors=\supervisor
57
\newtoks\date
58
\newtoks\studyinfo
59
\newtoks\authorinfo
60
\newtoks\workinfo
61
\newtoks\workname
62
\newtoks\pagetwo
63
\newtoks\titleEN     \newtoks\titleCZ     \newtoks\titleSK
64
\newtoks\subtitleEN  \newtoks\subtitleCZ  \newtoks\subtitleSK
65
\newtoks\abstractEN  \newtoks\abstractCZ  \newtoks\abstractSK
66
\newtoks\keywordsEN  \newtoks\keywordsCZ  \newtoks\keywordsSK
67
\newtoks\thanks
68
\newtoks\declaration
69
\newtoks\specification
70
 
71
%%% Mandatory declaration commands
72
 
73
\def\mandatorydecl#1{\if&\the#1&%
74
   \ctustyleERR {the mandatory item \string#1 is undeclared or empty}%
75
   \fi
76
}
77
\def\makefront{%
78
   \ifx\mainlanguage\undefined
79
      \ctustyleERR {The \string\worktype[<type>/<lang>] command 
80
                    is missing before \string\makefront}\fi
81
   \everypar={}
82
   \mandatorydecl\faculty
83
   \mandatorydecl\title
84
   \mandatorydecl\author
85
   \mandatorydecl\date
86
   \ifnum\worktypenum>0
87
      \mandatorydecl\abstractEN
88
      \def\tmp{EN}\ifx\mainlanguage\tmp
89
         \if&\the\abstractSK&\mandatorydecl\abstractCZ \fi
90
      \fi
91
      \def\tmp{CZ}\ifx\mainlanguage\tmp \mandatorydecl\abstractCZ \abstractSK={} \fi
92
      \def\tmp{SK}\ifx\mainlanguage\tmp \mandatorydecl\abstractSK \abstractCZ={} \fi
93
      \mandatorydecl\declaration
94
   \else \mandatorydecl\workname
95
   \fi
96
   \edef\tmpa{:F1:F2:F3:F4:F5:F6:F7:F8:MUVS:}
97
   \edef\tmpb{\noexpand\isinlist\noexpand\tmpa{:\the\faculty:}}\tmpb
98
   \iftrue \else
99
      \ctustyleERR {The \noexpand\faculty {\the\faculty} 
100
                    is not in the list F1, F2, ..., F8, MUVS}%
101
   \fi
102
}
103
 
104
\everypar={\normaltypingdenied}
105
 
106
\def\normaltypingdenied{%
107
   \ctustyleERR{Text outside parameters on line \the\inputlineno.
108
                Use \noexpand\makefront first}\relax}
109
 
110
 
111
%%% Automatically generated multilingual texts:
112
 
113
\def\slet#1#2{\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}
114
\def\mtdef#1#2#3#4{\sdef{mt:#1:en}{#2} \sdef{mt:#1:\czs}{#3}
115
  \if$#4$\slet{mt:#1:sk}{mt:#1:\czs}
116
  \else  \sdef{mt:#1:sk}{#4}
117
  \fi
118
}
119
\edef\czs{\csname lan:5\endcsname} % cz (old) or cs (new)
120
 
121
\mtdef {ctu}   {Czech\nl Technical\nl University\nl in Prague} 
122
               {České\nl vysoké\nl učení technické\nl v Praze} {} 
123
% The name of University/Faculty is in Czech even if the document is in Slovak
124
\mtdef {F1}    {Faculty of Civil Engineering}
125
               {Fakulta stavební} {}
126
\mtdef {F2}    {Faculty of Mechanical Engineering}
127
               {Fakulta strojní} {}
128
\mtdef {F3}    {Faculty of Electrical Engineering}
129
               {Fakulta elektrotechnická} {}
130
\mtdef {F4}    {Faculty of Nuclear Sciences and Physical Engineering}
131
               {Fakulta jaderná a fyzikálně inženýrská} {}
132
\mtdef {F5}    {Faculty of Architecture}
133
               {Fakulta architektury} {}
134
\mtdef {F6}    {Faculty of Transportation Sciences}
135
               {Fakulta dopravní} {}
136
\mtdef {F7}    {Faculty of Biomedical Engineering}
137
               {Fakulta biomedicínského inženýrství} {}
138
\mtdef {F8}    {Faculty of Information Technology}
139
               {Fakulta informačních technologií} {}
140
\mtdef {MUVS}  {Masaryk Institute of Advanced Studies}
141
               {Masarykův ústav vyšších studií} {}
142
 
143
\mtdef {abstract}     {Abstract}          {Abstrakt}       {}
144
\mtdef {thanks}       {Acknowledgement}   {Poděkování}     {Poďakovanie} 
145
\mtdef {thanks0}      {Acknowledgement}   {Podekovani}     {Podakovanie} 
146
\mtdef {declaration}  {Declaration}       {Prohlášení}     {Prehlásenie} 
147
\mtdef {declaration0} {Declaration}       {Prohlaseni}     {Prehlasenie}
148
\mtdef {keywords}     {Keywords}          {Klíčová slova}  {Kľúčové slová}
149
\mtdef {trans}        {Title translation} {Překlad titulu} {Preklad titulu}
150
\mtdef {title0}       {TITLE}             {TITUL}          {}
151
\mtdef {contents}     {Contents}          {Obsah}          {}
152
\mtdef {tables}       {Tables}            {Tabulky}        {Tabuľky}
153
\mtdef {figures}      {Figures}           {Obrázky}        {}
154
\mtdef {figures0}     {Figures}           {Obrazky}        {}
155
\mtdef {supervisor}   {Supervisor}        {Vedoucí práce}  {Vedúci práce}
156
\mtdef {supervisorD}  {Supervisor}        {Školitel}       {Školiteľ}
157
\mtdef {bibliography} {References}        {Literatura}     {Literatúra}
158
\mtdef {appendix}     {Appendix}          {Příloha}        {Príloha}     
159
\mtdef {specifi}      {Specification}     {Zadání}         {Zadanie}
160
\mtdef {specifi0}     {Specification}     {Zadani}         {Zadanie}
161
 
162
\mtdef {B} {Bachelor's thesis} {Bakalářská práce}  {Bakalárska práca}
163
\mtdef {M} {Master's thesis}   {Diplomová práce}   {Diplomová práca}
164
\mtdef {D} {Ph.D. thesis}      {Dizertační práce}  {Dizertačná práca}
165
 
166
\def\keepacc#1{\slet{mt:#10:sk}{mt:#1:sk}\slet{mt:#10:\czs}{mt:#1:\czs}}
167
\def\keepaccents{\keepacc{thanks}%
168
  \keepacc{declaration}\keepacc{figures}\keepacc{specifi}}
169
 
170
 
171
%%% Worktype
172
 
173
\def\worktype[#1/#2]{%
174
   \isdefined{wt:#1}\iftrue \csname wt:#1\endcsname \relax
175
      \else \ctustyleERR {Unknown \noexpand\worktype parameter}\fi
176
   \isdefined{wl:#2}\iftrue \csname wl:#2\endcsname \relax
177
      \else \ctustyleERR {Unknown \noexpand\worktype parameter}\fi
178
}
179
\sdef{wt:O}{\chardef\worktypenum=0}
180
\sdef{wt:B}{\chardef\worktypenum=1}
181
\sdef{wt:M}{\chardef\worktypenum=2}
182
\sdef{wt:D}{\chardef\worktypenum=3}
183
 
184
\sdef{wl:EN}{\def\mainlanguage{EN}\ehyph}
185
\sdef{wl:CZ}{\def\mainlanguage{CZ}\chyph}
186
\sdef{wl:SK}{\def\mainlanguage{SK}\shyph}
187
 
188
%%% Fonts
189
 
190
\input lmfonts
191
\ifx\font\corkencoded \def\tmp{ec}\else\def\tmp{cs}\fi
192
 
193
\let\serifbf=\tenbf \let\serifbi=\tenbi
194
\font\tenbf=\tmp-lmssbx10 
195
\font\tenbi=\tmp-lmssbo10
196
\font\tenss=\tmp-lmss10
197
\font\tenssi=\tmp-lmsso10
198
\regfont\tenss \regfont\tenssi
199
\def\ss{\tenss} \def\ssi{\tenssi}
200
 
201
%%% Characters
202
 
203
\ifx\font\corkencoded
204
   \chardef\endash="15
205
   \chardef\emdash="16
206
\else
207
   \chardef\endash="7B
208
   \chardef\emdash="7C
209
\fi
210
 
211
\ifx\mubyte\undefined \else
212
   \mubyte \endash ^^e2^^80^^93\endmubyte % en dash
213
   \mubyte \emdash ^^e2^^80^^94\endmubyte % em dash
214
\fi
215
 
216
 
217
%%% Colors
218
 
219
\def\Blue{\setcmykcolor{1 .43 0 0}}
220
\def\liBlue{\setcmykcolor{.2 .08 0 0}}
221
\def\liGrey{\setcmykcolor{0 0 0 0.13}}
222
\let\nBlue=\Blue 
223
 
224
\def\blackwhite{\let\Blue=\Grey \let\nBlue=\Black \let\Red=\Grey \let\liBlue=\liGrey}
225
\let\trysavetoner=\relax
226
 
227
\def\savetoner{\def\trysavetoner{%
228
  \ifx\drafttext\empty
229
     \message{WARNING: final (not \string\draft) version,
230
              \noexpand\savetoner ignored}
231
  \else
232
     \let\liBlue=\White
233
  \fi 
234
}}
235
 
236
\hyperlinks{\Black}{\Black}
237
\def\tocborder{1 .8 0} 
238
\let\pgborder\tocborder
239
\let\citeborder\tocborder
240
\let\refborder\tocborder
241
\let\urlborder\tocborder
242
 
243
\ifx\localcolor\undefined  \let\locc=\relax \else \let\locc=\localcolor \fi
244
 
245
 
246
%%% Typesetting area
247
 
248
\margins/2 a4 (32,32,30,30)mm
249
\typosize[11/13.6]
250
\parindent=4.1mm \iindent=\parindent
251
 
252
\emergencystretch=2em
253
 
254
\def\makeheadline{\vbox to0pt{\vskip-34pt
255
  \line{\vbox to10pt{}\the\headline}\vss}\nointerlineskip}
256
\def\makefootline{\baselineskip=34pt \lineskiplimit=0pt \line{\the\footline}}
257
 
258
 
259
%%% Draft
260
 
261
{\tt\thefontsize[10] \global\let\ttt=\thefont}
262
 
263
\def\drafttext{}
264
\def\draft{\let\destbox=\draftdestbox 
265
     \def\drafttext{\vbox to0pt{\vss \llap{   
266
     \Grey \bf\thefontsize[11] Draft: \the\day. \the\month.
267
     \the\year\Black}}}}
268
 
269
\def\linespacing=#1#2 {\def\thelinespacing{#1#2}}  
270
\linespacing=1
271
 
272
\def\setlinespacing{%
273
   \ifdim\thelinespacing pt=1pt \else
274
      \ifx\drafttext\empty 
275
            \message{WARNING: final (not \string\draft) version, 
276
                     \noexpand\linespacing ignored}
277
         \else
278
            \baselineskip=\thelinespacing\baselineskip
279
      \fi 
280
   \fi
281
}
282
\def\draftdestbox[#1#2:#3]{\vbox to0pt{\kern-\destheight
283
   \pdfdest name{#1#2:#3} xyz\relax
284
   \if#1r\kern-3pt\llap{\locc\Red\ttt[#3]}\vss
285
   \else \if#1c\vss\llap{\locc\Red\ttt[\tmpb] }\kern-\prevdepth
286
   \else \vss \fi\fi}}
287
 
288
%%% PDF info data
289
 
290
\def\pdfinfodata{%
291
   {\def\TeX{TeX}\def\nl{ }%
292
    \ifx\pdfunidef\undefined
293
       \edef\tmp{/Author(\the\author)
294
            /CreationDate(\the\date)
295
            /Creator(TeX + CTUstyle)
296
            /Title(\the\title)
297
            /Subject(\ifcase\worktypenum
298
                \the\workname \or \mtext{B}\or \mtext{M}\or \mtext{D}\fi)
299
            /Keywords(\the\keywordsEN)}
300
       \edef\toasciidata{\toasciidata}\expandafter \setlccodes \toasciidata{}{}%
301
       \lowercase\expandafter{\expandafter\def\expandafter\tmp\expandafter{\tmp}}%
302
    \else
303
       \pdfunidef\tmpb{\the\author}\edef\tmp{/Author(\tmpb) /CreationDate(\the\date) }%
304
       \pdfunidef\tmpb{\the\title}%
305
       \edef\tmp{\tmp /Creator(TeX + CTUstyle) /Title(\tmpb) }%
306
       \pdfunidef\tmpb{\ifcase\worktypenum
307
                \the\workname \or \mtext{B}\or \mtext{M}\or \mtext{D}\fi}%
308
       \edef\tmp{\tmp /Subject(\tmpb) /Keywords(\the\keywordsEN)}%
309
    \fi
310
    \pdfinfo{\tmp}}
311
    \ifx\pdfunidef\undefined\else \keepaccents
312
       \let\insertoutlineI=\insertoutline
313
       \def\insertoutline##1{\pdfunidef\tmp{##1}\insertoutlineI{\tmp}}
314
    \fi
315
}
316
\addto\makefront{\pdfinfodata}
317
 
318
%%% Title page
319
 
320
\def\titlepage{
321
   \insertoutline{\mtext{title0}}
322
   \line{\locc \let\longlocalcolor=\localcolor
323
      \Blue \vrule height 230mm width 4mm \Black \hss 
324
      \vbox to230mm{\advance\hsize by-8mm \parindent=0pt
325
         \kern.3pt
326
         \leavevmode \strut\bf \ifcase\worktypenum  
327
                \the\workname \or \mtext{B}\or \mtext{M}\or \mtext{D}\fi 
328
         \vskip5mm \picw=3cm \def\picdir{}%
329
         \line{\inspic{ctulogo.pdf} \hss
330
            \vbox{\advance\hsize by-34mm
331
               \baselineskip=17pt\bf\thefontsize[15] 
332
               \Blue \mtext{ctu}\par
333
            \kern.5pt}}
334
         \vskip8mm
335
         \line{\hbox{\bf\thefontsize[32] \printfaculty}\hss
336
             \vbox{\advance\hsize by-34mm
337
                \Black \mtext{\the\faculty}\par
338
                \the\department}}
339
         \vskip35mm
340
         \rightskip=0pt plus1fil
341
         {\typosize[25/30]\bf \nBlue \the\title \par}
342
         \if&\the\subtitle&\else \smallskip \fi
343
         {\typosize[15/25]\bf \nBlue \the\subtitle \par}
344
         \vskip15mm
345
         {\bf\thefontsize[15]\Black \the\author \par}
346
         \the\studyinfo \par
347
         \the\authorinfo \par
348
         \vss
349
         \the\date\par
350
         \the\workinfo\par
351
         \if$\the\supervisor$\else 
352
             \ifnum\worktypenum=3 \mtext{supervisorD}%
353
             \else \mtext{supervisor}\fi: \the\supervisor\par\fi
354
         \kern-\prevdepth \kern1pt
355
}}}
356
\addto\makefront{%
357
   \bgroup \hbadness=4000 
358
   \pageno=-1 \def\advancepageno{\global\advance\pageno by-1 }
359
   \footline={\hss\drafttext} \titlepage \vfil\break
360
}
361
\def\printfaculty{\edef\tmpa{\the\faculty}\def\tmpb{MUVS}%
362
   \ifx\tmpa\tmpb \thefontsize[28] MÚVS\else \the\faculty \fi}
363
 
364
%%% Page Two
365
 
366
\def\printpagetwo{\null\vskip0pt plus1fil {\parindent=0pt \the\pagetwo\endgraf}}
367
\addto\makefront{\printpagetwo \endgraf\break} 
368
 
369
%%% Specification page
370
 
371
\def\specifipage{\if&\the\specification&\else
372
   \insertoutline{\mtext{specifi0}}
373
   \the\expandafter\specification\space \nextoddpage \fi}
374
\addto\makefront{\specifipage}
375
 
376
%%% Common front page
377
 
378
\newbox\leftbox  \newbox\rightbox
379
\newdimen\frontht  \frontht=220mm
380
 
381
\def\sethsizefront{\advance\hsize by-12mm \divide\hsize by2 
382
   \emergencystretch=2em \righthyphenmin=2 \hbadness=5000 \penalty0 }
383
 
384
\def\frontpage [#1/#2]{
385
   \hrule height0pt \vskip0pt plus 1filll
386
   \line{\locc\bf\thefontsize[19]
387
      \Blue\hss\llap{#1}
388
      \def\tmp{}\if$#1$\else\def\tmp{/}\fi \if$#2$\else\def\tmp{/}\fi
389
      \hbox to10mm{\hss\tmp\hss}\rlap{#2}\Black\hss}
390
   \nobreak\medskip
391
   \line{\locc\sethsizefront
392
      \vtop{\hrule width\hsize height0pt \unvbox\leftbox}\hss
393
      \Blue\vrule height-2pt depth\frontht width4mm\Black\hss
394
      \vtop{\hrule width\hsize height0pt \unvbox\rightbox}}
395
}
396
 
397
 
398
%%% Declaration page
399
 
400
\splittopskip=12pt plus20pt
401
 
402
\def\prepbox#1{\setbox0=\vsplit #1to0pt \relax}
403
 
404
\def\declpage{
405
   \setbox\leftbox=\vbox{\sethsizefront \leavevmode\the\thanks}
406
   \prepbox\leftbox
407
   \setbox\rightbox=\vbox{\sethsizefront \leavevmode\the\declaration}
408
   \prepbox\rightbox
409
   \ifvoid\leftbox \ifvoid\rightbox \let\declpage=\relax \fi\fi
410
   \ifx\declpage\relax \else
411
      \insertoutline{\if&\the\thanks&\else\mtext{thanks0}\fi/\mtext{declaration0}}
412
      \frontpage[\if&\the\thanks&\else\mtext{thanks}\fi/\mtext{declaration}]
413
   \fi
414
}
415
\addto\makefront{%
416
   \footline={\hss\tenss\thefontsize[11]\romannumeral-\pageno\hss\drafttext}
417
   \declpage \vfil\break
418
}
419
\def\signature {\vskip2cm \indent\tocdotfill\null}
420
\def\tocdotfill{\leaders\hbox to.4em{\hss.\hss}\hskip 1em plus1fill\relax} 
421
 
422
 
423
%%% Abstract page
424
 
425
\def\abstractpage{
426
   \chardef\orilang=\language
427
   \setbox\leftbox=\vbox{\sethsizefront \def\message##1{}\leavevmode
428
         \if&\the\abstractCZ&\shyph \the\abstractSK \par
429
            \let\keywords=\keywordsSK 
430
            \let\titleL=\titleSK
431
            \let\subtitleL=\subtitleSK
432
         \else \chyph \the\abstractCZ \par
433
            \let\keywords=\keywordsCZ 
434
            \let\titleL=\titleCZ
435
            \let\subtitleL=\subtitleCZ
436
         \fi
437
         \if&\the\keywords&\else{\bf\mtext{keywords}:} \the\keywords\par\fi
438
         \ifnum\orilang=\language \else
439
            \if&\the\titleL&\else{\bf\mtext{trans}:} \the\titleL
440
               \if&\the\subtitleL&\else \space(\the\subtitleL)\fi\fi\fi}
441
   \setbox\rightbox=\vbox{\sethsizefront \def\message##1{}\leavevmode
442
         \ehyph \the\abstractEN \par
443
         \if&\the\keywordsEN&\else{\bf\mtext{keywords}:} \the\keywordsEN\par\fi
444
         \ifnum\orilang=\language \else
445
            \if&\the\titleEN&\else{\bf\mtext{trans}:} \the\titleEN
446
               \if&\the\subtitleEN&\else \space(\the\subtitleEN)\fi\fi\fi}
447
   \prepbox\leftbox \prepbox\rightbox
448
   \ifvoid\leftbox \ifvoid\rightbox \let\abstractpage=\relax \fi\fi
449
   \ifx\abstractpage\relax \else
450
      \insertoutline{Abstrakt/Abstract}
451
      \frontpage[Abstrakt/Abstract]
452
   \fi
453
}
454
\addto\makefront{%
455
   \abstractpage \vfil\break
456
}
457
 
458
%%% Contents
459
 
460
\newbox\tocbox
461
 
462
 
463
\def\toclinehook{\advance\rightskip by0pt plus1em}
464
 
465
\def\tocpages{   
466
   \setbox\tocbox=\vbox{\sethsizefront \iindent=4.7mm \maketoc\vfil}
467
   \prepbox\tocbox
468
   \setbox\rightbox=\vsplit\tocbox to\frontht 
469
   \ifvoid\tocbox
470
      \insertoutline{/\mtext{contents}}
471
      \frontpage[/\mtext{contents}]
472
   \else
473
      \setbox\leftbox=\box\rightbox
474
      \setbox\rightbox=\vsplit\tocbox to\frontht
475
      \insertoutline{\mtext{contents}/}
476
      \frontpage[\mtext{contents}/]
477
   \fi      
478
   \loop \ifvoid\tocbox \let\tmp=\relax
479
         \else  \vfil\break 
480
                \setbox\leftbox=\vsplit\tocbox to\frontht
481
                \setbox\rightbox=\vsplit\tocbox to\frontht
482
                \frontpage[/]\let\tmp=\do 
483
         \fi 
484
         \ifx\tmp\do \repeat
485
}
486
\addto\makefront{%
487
   \tocpages \vfil\break
488
}
489
 
490
%%% Tables / Figures
491
 
492
\newbox\tofbox  \newbox\totbox
493
 
494
\def\tofpages{
495
   \setbox\tofbox=\vbox{\sethsizefront \iindent=9mm \toflist\vfil}
496
   \setbox\totbox=\vbox{\sethsizefront \iindent=9mm \totlist\vfil}
497
   \prepbox\tofbox \prepbox\totbox
498
   \let\tmp=\do
499
   \ifvoid\tofbox \ifvoid\totbox \let\tmp=\relax \fi\fi
500
   \ifx\tmp\do
501
      \insertoutline{\ifvoid\totbox\else \mtext{tables}\fi/%
502
                     \ifvoid\tofbox\else \mtext{figures0}\fi}
503
      \setbox\leftbox=\vsplit\totbox to\frontht
504
      \setbox\rightbox=\vsplit\tofbox to\frontht
505
      \frontpage[\ifdim\wd\leftbox=0pt  \else\mtext{tables}\fi/%
506
                 \ifdim\wd\rightbox=0pt \else\mtext{figures}\fi]
507
      \loop \let\tmp=\relax
508
            \ifvoid\totbox \else \setbox\leftbox=\vsplit\totbox to\frontht
509
                                 \let\tmp=\do \fi
510
            \ifvoid\tofbox \else \setbox\rightbox=\vsplit\tofbox to\frontht 
511
                                 \let\tmp=\do \fi
512
            \ifx\tmp\do \vfil\break \frontpage[/] \repeat
513
   \fi
514
}
515
\addto\makefront{%
516
   \tofpages \vfil\break
517
}
518
 
519
%%% Typessetting of the document:
520
 
521
\addto\makefront{%
522
   \footline={\hss\drafttext}
523
   \ifodd\pageno\else \null\vfil\break \fi
524
   \pageno=-\pageno \advance\pageno by-1 % page ranges (roman/decimal numeral)
525
   \pdfcatalog{/PageLabels<</Nums[0<</S/r>>\the\pageno<</S/D>>]>>}
526
   \egroup
527
   \setlinespacing
528
   \trysavetoner
529
   \pageno=1 \def\advancepageno{\global\advance\pageno by1 }
530
   \footline={\hss\tenss\thefontsize[11]\the\pageno\hss\drafttext}
531
   \outlines{0}\pdfcatalog{/PageMode /UseOutlines}
532
}
533
 
534
%%% Chapter, section
535
 
536
\def\printchap#1{\vfil\supereject \vglue1cm
537
  \headline={\hfil\nextheadline}\xdef\headchap{\ifnonum\else\thechapnum.\ \fi#1}\mark{}
538
  \line{\locc\Blue\vrule height 11mm width4mm
539
  \hss\vtop{\advance\hsize by-8mm
540
     \chapfont \noindent
541
     \Black \ifnonum\else\mtext{chap} \fi
542
     {\bf\thefontsize[30]\dotocnum{\thechapnum}}\par\nobreak
543
  \noindent\nBlue #1\strut\nbpar}}%
544
  \nobreak\bigskip
545
  \firstnoindent
546
}
547
\def\printsec#1{\removelastskip 
548
  \ifnum \lastpenalty<1000 \goodbreak \fi \bigskip\medskip
549
  \line{\locc\Blue\vrule height 6mm width4mm depth1mm
550
  \hss\vtop{\locc\advance\hsize by-8mm
551
     \secfont \noindent \Black\dotocnum{\thesecnum\quad}%
552
     \nBlue#1\strut\nbpar}}%
553
  \insertmark{#1}%
554
  \nobreak\medskip 
555
  \firstnoindent
556
}
557
\def\printsecc#1{\removelastskip 
558
  \ifnum \lastpenalty<1000 \goodbreak \fi \smallskip\medskip
559
  \line{\locc\Blue\vrule height 3.5mm width4mm\Black 
560
  \hss\vtop{\locc\advance\hsize by-8mm
561
   \seccfont \noindent \dotocnum{\theseccnum\quad}%
562
   \nBlue#1\strut\nbpar\kern-4.5pt}}%
563
  \nobreak\smallskip\kern2pt
564
  \firstnoindent
565
}
566
\def\sechook#1\relax{\seccnum=0 \relax}
567
 
568
\def\nextheadline{\global\headline={\printheadline}}
569
 
570
\def\printheadline{\locc\tenssi\thefontsize[10]\ifodd\pageno
571
     \hskip-3.7cm\tecky\if&\firstmark&\else\ \fi\locpgcolor\Grey\firstmark\Black
572
   \else\locpgcolor\Grey\headchap\ \tecky\hskip-3.7cm\fi}
573
 
574
\def\onesideprinting{\def\printheadline{\locc\tenssi\thefontsize[10]
575
     \locpgcolor\Grey\expandafter\ignoretospace\headchap\ \tecky
576
     \if&\firstmark&\else\ \fi\locpgcolor\Grey\firstmark\Black}
577
   \def\nextoddpage{\vfil\supereject}\shiftoffset=0pt
578
}
579
\def\ignoretospace#1\ {}
580
 
581
\bf\thefontsize[25]\let\bigdotfont=\thefont \rm
582
\def\tecky{\locc\liBlue\xleaders\hbox to10.5pt{\bf\bigdotfont\hss.\hss}\hfil\Black}
583
 
584
%%% Appendicies
585
 
586
\newcount\appnum
587
\def\appletter{\ifcase\appnum ?\or A\or B\or C\or D\or E\or F\or G\or H\or
588
   I\or J\or K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or
589
   W\or X\or Y\or Z\else ?\fi}
590
 
591
\def\app#1\par{\global\advance\appnum by1
592
  \ifx\chap\nochap \else \nextoddpage \global\let\chap=\nochap \fi
593
  \secnum=0 \seccnum=0 \relax
594
  \edef\theappnum{\appletter}\let\thechapnum=\theappnum \let\thetocnum=\theappnum
595
  \gdef\sechook ##1\def{\global\seccnum=0 
596
       \edef\thesecnum{\theappnum.\the\secnum}\let\thetocnum=\thesecnum
597
       \def}%
598
  \gdef\secchook ##1\def{%
599
       \edef\theseccnum{\theappnum.\the\secnum.\the\seccnum}\let\thetocnum=\thes
600
       \def}%
601
  \def\dotocnumafter{\wcontents\Xchap{#1}}% 
602
  \printapp{#1\unskip}\mark{}%
603
  \nobreak
604
}
605
\def\nochap#1\par{\message{CTUstyle WARNING: \noexpand\chap inside
606
                           Appendices is ignored.}}
607
 
608
\def\printapp#1{\vfil\supereject \vglue1cm
609
  \headline={\hfil\nextheadline}\xdef\headchap{\theappnum\ #1}\mark{}
610
  \line{\locc\Blue\vrule height 11mm width4mm\Black
611
  \hss\vtop{\locc\advance\hsize by-8mm
612
     \chapfont \noindent
613
     \mtext{appendix} {\bf\thefontsize[30]\dotocnum{\theappnum}}\par\nobreak
614
  \noindent\nBlue #1\strut\nbpar}}%
615
  \nobreak\bigskip
616
  \firstnoindent
617
}
618
 
619
\def\bibchap{\nonum \chap \mtext{bibliography}\par}
620
 
621
 
622
%%% Captions
623
 
624
\def\thetnum{\thechapnum.\the\tnum}
625
\def\athetnum{.}
626
\def\thefnum{\thechapnum.\the\fnum}
627
\def\athefnum{.}
628
\def\captionhook#1{\typosize[10/12]%
629
   \ifx\clabeltext\undefined \else
630
      \ifx#1t\edef\tmp{\noexpand\wref\noexpand\Xtab
631
                       {{\lastlabel}{\thetnum}{\clabeltext}}}\tmp
632
      \else  \edef\tmp{\noexpand\wref\noexpand\Xfig
633
                       {{\lastlabel}{\thefnum}{\clabeltext}}}\tmp
634
   \fi\fi
635
   \global\let\clabeltext=\undefined
636
}
637
\def\printcaption#1#2{{\bf#1 #2.}\enspace}
638
 
639
\def\clabel[#1]#2{\gdef\clabeltext{#2}\label[#1]}
640
 
641
\def\tofline#1#2#3{{\leftskip=\iindent \rightskip=\iindent plus1em
642
   \noindent\llap{\bf\ref[#1].\enspace}%
643
   {#3\unskip}\nobreak\tocdotfill\pgref[#1]\nobreak\hskip-\iindent\null\par}}
644
\let\totline=\tofline
645
 
646
%%% Numbered paragraphs
647
 
648
\newcount\numA \newcount\numB \newcount\numC \newcount\numD \newcount\numE
649
 
650
\def\chaphook#1\relax{\numA=0 \numB=0 \numC=0 \numD=0 \numE=0 
651
   \secnum=0 \seccnum=0 \tnum=0 \fnum=0 \dnum=0 \relax}
652
 
653
\def\numberedpar#1#2{\par \global\advance\csname num#1\endcsname by1
654
   \noindent\wlabel{\thechapnum.\the\csname num#1\endcsname}%
655
   {\bf#2 \thechapnum.\the\csname num#1\endcsname.}\space} 
656
 
657
%%% Blue verbatim
658
 
659
\ttindent=\parindent
660
 
661
{\tenss \thefontscale[700] \global\let\sevenss=\thefont}
662
 
663
\def\tthook{\parskip=0pt \typosize[10.5/13.6]}
664
 
665
\def\begtt{\ttskip\bgroup \wipeepar
666
   \setverb \adef{ }{ }%
667
   \ifx\savedttchar\undefined \else \catcode\savedttchar=12 \fi
668
   \parindent=\ttindent
669
   \tthook\relax
670
   \everypar={\rlap{\locc\liBlue 
671
    \hskip-\ttindent \vrule width\hsize \strut}%
672
    \ifnum\ttline<0 \else \global\advance\ttline by1
673
                \llap{\locc\Blue\sevenss\the\ttline\kern.5em\indent}\fi \kern2pt\Black}
674
   \def\par##1{\endgraf\ifx##1\egroup\else\penalty\ttpenalty\vskip-1pt\leavevmode\fi ##1}
675
   \obeylines \startverb
676
}
677
 
678
\def\viprintline{\vskip-1pt\indent
679
   \rlap{\locc\liBlue \hskip-\ttindent \vrule width\hsize \strut}%
680
   \ifnum \ttline<-1 \else 
681
      \llap{\locc\Blue\sevenrm\ifnum\ttline<0 \the\viline \else
682
               \global\advance\ttline by1 \the\ttline \fi \kern.5em\indent}\kern2pt
683
   \fi
684
   \Black \tmp\par % print the line from \tmp
685
}
686
 
687
 
688
%%% Blue centered tables
689
 
690
\def\ctable#1#2{
691
   \centerline{\setbox0=\table{#1}{#2}%
692
   \rlap{\locc\liBlue \tmpdim=\ht0 \advance\tmpdim by3pt
693
   \vrule width\wd0 height\tmpdim depth5pt\Black}\box0}\nobreak\medskip
694
}
695
\def\tabiteml{\indent}\def\tabitemr{\indent}
696
 
697
\def\cinspic#1 {\centerline{\inspic #1 }\nobreak\medskip}
698
\let\oriendinsert=\endinsert
699
\def\endinsert{\par\oriendinsert}
700
 
701
%%% Items
702
 
703
\def\normalitem{\locc\Blue{\bf\thefontsize[35].\kern-4pt}\Black\enspace}
704
\sdef{item:x}{\raise.4ex\hbox{\locc\Blue\bf\thefontsize[17].\Black} }
705
\sdef{item:n}{\the\itemnum.\kern.25em }
706
 
707
%%% BibItems
708
 
709
\let\oriurl=\url
710
 
711
\def\bibtexhook{%
712
   \parindent=2\iindent
713
   \def\url##1{\unskip\hfil\break %{\rm\thefontsize[8]URL}:
714
      {\typosize[10/]\nobreak\space\oriurl{##1}}}
715
}
716
\def\bib[#1]{\par \ifnum\bibnum>0 \bibskip \fi
717
   \advance\bibnum by1
718
   \wbib{#1}{\the\bibnum}%
719
   \hangindent=2\iindent
720
   \noindent \dest[cite:\the\bibnum]{1.2em}%
721
   \indent \llap{[\the\bibnum] }\ignorespaces
722
}
723
 
724
 
725
%%% Last thinks:
726
 
727
\def\abbrv[#1]{\par \noindent\llap{#1\quad}\ignorespaces}
728
 
729
\def\urlnote#1{\fnote{\url{#1}}}
730
\def\nextoddpage{\vfil\supereject
731
   \ifodd\pageno \else \shipout\null \advancepageno \fi}
732
 
733
\addto\runningfnotes{\addto\chaphook{\global\fnotenum=0}}
734
 
735
\shortcitations
736
\def\dprime{"}
737
\activettchar"
738
 
739
\endinput
740
 
741
%%% Versions:
742
 
743
beta(a) Jan.2013  First version released
744
beta(b) Jan.2013  - 1 mm corrected in title page
745
                  - Dodatok -> Priloha (Slovak phrase)
746
                  - liBlue is somewhat lighter (0.3 -> 0.2)
747
                  - \blackwhite and \savetonner introduced
748
                  - \headline, \footline shifted
749
                  - empty \thanks corrected
750
                  - \nextoddpage, \urlnote introduced
751
beta(c) Jan.2013  - new internal color macros
752
beta(d) Feb.2013  - skolitel/vedouci-prace set off
753
beta(e) Feb.2013  - \bibchap introduced, more space below \headline
754
beta(f) Feb.2013  - \numberedpar introduced
755
beta(g) Mar.2013  - \pagetwo added
756
beta(h) Mar.2013  - \ifnum\lastpenalty added
757
beta(i) May 2013  - \Black title in \blackwhite version
758
                  - pagenumbers are now shown in right type in Acroread
759
                  - pdfinfo introduced  
760
beta(j) May 2013  - \input pdfuni gives accented PDFoutlines + pdfinfo
761
beta(k) Jul.2013  - Correction for OPmac version Jul 2013
762
                  - \blackwhite mode: titles in Black
763
                  - \specification introduced
764
beta(l) Jul.2013  - \splittopskip-12pt plus20pt in order to avoid underfull
765
beta(m) Sep.2013  - \tofline: \rightskip=1\iindent
766
                  - \margins centered
767
beta(n) Oct.2013  - \savetonner -> \savetoner
768
                  - \onesideprinting introduced
769
beta(o) Nov.2013  - multilanguage: cz -> cz (accepts both variants)
770
beta(p) Dec.2013  - \mtext in \bibchap added (bug correction)
771
                  - \supereject in \chap, \app, \nextoddpage (bug correction)
772
beta(q) Mar.2014  - \declaration+abstracts are optional if \worktype[O/*]