forked from wenbinf/hkust-mphil-thesis
-
Notifications
You must be signed in to change notification settings - Fork 43
/
ustthesis_Department2ProgramOffice.cls
2135 lines (1901 loc) · 70.1 KB
/
ustthesis_Department2ProgramOffice.cls
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
% UST THESIS DOCUMENT CLASS -- version 2.2 - not released
% Upgraded from version 2.1 by Alan Zhuang on November 1, 2015
% according to the guidelines on thesis preparation released
% in September 2009 by the PG secretary of the University.
% UST THESIS DOCUMENT CLASS -- version 2.0 - not released
% Upgraded from version 1.0 by Kam-Fai Chan on August 1, 2001
% according to the guidelines on thesis preparation released
% on March 2001 by the PG secretary of the University.
% UST THESIS DOCUMENT CLASS -- version 1.0 - not released
%
% This is the thesis document class for the Department of Computer
% Science, The Hong Kong University of Science and Technology,
% adapted from the previous `ustthesis.sty' for LaTeX 2.09.
%
% The version 1.0 of the `ustthesis.cls' file is created by
% Kam-Fai Chan (kchan@cs.ust.hk).
%
% For the differences between the previous style file and current
% class file, please
% - search the documentation starting with "% Chan:" in this file; or
% - compare the two versions with the command "diff".
% THESIS DOCUMENT STYLE -- version 1.1 - not released
%
% This is the Department of Computer Science, The Hong Kong University
% of Science and Technology Thesis document style, adapted from the Duke
% University version brought in by Jogesh Muppala, adapted from the
% Wisconsin version brought in by Mark Holliday. The Duke University
% version adapted by Charlie Martin and Russ Tuck. The CSD-HKUST version
% adapted by Chee-Wai Yeung <cheewai@cs.ust.hk>
%
% adapted from:
% REPORT DOCUMENT STYLE -- version 0.91 - released 27 January 1985
% for LaTeX version 2.08
% Copyright (C) 1985 by Leslie Lamport
%
% Feb 6 1986 - William K. Kalsow
%
% This document style is intended to produce output comforming
% to the offical Department of Computer Science, The Hong Kong
% Univrsity of Science and Technology requirements.
%
% NOTE: only 12pt type is supported.
% only one sided output is supported.
%
% Changes by Russ Tuck (Dec. 3-11, 1986):
% changed bibliography so it is included in the table of contents
% added \newblock definition and 2 more lines to Bibliography,
% from report.sty
% reworded copyright notice
% rewrote title page handling entirely; includes AM, MS, and PhD options.
% Changes by Russ Tuck, April 1990:
% added \textspace and \textspaceundo
% added \textspace and \textspaceundo to \abstract
% no page number for \abstract
% added \acknowledgements \endacknowledgements
% many small fixes
%
% Changes by David Kotz, October 1990:
% added \biography
% added \subject for the abstract title page
% added ABSTRACT and subject to the top of abstract title page
% Changes by David Kotz, February 1991:
% removed textspace from \biography
% centered signature lines on title pages
%
% Changes by Chee-Wai Yeung, June, 1993:
%
%\typeout{Document Style `thesis'. Version 1.2, 15 Feb 1991, Duke CS Dept.}
%\typeout{Please report any problems to problem@duke.}
%
% Change to the CSD-HKUST version.
%
% Chan:
% Disable the output of the following message.
%\typeout{Document Style `ustthesis'. Version 1.3, December 1995, HKUST CS Dept.}
%\typeout{Please report any problems to cheewai@cs.ust.hk}
% Chan:
% Output the following message for "ustthesis.cls" version 1.0.
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%\ProvidesClass{ustthesis}[1999/08/31 v1.0 LaTeX document class]
%\ProvidesClass{ustthesis}[2001/08/01 v2.0 LaTeX document class]
%\ProvidesClass{ustthesis}[2002/07/23 v2.1 LaTeX document class]
% 2002/01/01 -
% Adding a definition to handle the title of acting
% department head.
% 2002/07/23 -
% Fix a logical bug to allow explicit use of \chapters
\ProvidesClass{ustthesis}[2015/11/01 v2.2 LaTeX document class]
\typeout{This class file is adapted from `ustthesis.sty' v1.3 (for LaTeX 2.09).}
%\typeout{Please report any problems to cssystem@cs.ust.hk}
\typeout{Please report any problems to kchan@cs.ust.hk}
\PassOptionsToClass{12pt,oneside}{report}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions
\LoadClass{report}[1995/12/20 v1.3q Standard LaTeX document class]
% draft option
%
% \overfullrule = 0pt % Default is don't mark overfull hboxes.
% tuck 4/4/90: Preliminary (abstract, acknowledgements) and main chapters
% must be double spaced, but toc shouldn't be. Turning on double spacing
% twice makes quadruple spacing, etc.
% \textspace turns double spacing on, and \textspaceundo turns it off.
% See \abstract and \endabstract, \acknowledgements and \endacknowledgements.
\def\textspace{\openup 2\jot\relax} % Begin double spaced text (default)
\def\textspaceundo{\openup -2\jot\relax} % Resume single spacing
\def\versiontag{} % Default is NO tag
\def\ds@draft{
%%% -- DRAFT is double spaced -- \def\textspace{} % Single spaced text
\overfullrule 5pt % Causes overfull hboxes to be marked.
\def\versiontag{{\normalsize\rm - DRAFT \number\month/\number\day{} -}}
}
%
% More options. Somehow not defined??
%
% Define four switches: \ifAM, \ifMS, \ifMPhil and \ifPhD. At most one must be
% true when the title page is actually printed. They are all set false
% here, and one is normally set true by specifying an optional
% \documentstyle parameter, one of: AM, MS, MPhil, PhD. If they are all false
% when \maketitle is invoked, the effect the same as \AMtrue.
\newif\ifAM \AMfalse
\newif\ifMS \MSfalse
\newif\ifMPhil \MPhilfalse
\newif\ifPhD \PhDfalse
\newif\ifAPPENDIX \APPENDIXfalse
\newif\ifINAPPENDIX \INAPPENDIXfalse
\def\ds@AM{
\AMtrue
}
\def\ds@MS{
\MStrue
}
\def\ds@MPhil{
\MPhiltrue
}
\def\ds@PhD{
\PhDtrue
}
% Chan:
% Disable italic to reduce the width of each word in the title.
%\newfont{\Lbi}{cmbxti10 scaled\magstep3}
%\newfont{\lbi}{cmbxti10 scaled\magstep2}
%\newfont{\nbi}{cmbxti10 scaled\magstep1}
\newfont{\Lbi}{cmbx10 scaled\magstep3}
\newfont{\lbi}{cmbx10 scaled\magstep2}
\newfont{\nbi}{cmbx10 scaled\magstep1}
%
% added \undottedtocline to be used similar to \dottedtocline except that there
% is NO dotted line.
%
%
% The vglue part will screw up when there are captions that are too long and
% wrapped. The entries in the LOF/TOC/LOT will be messed up.
% Return to the original dottedtocline macro on not fixing vglue.
% cheewai
\def\@undottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
\vskip \z@ plus.2\p@
{\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax \advance\leftskip \@tempdima \hbox{} \hskip -\leftskip
#4\hfill \nobreak
\hbox to\@pnumwidth{\hfil\reset@font\rm #5}\par}\fi}
\let\@dottedtocline\@undottedtocline
% The \@options command causes the execution of every command \ds@FOO
% which is defined and for which the user typed the FOO option in his
% \documentstyle command. For every option BAR he typed for which
% \ds@BAR is not defined, the file BAR.sty will be read after the present
% (main) .STY file is executed.
\@options
% ****************************************
% * FONTS *
% ****************************************
%
\lineskip 1pt % \lineskip is 1pt for all font sizes.
\normallineskip 1pt
\def\baselinestretch{1}
% Each size-changing command \SIZE executes the command
% \@setsize\SIZE{BASELINESKIP}\FONTSIZE\@FONTSIZE
% where:
% BASELINESKIP = Normal value of \baselineskip for that size. (Actual
% value will be \baselinestretch * BASELINESKIP.)
%
% \FONTSIZE = Name of font-size command. The currently available
% (preloaded) font sizes are: \vpt (5pt), \vipt (6pt),
% \viipt (etc.), \viiipt, \ixpt, \xpt, \xipt, \xiipt,
% \xivpt, \xviipt, \xxpt, \xxvpt.
% \@FONTSIZE = The same as the font-size command except with an
% '@' in front---e.g., if \FONTSIZE = \xivpt then
% \@FONTSIZE = \@xivpt.
%
% For reasons of efficiency that needn't concern the designer,
% the document style defines \@normalsize instead of \normalsize . This is
% done only for \normalsize, not for any other size-changing commands.
\def\@normalsize{\@setsize\normalsize{14.5pt}\xiipt\@xiipt
\abovedisplayskip 12pt plus3pt minus7pt%
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt%
\belowdisplayshortskip 6.5pt plus3.5pt minus3pt}
\def\small{\@setsize\small{13.6pt}\xipt\@xipt
\abovedisplayskip 11pt plus3pt minus6pt%
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt%
\belowdisplayshortskip 6.5pt plus3.5pt minus3pt
\def\@listi{\parsep 4.5pt plus 2pt minus 1pt
\itemsep \parsep
\topsep 9pt plus 3pt minus 5pt}}
\def\footnotesize{\@setsize\footnotesize{12pt}\xpt\@xpt
\abovedisplayskip 10pt plus2pt minus5pt%
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt%
\belowdisplayshortskip 6pt plus3pt minus3pt
\def\@listi{\topsep 6pt plus 2pt minus 2pt\parsep 3pt plus 2pt minus 1pt
\itemsep \parsep}}
\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt}
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
\def\large{\@setsize\large{18pt}\xivpt\@xivpt}
\def\Large{\@setsize\Large{22pt}\xviipt\@xviipt}
\def\LARGE{\@setsize\LARGE{25pt}\xxpt\@xxpt}
\def\huge{\@setsize\huge{30pt}\xxvpt\@xxvpt}
\let\Huge=\huge
\normalsize % Choose the normalsize font.
% ****************************************
% * PAGE LAYOUT *
% ****************************************
%
% All margin dimensions measured from a point one inch from top and side
% of page. Dimensions shrink by about 2 percent
% SIDE MARGINS:
% tuck 4/4/90: make left margin 1.75in and right 1.25 in, giving .25in
% room for error on both sides (required: 1.5in left, 1in right)
% Chan:
% Make changes according to the guidelines released on March 2001.
%\oddsidemargin 1.45cm % Left margin on odd-numbered pages.
%\evensidemargin 1.45cm % Note that \oddsidemargin = \evensidemargin
\oddsidemargin 25mm % 25mm + 15mm = 40mm
\evensidemargin 25mm % 25mm + 15mm = 40mm
\marginparwidth 25mm % Width of marginal notes.
\marginparsep 25mm % Horizontal space between outer margin and marginal note
% VERTICAL SPACING: Modified 24 Nov 87 CRM
% \topmargin 0pt vice 20pt
% Top of page:
\topmargin 25mm % Nominal distance from top of page to top of
% box containing running head.
\leftmargin 25mm
\rightmargin 25mm
% Chan:
% Make changes according to the guidelines released on March 2001.
%\headheight 12pt % Height of box containing running head.
%\headsep 8pt % Space between running head and text.
\headheight 0pt % Height of box containing running head.
\headsep 0pt % Space between running head and text.
% \topskip = 10pt % '\baselineskip' for first line of page.
% Bottom of page:
% Chan:
% \footheight becomes obsolete in LaTeX 2e.
%\footheight 12pt % Height of box containing running foot.
\footskip 20pt % Distance from baseline of box containing foot
% to baseline of last line of text.
% DIMENSION OF TEXT:
% 8 Sept 87 -- changed the page sizes for new style req't
% crm@duke.
% Chan:
% Make changes according to the guidelines released on March 2001.
%\textheight 22.7cm % Height of text (including footnotes and figures,
% excluding running head and foot). 635 vice
% 605
\textheight 247mm % 297mm - 25mm * 2 = 247mm
% According to the sample shown in the guidelines,
% page number is placed below the bottom margin.
\textwidth 14.5cm % Width of text line. 400 vice 430
% For two-column mode:
\columnsep 10pt % Space between columns
\columnseprule 0pt % Width of rule between columns.
% Chan:
% Add a new definition \PNumberAboveBottomMargin so that
% the author may choose to have the page number printed above
% the bottom margin.
\newif\ifmovedupdefined
\movedupdefinedfalse
\def\PNumberAboveBottomMargin{%
\ifmovedupdefined \else
\addtolength{\textheight}{-8mm}
\movedupdefinedtrue
\typeout{+--------}
\typeout{| Enable shorter page - page number is above the bottom margin.}
\typeout{+--------}
\fi
}
% A \raggedbottom command causes 'ragged bottom' pages: pages set to
% natural height instead of being stretched to exactly \textheight.
% FOOTNOTES:
\footnotesep 14pt % Height of strut placed at the beginning of every
% footnote.
\skip\footins 8pt plus 2pt minus 4pt % Space between last line of text and
% top of first footnote.
% FLOATS: (a float is something like a figure or table)
%
% FOR FLOATS ON A TEXT PAGE:
%
\floatsep 14pt plus 2pt minus 4pt % Space between adjacent floats moved
% to top or bottom of text page.
\textfloatsep 20pt plus 6pt minus 4pt % Space between main text and floats
% at top or bottom of page.
\intextsep 14pt plus 4pt minus 4pt % Space between in-text figures and
% text.
% Chan:
% \maxsep becomes obsolete in LaTeX 2e.
%\@maxsep 20pt % The maximum of \floatsep,
% \textfloatsep and \intextsep (minus
% the stretch and shrink).
% FOR FLOATS ON A SEPARATE FLOAT PAGE:
\@fptop 0pt plus 1fil % Stretch at top of float page. (Must be 0pt plus ...)
\@fpsep 10pt plus 2fil % Space between floats on float page.
\@fpbot 0pt plus 1fil % Stretch at bottom of float page. (Must be 0pt plus ... )
% MARGINAL NOTES:
%
\marginparpush 7pt % Minimum vertical separation between two marginal
% notes.
% ****************************************
% * PARAGRAPHING *
% ****************************************
%
\parskip 6pt plus 1pt minus 1pt % Extra vertical space between paragraphs.
\parindent 1.5em % Width of paragraph indentation.
\topsep 10pt plus 4pt minus 6pt % Extra vertical space, in addition to
% \parskip, added above and below list and
% paragraphing environments.
\partopsep 3pt plus 2pt minus 2pt % Extra vertical space, in addition to
% \parskip and \topsep, added when user
% leaves blank line before environment.
\itemsep 5pt plus 2.5pt minus 1pt % Extra vertical space, in addition to
% \parskip, added between list items.
% The following page-breaking penalties are defined
\@lowpenalty 51 % Produced by \nopagebreak[1] or \nolinebreak[1]
\@medpenalty 151 % Produced by \nopagebreak[2] or \nolinebreak[2]
\@highpenalty 301 % Produced by \nopagebreak[3] or \nolinebreak[3]
\@beginparpenalty -\@lowpenalty % Before a list or paragraph environment.
\@endparpenalty -\@lowpenalty % After a list or paragraph environment.
\@itempenalty -\@lowpenalty % Between list items.
% \clubpenalty % 'Club line' at bottom of page.
% \widowpenalty % 'Widow line' at top of page.
% \displaywidowpenalty % Math display widow line.
% \predisplaypenalty % Breaking before a math display.
% \postdisplaypenalty % Breaking after a math display.
% \interlinepenalty % Breaking at a line within a paragraph.
% \brokenpenalty % Breaking after a hyphenated line.
% ****************************************
% * CHAPTERS AND SECTIONS *
% ****************************************
%
% DEFINE COUNTERS:
%
% \newcounter{NEWCTR}[OLDCTR] : Defines NEWCTR to be a counter, which is
% reset to zero when counter OLDCTR is stepped.
% Counter OLDCTR must already be defined.
% Chan:
% The following counters have been defined in `report.cls'.
%\newcounter {chapter}
%\newcounter {section}[chapter]
%\newcounter {subsection}[section]
%\newcounter {subsubsection}[subsection]
%\newcounter {paragraph}[subsubsection]
%\newcounter {subparagraph}[paragraph]
% For any counter CTR, \theCTR is a macro that defines the printed version
% of counter CTR. It is defined in terms of the following macros:
%
% \arabic{COUNTER} : The value of COUNTER printed as an arabic numeral.
% \roman{COUNTER} : Its value printed as a lower-case roman numberal.
% \Roman{COUNTER} : Its value printed as an upper-case roman numberal.
% \alph{COUNTER} : Value of COUNTER printed as a lower-case letter:
% 1 = a, 2 = b, etc.
% \Alph{COUNTER} : Value of COUNTER printed as an upper-case letter:
% 1 = A, 2 = B, etc.
%
\def\thechapter {\arabic{chapter}}
\def\thesection {\thechapter.\arabic{section}}
\def\thesubsection {\thesection.\arabic{subsection}}
\def\thesubsubsection {\thesubsection .\arabic{subsubsection}}
\def\theparagraph {\thesubsubsection.\arabic{paragraph}}
\def\thesubparagraph {\theparagraph.\arabic{subparagraph}}
% \@chapapp is initially defined to be 'Chapter'. The \appendix
% command redefines it to be 'Appendix'.
\def\@chapapp{CHAPTER}
% \@makechapterhead {TEXT} : Makes the heading for the \chapter command.
%
% modified to suite CSD-HKUST format.
%
\def\@makechapterhead#1{ % Heading for \chapter command
\vspace*{0pt} % Space at top of text page.
{ \begin{center}
\ifnum \c@secnumdepth >\m@ne % IF secnumdepth > -1 THEN
{\Lbi \@chapapp~\thechapter} % Print 'Chapter' and number.
\par
\vskip 20pt \fi % Space between number and title.
{\Lbi % Title.
\uppercase{#1}}
\end{center}
\nobreak % TeX penalty to prevent page break.
% \vskip 40pt % Space between title and text.
}
% Chan:
% Comment out the following line. Otherwise, the page number in
% a shorter page cannot be in the same position as that in the
% other pages.
%\advance\@colht-\footskip % tell LaTeX to build a shorter page!
\pagegoal\@colht % let TeX in on what's happening
}
% \@makeschapterhead {TEXT} : Makes the heading for the \chapter* command.
%
% modified to suite CSD-HKUST format.
%
\def\@makeschapterhead#1{ % Heading for \chapter* command
\vspace*{0pt} % Space at top of page.
{ \begin{center}
{\Lbi % Title.
\uppercase{#1}\par}
\end{center}
\nobreak % TeX penalty to prevent page break.
% \vskip 40pt % Space between title and text.
}
% Chan:
% Comment out the following line. Otherwise, the page number in
% a shorter page cannot be in the same position as that in the
% other pages.
%\advance\@colht-\footskip % tell LaTeX to build a shorter page!
\pagegoal\@colht % let TeX in on what's happening
}
% \secdef{UNSTARCMDS}{STARCMDS} :
% When defining a \chapter or \section command without using
% \@startsection, you can use \secdef as follows:
% \def\chapter { ... \secdef \CMDA \CMDB }
% \def\CMDA [#1]#2{ ... % Command to define \chapter[...]{...}
% \def\CMDB #1{ ... % Command to define \chapter*{...}
\def\chapter{\clearpage % Starts new page.
\thispagestyle{headings} % Page style of chapter page is 'headings'
\global\@topnum\z@ % Prevents figures from going at top of page.
\@afterindentfalse % Suppresses indent in first paragraph. Change
\secdef\@chapter\@schapter} % to \@afterindenttrue to have indent.
\def\@chapter[#1]#2{%
% Chan:
% Add the following to insert "\chapters" automatically.
\ifbodydefined \else
\chapters
\fi
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}
\typeout{\@chapapp\space\the\c@chapter.}
% Chan:
% Comment out the following lines according to the guidelines
% released on March 2001.
% \ifAPPENDIX \addcontentsline{toc}{chapter}{Appendices}
% \APPENDIXfalse\fi
\ifINAPPENDIX
% Chan:
% Make changes according to the guidelines released on March 2001.
% \addcontentsline{toc}{appendix}{\protect
% \numberline{\thechapter}#1}\else
% \addcontentsline{toc}{chapter}{\protect
% \numberline{\thechapter}#1}
\addcontentsline{toc}{chapter}{{Appendix \thechapter}\hspace{1em}#1}\else
\addcontentsline{toc}{chapter}{{Chapter \thechapter}\hspace{1em}#1}
\fi
\else
% Chan:
% Comment out the following lines according to the guidelines
% released on March 2001.
% \ifAPPENDIX \addcontentsline{toc}{chapter}{Appendices}
% \APPENDIXfalse\fi
\ifINAPPENDIX
\addcontentsline{toc}{appendix}{\protect
\numberline{\thechapter}#1}\else
\addcontentsline{toc}{chapter}{#1}\fi
\fi
\chaptermark{#1}
\addtocontents{lof}{\protect\addvspace{1pt}} % Adds between-chapter space
\addtocontents{lot}{\protect\addvspace{1pt}} % to lists of figs & tables.
\@makechapterhead{#2}
\@afterheading % Routine called after chapter and section heading.
}
%\def\@schapter#1{\@makeschapterhead{#1} \@afterheading}
\def\@schapter#1{
\@makeschapterhead{#1}
\@afterheading % Routine called after chapter and section heading.
}
\def\pchapter#1{%% A preliminary chapter
% tuck 3/17/90: removed \thispagestyle; \chapter* handles page style.
\chapter*{#1}
\addcontentsline{toc}{chapter}{#1}
\typeout{#1}
}
% \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}
% optional * [ALTHEADING]{HEADING}
% Generic command to start a section.
% NAME : e.g., 'subsection'
% LEVEL : a number, denoting depth of section -- e.g., chapter=1,
% section = 2, etc. A section number will be printed if
% and only if LEVEL < or = the value of the secnumdepth
% counter.
% INDENT : Indentation of heading from left margin
% BEFORESKIP : Absolute value = skip to leave above the heading.
% If negative, then paragraph indent of text following
% heading is suppressed.
% AFTERSKIP : if positive, then skip to leave below heading,
% else - skip to leave to right of run-in heading.
% STYLE : commands to set style
% If '*' missing, then increments the counter. If it is present, then
% there should be no [ALTHEADING] argument. A sectioning command
% is normally defined to \@startsection + its first six arguments.
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
-.2ex}{2.3ex plus .2ex}{\Large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus
-.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\paragraph{\@startsection
{paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
{subparagraph}{4}{\parindent}{3.25ex plus 1ex minus
.2ex}{-1em}{\normalsize\bf}}
% Default initializations of \...mark commands. (See below for their
% uses in defining page styles.
%
\def\chaptermark#1{}
% \def\sectionmark#1{} % Preloaded definitions
% \def\subsectionmark#1{}
% \def\subsubsectionmark#1{}
% \def\paragraphmark#1{}
% \def\subparagraphmark#1{}
% The value of the counter secnumdepth gives the depth of the
% highest-level sectioning command that is to produce section numbers.
%
\setcounter{secnumdepth}{2}
% COPYRIGHT
%
%
% modified to suite CSD-HKUST.
%
\def\Copyright{
\typeout{Copyright}
\begin{center}
{Copyright \copyright\ by \@author~\number\year}
\end{center}
}
% Chan:
% Add a new definition \candidate for the signature on the
% authorization page.
\newlength{\AuthorNameLength}
\def\candidate#1{%
\settowidth{\AuthorNameLength}{\uppercase\expandafter{#1}}
\addtolength{\AuthorNameLength}{2cm}
\raisebox{-12pt}[0pt][17pt]{\rule{\AuthorNameLength}{.5pt}}\par
% Print line.
\raisebox{0pt}[0pt][0pt]{\uppercase\expandafter{#1}}\par
% Print name below.
}
% Authorization Page
%
% Added for authorisation
%
% cheewai
% Chan:
% Make changes according to the guidelines released on March 2001.
% "Authorsation" is changed to "Authorization" instead.
\def\authorise{
% \pchapter{Authorisation}
% \addcontentsline{toc}{chapter}{Authorisation Page}
\addcontentsline{toc}{chapter}{Authorization Page}
% Chan:
% Add some vertical space.
\mbox{} \vspace{1cm}
\begin{center}
% \underline{\Lbi Authorisation}
\underline{\Lbi Authorization}
\end{center}
\vspace{1cm}
\textspace
\mbox{}
\par\indent
{I hereby declare that I am the sole author of the thesis.}
\par\vspace{1cm}
\indent
% {I authorise The Hong Kong University of Science and Technology to lend
{I authorize the Hong Kong University of Science and Technology to lend
this thesis to other institutions or individuals for the purpose of scholarly
research.}
% Chan:
% Keep each paragraph with equal distance.
% \par\vspace{6cm}
\par\vspace{1cm}
\indent
% {I further authorise The Hong Kong University of Science and Technology
{I further authorize the Hong Kong University of Science and Technology
to reproduce the thesis by photocopying or by other means, in total or in part,
at the request of other institutions or individuals for the purpose of
scholarly research.}
% Chan:
% Add a signature part for the candidate.
\par\vspace{4cm}
\begin{center}
\candidate{\@author}
\end{center}
\textspaceundo
% \typeout{Authorisation Page}
\typeout{Authorization Page}
\newpage
}
% Chan:
% Add a new definition \TOffset for the extra vertical space
% before the title.
\def\TOffset{ \mbox{} \vglue 6ex }
% tuck 4/4/90:
% Both abstract formats are acceptable to Duke,
% as long as text of abstract is double spaced.
% ABSTRACT
%
% - this produces pages suitable for a UW-Abstract
% tuck 4/4/90: to be acceptable to Duke, must double space;
% to avoid quad spacing main chapters, use \endabstract after body of abstract.
\def\abstract{
% \pchapter{Abstract}
% Chan:
% Set \absdefined to be true and output "Abstract" (for consistence).
\absdefinedtrue
\typeout{Abstract}
\newpage
% Chan:
% Add \textspace here to prevent problems when displaying
% a long title.
\textspace
\addcontentsline{toc}{chapter}{Abstract}
% \let\footnotesize\small % Local definitions to make \thanks produce
% \let\footnoterule\relax % \normalsize footnotes with no separating rule.
\null
\parskip=0pt
% Chan:
% Add certain vertical space before the title.
\TOffset
\begin{center}
{\Lbi \uppercase\expandafter{\@title} \par}
\vglue 4ex
% Chan:
% Make changes according to the guidelines released on March 2001.
% {\lbi BY \par}
% \vglue 4ex
{\lbi by \par}
\vglue 2ex
{\lbi \uppercase\expandafter{\@author} \par}
\vglue 4ex
%% Chan:
%% Make changes according to the guidelines released on March 2001.
% {\normalsize A Thesis Presented to \par}
% {\normalsize The Hong Kong University of Science and Technology \par}
% {\normalsize in Partial Fulfillment \par}
% {\normalsize of the Requirements for \par}
% {\normalsize the Degree of \@degree\par}
% \vglue 4ex
% {\normalsize Hong Kong, \space\mon\space\number\year\par}
% \vglue 10ex
{\normalsize {\@department} Program Office\par}
\vglue 2ex
{\normalsize The Hong Kong University of Science and Technology \par}
\vglue 10ex
{\Lbi ABSTRACT \par\par\normalsize}
\end{center}
% Chan:
% Already added above.
%\textspace
}
% dfk 4/1/91: added \par to force end of paragraph before undoing
% double spacing
\def\endabstract{
\par\textspaceundo
\setcounter{footnote}{0}
}
% UNIV. Microfilms abstract
% tuck 4/4/90:
% This creates a header with info required by UMI, but the header is redundant;
% all the required info is on the abstract title page Duke requires.
%
% tuck 4/4/90: to be acceptable to Duke, must double space;
% to avoid quad spacing main chapters, use \endabstract after body of abstract.
\def\UMIabstract{
% tuck 3/17/90, replace "\titlepage\pagestyle{empty}" with next line,
% so start with page 1 (not 0) and don't turn page numbers off forever.
\abstractpage\thispagestyle{empty}
% tuck 3/17/90: added next two lines (show Abstract in toc)
\addcontentsline{toc}{chapter}{ABSTRACT}
\typeout{UMIabstract}
\textspace
\begin{center}
\def\thanks##1{} % temporarily kill any thanks lines
{\large \uppercase\expandafter{\@title} \par}
{\large\lineskip .75em\begin{tabular}[t]{c}{\@author}\end{tabular}\par}
{\large Under the supervision of Professor \@advisor \par}
\vskip 1.5em
\end{center}
}
% DEDICATION
%
\def\dedication{
\pchapter{Dedication}
\textspace
}
\def\enddedication{
\par\textspaceundo
}
% Chan:
% Make changes according to the guidelines released on March 2001.
% "Acknowledgments" is used instead of "Acknowledgements".
%% ACKNOWLEDGEMENTS
% ACKNOWLEDGMENTS
%
% tuck 4/4/90: to be acceptable to Duke, must double space; to avoid
%% quad spacing main chapters, use \endacknowledgements after body of acks.
%\def\acknowledgements{
% quad spacing main chapters, use \endacknowledgments after body of acks.
\def\acknowledgments{
% Chan:
% Set \acknowdefined to be true.
\acknowdefinedtrue
% \pchapter{Acknowledgements}
\pchapter{Acknowledgments}
\textspace
}
% dfk 4/1/91: added \par to force end of paragraph before undoing
% double spacing
%\def\endacknowledgements{
\def\endacknowledgments{
\par\textspaceundo
}
% BIOGRAPHY:
%
% dfk 10/7/89: biography is required, AFTER the references.
% I bet that it must also be double spaced, like the others.
% dfk 2/4/91: nope, we're still in double-space mode from \chapters.
% Right way might be to have an \endchapters command.
\def\biography{
\pchapter{Biography}
\textspace
}
\def\endbiography{
\textspaceundo
}
% Chan:
% Define and initialize several \newif variables for handling errors.
\newif\ifaddlinedefined
\newif\ifbodydefined
\newif\iferrordefined
\newif\iftitledefined
\newif\ifacknowdefined
\newif\iftocdefined
\newif\iflofdefined
\newif\iflotdefined
\newif\ifabsdefined
\addlinedefinedtrue
\bodydefinedfalse
\errordefinedfalse
\titledefinedfalse
\acknowdefinedfalse
\tocdefinedfalse
\lofdefinedfalse
\lotdefinedfalse
\absdefinedfalse
% Chan:
% Add a new definition \CheckParts to check if the authors has
% included all essential parts.
\def\CheckParts{
\addlinedefinedfalse
\iftitledefined \else
\typeout{}
\typeout{%
Warning: No title page. \noexpand\maketitle should be included.
}
\addlinedefinedtrue
\fi
\ifacknowdefined \else
\typeout{}
\typeout{%
Warning: No acknowledgment page.
}
\addlinedefinedtrue
\fi
\iftocdefined \else
\typeout{}
\typeout{%
Warning: No table of contents. \noexpand\tableofcontents should
be included.
}
\addlinedefinedtrue
\fi
\iflofdefined \else
\typeout{}
\typeout{%
Warning: No list of figures. \noexpand\listoffigures should
be included.
}
\addlinedefinedtrue
\fi
\iflotdefined \else
\typeout{}
\typeout{%
Warning: No list of tables. \noexpand\listoftables should
be included.
}
\addlinedefinedtrue
\fi
\ifabsdefined \else
\typeout{}
\typeout{%
Warning: No abstract.
}
\addlinedefinedtrue
\fi
\ifaddlinedefined
\typeout{}
\iferrordefined \else
\ShowSamplePath
\errordefinedtrue
\fi
\fi
}
% CHAPTERS
%
%
\def\chapters{
% Chan:
\bodydefinedtrue
% Check if all the required parts are present.
\CheckParts
\newpage
\parskip 6pt plus 1 pt minus 1pt
\textspace
\pagenumbering{arabic}
}
\def\endchapters{
\textspaceundo
\parskip=0pt
}
% APPENDIX
%
% The \appendix command must do the following:
% -- reset the chapter counter to zero
% -- set \@chapapp to Appendix (for messages)
% -- redefine the chapter counter to produce appendix numbers
% -- reset the section counter to zero
% -- redefine the \chapter command if appendix titles and headings are
% to look different from chapter titles and headings.
\def\appendix{\par
\APPENDIXtrue
\INAPPENDIXtrue
\parskip 6pt plus 1pt minus 1pt
\setcounter{chapter}{0}
\setcounter{section}{0}
\def\@chapapp{APPENDIX}
\def\thechapter{\Alph{chapter}}}
\def\endappendix{
\textspaceundo
\parskip=0pt
}
% ****************************************
% * LISTS *
% ****************************************
%
% The following commands are used to set the default values for the list
% environment's parameters. See the LaTeX manual for an explanation of
% the meanings of the parameters. Defaults for the list environment are
% set as follows. First, \rightmargin, \listparindent and \itemindent
% are set to 0pt. Then, for a Kth level list, the command \@listK is
% called, where 'K' denotes 'i', 'ii', ... , 'vi'. (I.e., \@listiii is
% called for a third-level list.) By convention, \@listK should set
% \leftmargin to \leftmarginK.
%
% For efficiency, level-one list's values are defined at top level, and
% \@listi is defined to set only \leftmargin.
\leftmargini 2.5em
\leftmarginii 2.2em % > \labelsep + width of '(m)'
\leftmarginiii 1.87em % > \labelsep + width of 'vii.'
\leftmarginiv 1.7em % > \labelsep + width of 'M.'
\leftmarginv 1em
\leftmarginvi 1em
\leftmargin\leftmargini
\labelwidth\leftmargini\advance\labelwidth-\labelsep
\labelsep .5em
\parsep 5pt plus 2.5pt minus 1pt
\def\@listi{\leftmargin\leftmargini}
\def\@listii{\leftmargin\leftmarginii
\labelwidth\leftmarginii\advance\labelwidth-\labelsep
\topsep 5pt plus 2.5pt minus 1pt
\parsep 2.5pt plus 1pt minus 1pt
\itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii\advance\labelwidth-\labelsep
\topsep 2.5pt plus 1pt minus 1pt
\parsep \z@ \partopsep 1pt plus 0pt minus 1pt
\itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
\labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv