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
|
%% hepthesis
%% LaTeX class for writing PhD theses, particularly those for
%% high energy physics (HEP)
%% Author: Andy Buckley <andy@insectnation.org>
%%
%% This material is subject to the LaTeX Project Public License.
%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
%% or the details of that license.
%%
%% Please let me know if you use hepthesis and what you think of it.
%% I'll try to implement any suggested options or geometry changes,
%% provided I think they're a good idea!
%% ========================================================================
%% Admin
%% ========================================================================
\def\fileversion{1.4.2}
\def\filedate{2008/05/23}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{hepthesis}[\filedate\space HEP thesis class by Andy Buckley (v\fileversion)]
%% ========================================================================
%% Option parsing
%% ========================================================================
%% Conditional packages (can be disabled)
\def\@empty{}
\def\@yes{yes}
\def\@requireamsmath{yes}
\def\@requirebooktabs{yes}
\def\@requiremakeidx{}
\def\@requiretitling{}
\def\@requirehep{}
\def\@requirehyper{}
\def\@requiredraft{}
\def\@useAFour{yes}
\def\@requireAFourWide{}
\def\@oneside{}
%% TODO: Make "yes" by default...
\def\@sftitles{}
\def\@bindmargins{yes}
\def\@hidefrontmatter{}
\def\@hidebackmatter{}
%% TODO: how to handle this?
%\usepackage[babel]{csquotes}[2007/03/25]
%% Part-wise spacing commands and definitions
\def\@frontmatterspacing{onehalfspacing}
\def\@mainmatterspacing{onehalfspacing}
\def\@appendixspacing{onehalfspacing}
\def\@backmatterspacing{onehalfspacing}
%% One-sided or two-sided (bound copies may have to be single-sided)
\DeclareOption{oneside}{%
\def\@oneside{yes}
\PassOptionsToClass{oneside}{scrbook}}
\DeclareOption{twoside}{%
\def\@oneside{}
\PassOptionsToClass{twoside}{scrbook}}
%% Sans serif titles?
\DeclareOption{sftitles}{%
\def\@sftitles{yes}}
\DeclareOption{rmtitles}{%
\def\@sftitles{}}
%% Pad inner margins for binding
\DeclareOption{bind}{%
\def\@bindmargins{yes}}
\DeclareOption{nobind}{%
\def\@bindmargins{}}
%% Use binding margins if output is not PDF
\DeclareOption{bindnopdf}{
\ifx\pdfoutput\undefined%
\def\@bindmargins{yes}%
\else%
\def\@bindmargins{}%
\fi%
}
%% Use AMS math packages
\DeclareOption{noams}{%
\def\@requireamsmath{}}
\DeclareOption{ams}{%
\def\@requireamsmath{yes}}
%% Change footnote markers to alphabetic
\DeclareOption{alphafoot}{%
\DeclareRobustCommand{\thefootnote}{\alph{footnote}}%
}
%% Draft mode with line numbers and draft over-print
\DeclareOption{draft}{%
\def\@requiredraft{yes}
\AtEndOfPackage{%
\let\@oldermainmatter\mainmatter%
\DeclareRobustCommand{\mainmatter}{\@oldermainmatter\linenumbers}%
}
}
%% Disable the frontmatter
\DeclareOption{hidefront}{%
\def\@hidefrontmatter{yes}
}
\DeclareOption{hideback}{%
\def\@hidebackmatter{yes}
}
\DeclareOption{hidefrontback}{%
\def\@hidefrontmatter{yes}
\def\@hidebackmatter{yes}
}
% Use hyperref package (with decent options)
\DeclareOption{hyper}{
\def\@requirehyper{yes}}
% Use hyperref package (with decent options) only if output is PDF
\DeclareOption{hyperpdf}{
\ifx\pdfoutput\undefined\else%
\def\@requirehyper{yes}%
\fi%
}
%% Don't break enumerations (etc.) across pages in
%% an ugly manner
\clubpenalty = 10000
\widowpenalty = 10000
%% Use nice-looking tables
\DeclareOption{booktabs}{%
\def\@requirebooktabs{yes}}
\DeclareOption{nobooktabs}{%
\def\@requirebooktabs{}}
%% Allows us to make an index
\DeclareOption{index}{%
\def\@requiremakeidx{yes}
}
%% Allows us to make an index
\DeclareOption{titling}{%
\def\@requiretitling{yes}
}
%% Particle physics options
\DeclareOption{hep}{%
\def\@requirehep{yes}
}
%% Paper size (wide A4 is default)
\DeclareOption{a4paper}{%
\def\@useAFour{yes}%
\def\@requireAFourWide{yes}%
}
\DeclareOption{a4narrow}{%
\def\@useAFour{yes}%
\def\@requireAFourWide{}%
}
\DeclareOption{a5paper}{%
\def\@useAFour{}%
\PassOptionsToClass{a5paper}{scrbook}%
}
\DeclareOption{b5paper}{%
\def\@useAFour{}%
\PassOptionsToClass{b5paper}{scrbook}%
}
\DeclareOption{letterpaper}{%
\def\@useAFour{}%
\PassOptionsToClass{letterpaper}{scrbook}%
}
\DeclareOption{legalpaper}{%
\def\@useAFour{}%
\PassOptionsToClass{legalpaper}{scrbook}%
}
\DeclareOption{executivepaper}{%
\def\@useAFour{}%
\PassOptionsToClass{executivepaper}{scrbook}%
}
%% Handle the A4 default paper size
\ifx\@useAFour\@empty\else%
\PassOptionsToClass{a4paper}{scrbook}%
\fi
%% Options to be passed to the hep package
\DeclareOption{hepfd}{\def\@requirehep{yes}\PassOptionsToPackage{fd}{hep}}
\DeclareOption{heplayout}{\def\@requirehep{yes}\PassOptionsToPackage{layout}{hep}}
\DeclareOption{hephyper}{\def\@requirehep{yes}\PassOptionsToPackage{hyper}{hep}}
\DeclareOption{hepfloat}{\def\@requirehep{yes}\PassOptionsToPackage{float}{hep}}
\DeclareOption{hepall}{\def\@requirehep{yes}\PassOptionsToPackage{all}{hep}}
%% Process the options (no package requirement allowed above here)
\ProcessOptions
%% ========================================================================
%% Base class and packages
%% ========================================================================
%% Base class
\LoadClass[12pt,chapterprefix]{scrbook}
%% Use wide format if using A4 paper
\ifx\@requireAFourWide\@empty\else\RequirePackage{a4wide}\fi
%% Need to be able to locally change the text width.
\RequirePackage{chngpage}
%% Used to center the variable width page quote (must be version >= 0.9a)
\RequirePackage{varwidth}[2003/03/10]
%% AMS math package (optional)
\ifx\@requireamsmath\@empty\else%
\RequirePackage{amsmath}
\AtEndOfPackage{%
%% Displayed maths environments re-defined to be the same as AMS' align
\renewenvironment{displaymath}{\align}{\endalign\ignorespacesafterend}
\newenvironment{displaymath*}%
{\expandafter\let\expandafter\@oldoldalignstar \csname align*\endcsname \@oldoldalignstar}%
{\expandafter\let\expandafter\@oldoldendalignstar \csname endalign*\endcsname \@oldoldendalignstar \ignorespacesafterend}
\renewenvironment{equation}{\align}{\endalign\ignorespacesafterend}
\renewenvironment{equation*}%
{\expandafter\let\expandafter\@oldoldalignstar \csname align*\endcsname \@oldoldalignstar}%
{\expandafter\let\expandafter\@oldoldendalignstar \csname endalign*\endcsname \@oldoldendalignstar \ignorespacesafterend}
}%
\fi
%% Index building (optional)
\ifx\@requiremakeidx\@empty\else\RequirePackage{makeidx}\fi
%% Use the \title and \author arguments to build the front page etc.
\ifx\@requiretitling\@empty%
%% Re-define \title and \author to store their args in \thetitle, \theauthor variables
\renewcommand*\title[1]{\gdef\@title{#1}\global\let\thetitle\@title}%
\renewcommand*\author[1]{\gdef\@author{#1}\global\let\theauthor\@author}%
\else%
\RequirePackage{titling}%
\fi
%% Serif titles
\ifx\@sftitles\@empty
\addtokomafont{sectioning}{\rmfamily\bfseries}
\fi
%% In standard tabular: aligns \hline properly with vertical
%% lines (check with zoom). But you shouldn't using vertical
%% lines, should you? See booktabs documentation ;-)
%\RequirePackage{array}
%% Nice tables (optional)
\ifx\@requirebooktabs\@empty\else%
\RequirePackage{booktabs}
\AtEndOfClass{%
%% Tabular environment, defined to use the booktabs facilities
\let\@oldtabular\tabular
\let\@oldendtabular\endtabular
\renewenvironment{tabular}[1]{%
\@oldtabular{@{}#1@{}}%
\toprule%
}{%
\bottomrule%
\@oldendtabular%
\ignorespacesafterend%
}
%%
}%
\fi
%% Convenience-included HEP packages (optional)
\ifx\@requirehep\@empty\else\RequirePackage{hep}\fi
%% ``DRAFT'' underprint and line numbering in draft mode (optional)
\ifx\@requiredraft\@empty\else%
\RequirePackage[pagewise, mathlines]{lineno}
\RequirePackage{draftcopy}
\fi
%% The right way to do custom spacing
\RequirePackage{setspace}
%% \singlespacing, \onehalfspacing, \doublespacing
%% \begin{spacing}{2.5} ...
%% Funky headers
\RequirePackage{fancyhdr}
%% Make sure bibliography (but not ToC) appears in the ToC
\RequirePackage[nottoc]{tocbibind}
%% Verbatim things
\RequirePackage{verbatim,comment}
%% Rotated figures
\RequirePackage{rotating}
%% Re-defines captions of figures and tables
%% TODO: make configurable / optional?
\RequirePackage[format=hang,labelfont=bf,labelsep=colon,font=small]{caption}[2004/01/23]
%% Hyperlinks (optional, has to come late in the package list)
\ifx\@requirehyper\@empty\else%
\RequirePackage[colorlinks=true,bookmarks=true,plainpages=false]{hyperref}%
%pdfpagemode=None, FullScreen, UseThumbs, UseOutlines
\fi
%% Misc tweaks
\AtEndOfClass{%
%% Make maths in titles go automatically bold
\g@addto@macro\bfseries{\boldmath}
%% Declare a bold version of the typewriter font
\DeclareFontShape{OT1}{cmtt}{bx}{n}{<5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88>cmttb10}{}
}
%% ========================================================================
%% Length definitions
%% ========================================================================
\setlength{\parindent}{0.6cm} % tweak the initial indent in paras
\setlength{\parskip}{0.3cm} % tweak the intra-para gap size
\setlength{\topmargin}{0in}
\setlength{\textheight}{9in}
\setlength{\footskip}{0.5in}
\setlength{\textwidth}{6.2in}
%% Increase inner margins for binding
\newlength{\@bindextramargin}
\AtEndOfClass{%
\ifx\@bindmargins\@empty%
\setlength{\@bindextramargin}{0.0in}
\else%
\setlength{\@bindextramargin}{0.2in}
\fi
\setlength{\oddsidemargin}{\@bindextramargin}
\setlength{\evensidemargin}{-\@bindextramargin}
}
%% Redefine bits of document shape
\renewcommand{\topfraction}{0.95}%
\renewcommand{\bottomfraction}{0.95}%
\renewcommand{\textfraction}{0.05}%
\renewcommand{\arraystretch}{1.25}%
%% Reset rule widths and the header width
\renewcommand{\headwidth}{\textwidth}%
\renewcommand{\headrulewidth}{0.5pt}%
\renewcommand{\footrulewidth}{0pt}%
\addtolength{\headheight}{2.5pt}%
\addtolength{\headsep}{20pt}%
%% Extra margins for various sections
\newlength{\@mainmatterextramargin}%
\setlength{\@mainmatterextramargin}{0cm}%
\newlength{\@backmatterextramargin}%
\setlength{\@backmatterextramargin}{0cm}%
\newlength{\@frontmatterextramargin}%
\setlength{\@frontmatterextramargin}{0cm}%
\newlength{\@appendixextramargin}%
\setlength{\@appendixextramargin}{0cm}%
\newlength{\@abstractextramargin}%
\setlength{\@abstractextramargin}{1.5cm}%
\newlength{\@declarationextramargin}%
\setlength{\@declarationextramargin}{1cm}%
\newlength{\@acknowledgementsextramargin}%
\setlength{\@acknowledgementsextramargin}{0cm}%
\newlength{\@prefaceextramargin}%
\setlength{\@prefaceextramargin}{0cm}%
\newlength{\@pagequoteextramargin}%
\setlength{\@pagequoteextramargin}{2cm}%
%% Top vertical spacing in the front matter
\newlength{\@frontmattertopskip}%
\newlength{\@frontmattertitletopskip}%
\newlength{\frontmattertitleskip}%
\addtolength{\frontmattertitleskip}{2cm}%
\addtolength{\@frontmattertitletopskip}{0cm}%
\setlength{\@frontmattertopskip}{\frontmattertitleskip}%
\addtolength{\@frontmattertopskip}{\@frontmattertitletopskip}%
%% Figure widths
\newlength{\smallfigwidth}
\newlength{\mediumfigwidth}
\newlength{\largefigwidth}
\newlength{\hugefigwidth}
\setlength{\smallfigwidth}{0.45\textwidth}
\setlength{\mediumfigwidth}{0.6\textwidth}
\setlength{\largefigwidth}{0.75\textwidth}
\setlength{\hugefigwidth}{0.9\textwidth}
%% Figure width aliases
\newlength{\littlefigwidth}
\newlength{\bigfigwidth}
\setlength{\littlefigwidth}{\smallfigwidth}
\setlength{\bigfigwidth}{\largefigwidth}
%% ========================================================================
%% Headers and footers
%% ========================================================================
%% No header or footer on the title page
\AtBeginDocument{\thispagestyle{plain}}
%% Use funky headers and footers
\pagestyle{fancy}
%% Normal headers and footers (headers are all like RH pages for oneside)
\ifx\@oneside\@empty%
\fancyhead[RO,LE]{\bfseries\thepage}%
\fancyhead[LO,RE]{\bfseries\leftmark}%
\else%
\fancyhead[RO,R]{\bfseries\thepage}%
\fancyhead[LO,L]{\bfseries\leftmark}%
\fi%
\fancyfoot{}%
%% Lower case header content
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}%
}
%% Headers and footers for plain (blank) pages
\fancypagestyle{plain}{%
\fancyhf{}%
%\fancyhead[RO,LE]{\bfseries \thepage}%
\fancyfoot[C]{\bfseries \thepage}%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
}
%% Treat forced blank pages in the same way as chapter title pages
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
\hbox{}%
%\thispagestyle{empty}%
\thispagestyle{plain}%
\newpage%
\if@twocolumn\hbox{}\newpage\fi\fi\fi}%
%% Provide mixed-case versions of the Table of contents,
%% List of tables, List of figures, Bibliography etc. header names
\DeclareRobustCommand{\contentsname}{Contents}
\DeclareRobustCommand{\bibname}{Bibliography}
\DeclareRobustCommand{\listfigurename}{List of figures}
\DeclareRobustCommand{\listtablename}{List of tables}
%% Commenting out front and back matter
\ifx\@hidefrontmatter\@yes\AtBeginDocument{\excludecomment{frontmatter}}\fi
\ifx\@hidebackmatter\@yes\AtBeginDocument{\excludecomment{backmatter}}\fi
%% ========================================================================
%% Internal environments and commands
%% ========================================================================
%% Provide dumb quoting commands in case the csquotes package hasn't been used.
\AtEndOfClass{%
\providecommand{\enquote}[1]{``#1''}%
\providecommand{\foreignquote}[1]{``#1''}%
}
%% ========================================================================
%% Public environments and commands
%% ========================================================================
%% Change the spacing of lines
\DeclareRobustCommand{\setspacing}[1]{%
\setfrontmatterspacing{#1}%
\setmainmatterspacing{#1}%
\setappendixspacing{#1}%
\setbackmatterspacing{#1}%
}
\DeclareRobustCommand{\setfrontmatterspacing}[1]{\def\@frontmatterspacing{#1spacing}}
\DeclareRobustCommand{\setmainmatterspacing}[1]{\def\@mainmatterspacing{#1spacing}}
\DeclareRobustCommand{\setappendixspacing}[1]{\def\@appendixspacing{#1spacing}}
\DeclareRobustCommand{\setbackmatterspacing}[1]{\def\@backmatterspacing{#1spacing}}
%% Change the extra margin size
\DeclareRobustCommand{\setextramargins}[1]{%
\setfrontmatterextramargins{#1}%
\setmainmatterextramargins{#1}%
\setappendixextramargins{#1}%
\setbackmatterextramargins{#1}%
}
\DeclareRobustCommand{\setfrontmatterextramarginsg}[1]{\setlength{\@frontmatterextramargin}{#1}}
\DeclareRobustCommand{\setmainmatterextramargins}[1]{\setlength{\@mainmatterextramargin}{#1}}
\DeclareRobustCommand{\setappendixextramargins}[1]{\setlength{\@appendixextramargin}{#1}}
\DeclareRobustCommand{\setbackmatterextramargins}[1]{\setlength{\@backmatterextramargin}{#1}}
\DeclareRobustCommand{\setabstractextramargins}[1]{\setlength{\@abstractextramargin}{#1}}
\DeclareRobustCommand{\setdeclarationextramargins}[1]{\setlength{\@declarationextramargin}{#1}}
\DeclareRobustCommand{\setacknowledgementsextramargins}[1]{\setlength{\@acknowledgementsextramargin}{#1}}
\DeclareRobustCommand{\setprefaceextramargins}[1]{\setlength{\@prefaceextramargin}{#1}}
%% An environment for the rubbish at the front of a typical thesis
\let\@oldfrontmatter\frontmatter
\specialcomment{frontmatter}{%
\setcounter{tocdepth}{2}% show down to subsections in contents
\setcounter{secnumdepth}{2}% number down to subsections
\newcounter{iterlist}%
\@oldfrontmatter%
\adjustwidth[]{\@frontmatterextramargin}{\@frontmatterextramargin}%
\begin{\@frontmatterspacing}%
}{%
\end{\@frontmatterspacing}%
\endadjustwidth%
\ignorespacesafterend%
}
%% Environment for the thesis main body
\let\@oldmainmatter\mainmatter
\specialcomment{mainmatter}{%
%\@oldmainmatter%
\@mainmattertrue
\pagenumbering{arabic}%
\adjustwidth[]{\@mainmatterextramargin}{\@mainmatterextramargin}%
\begin{\@mainmatterspacing}%
}{%
\end{\@mainmatterspacing}%
\endadjustwidth%
\ignorespacesafterend%
}
%% Environment for appendices
\specialcomment{appendices}{%
\adjustwidth[]{\@appendixextramargin}{\@appendixextramargin}%
\begin{\@appendixspacing}%
\appendix%
}{%
\end{\@appendixspacing}%
\endadjustwidth%
\ignorespacesafterend%
}
%% Environment for all the junk at the end of the thesis
\let\@oldbackmatter\backmatter
\specialcomment{backmatter}{%
\@oldbackmatter%
\adjustwidth[]{\@backmatterextramargin}{\@backmatterextramargin}%
\begin{\@backmatterspacing}%
\appendix%
}{%
\end{\@backmatterspacing}%
\endadjustwidth%
\ignorespacesafterend%
}
%% Environment for acknowledgements page in frontmatter
\newenvironment{acknowledgements}{%
\cleardoublepage%
\adjustwidth[]{\@acknowledgementsextramargin}{\@acknowledgementsextramargin}%
\vspace*{\@frontmattertopskip}%
\begin{center}%
\begingroup
\ifx\@sftitles\@empty\else\sf\fi
{\LARGE{\textbf{Acknowledgements}}}%
\endgroup
\end{center}%
\vspace*{1cm}%
}{%
\endadjustwidth%
\ignorespacesafterend%
}
%% Environment for preface page in frontmatter
\newenvironment{preface}{%
\cleardoublepage%
\adjustwidth[]{\@prefaceextramargin}{\@prefaceextramargin}%
\vspace*{\@frontmattertopskip}%
\begin{center}%
\begingroup
\ifx\@sftitles\@empty\else\sf\fi
{\LARGE{\textbf{Preface}}}%
\endgroup
\end{center}%
\vspace*{1cm}%
}{%
\endadjustwidth%
\ignorespacesafterend %
}
%% Environment for declaration rubrik page in frontmatter
%% (flushright doesn't work in this macro for some reason,
%% so you'll have to do that bit yourself like in the
%% example file)
\newenvironment{declaration}{%
\cleardoublepage%
\adjustwidth[]{\@declarationextramargin}{\@declarationextramargin}%
\vspace*{\@frontmattertopskip}%
\begin{center}%
\begingroup
\ifx\@sftitles\@empty\else\sf\fi
{\LARGE\textbf{Declaration}}%
\endgroup
\end{center}%
\vspace*{1cm}%
}{%
%\newline \newline \newline%
%\begin{flushright}
% \thesisauthor\newline
% \today\newline
%\end{flushright}
\endadjustwidth%
\ignorespacesafterend%
}
%% Environment for thesis abstract in frontmatter
%% (argument is the thesis title)
\newenvironment{abstract}[1][Abstract]{%
\adjustwidth[]{\@abstractextramargin}{\@abstractextramargin}%
\cleardoublepage%
\vspace*{\@frontmattertopskip}%
\begin{center}%
\begingroup
\ifx\@sftitles\@empty\else\sf\fi
{\LARGE\textbf{#1}}%
\endgroup
\end{center}%
\vspace*{1cm}%
}{%
\endadjustwidth%
\ignorespacesafterend%
}
%% Deprecated: combined command for defining the title and author in the preamble
%% TODO Remove in 1.5
\DeclareRobustCommand{\definethesis}[2]{%
\typeout{hepthesis: definethesis macro is deprecated. Use author and title macros instead.}
\author{#1}%
\title{#2}%
}
%% Makes a thesis title page
\let\@oldtitlepage\titlepage
\let\@oldendtitlepage\endtitlepage
\DeclareRobustCommand{\titlepage}[2][]{%
%\@oldtitlepage%
\thispagestyle{empty}%
\begingroup%
\ifx\@sftitles\@empty\else\sf\fi%
\begin{center}%
\vspace*{\frontmattertitleskip}%
\begin{doublespace}%
{\Huge\textbf{\thetitle}}\\%
\end{doublespace}%
\vspace*{3cm}%
{\Large{{\theauthor} \\ {#1}}}\\%
\vspace*{8cm}%
{#2}%
\end{center}%
\endgroup%
%\@oldendtitlepage%
%\cleardoublepage%
}
\renewcommand{\maketitle}[1]{\titlepage{}}
%% A quote on its own page
\newlength{\@oldparindent}
\setlength{\@oldparindent}{\parindent}
\DeclareRobustCommand{\pagequote}[3][same]{%
\cleardoublepage%
\vspace*{\stretch{2}}%
\thispagestyle{plain}%
\pagestyle{plain}%
\begin{center}%
\begin{varwidth}{\textwidth}%
\def\@samelang{same}%
\def\@reqlang{#1}%
\ifx\@samelang\@reqlang%
\noindent\textsl{\enquote{#2}}%
\else%
\noindent\textsl{\foreignquote{\@reqlang}{#2}}%
\fi%
\newline%
\setlength{\parindent}{\@oldparindent}
\indent --- {#3}%
\end{varwidth}%
\end{center}%
\vspace*{\stretch{4}}%
%\cleardoublepage%
\pagestyle{plain}%
}
%% Alias
\let\frontquote\pagequote
%% A quote on its own page
\DeclareRobustCommand{\dedication}[1]{%
\cleardoublepage%
\vspace*{\stretch{2}}%
\thispagestyle{plain}%
\pagestyle{plain}%
\begin{center}%
\begin{varwidth}{\textwidth}%
\noindent\textsl{\enquote{#1}}%
\end{varwidth}%
\end{center}%
\vspace*{\stretch{4}}%
%\cleardoublepage%
\pagestyle{plain}%
}
%% Environment for colophon in backmatter
\newenvironment{colophon}{%
\chapter*{Colophon}%
\@mkboth{\MakeUppercase{Colophon}}{\MakeUppercase{Colophon}}%
}{%
\ignorespacesafterend %
}
%% Typesets a chapter quote
\DeclareRobustCommand{\chapterquote}[3][same]{%
\def\@samelang{same}%
\def\@reqlang{#1}%
\begin{adjustwidth}[]{}{3cm}%
\ifx\@samelang\@reqlang%
\noindent\emph{\enquote{#2}}%
\else%
\noindent\emph{\foreignquote{\@reqlang}{#2}}%
\fi%
\newline%
\indent --- #3%
\end{adjustwidth}%
\vspace{1cm}%
}
%% Typesets the first para of a chapter slightly differently
%% (I don't use it, so maybe it needs some work)
\newenvironment{chapterintro}[1][blah]{%
%\begingroup
\def\thearg{#1}%
\def\sans{sf}%
\def\italic{it}%
\def\sansit{sfit}%
\ifx\thearg\sans%
\sffamily%
\else%
\ifx\thearg\italic%
\it%
\else%
\ifx\thearg\sansit%
\sffamily%
\it%
\fi\fi\fi%
}{%
\ignorespacesafterend%
%\endgroup
}
%% Bold inline section heading with a finishing colon
\DeclareRobustCommand{\verysubsection}[1]{{\noindent\textbf{#1:}}}
%% Table environment
\let\@oldtable\table
\let\@oldendtable\endtable
\renewenvironment{table}[1][tbp]{%
\vspace{0.4cm}%
\@oldtable[#1]%
\begin{center}%
}{%
\end{center}%
\@oldendtable%
\ignorespacesafterend%
}
%% Figure environment
\let\@oldfigure\figure
\let\@oldendfigure\endfigure
\renewenvironment{figure}[1][tbp]{
\@oldfigure[#1]%
\begin{center}%
}{%
\end{center}%
\@oldendfigure%
\ignorespacesafterend%
}
%% Figure* environment (lots of \expandafter and \csname gubbins reqd... *sigh*)
\expandafter\let\expandafter\@oldfigurestar \csname figure*\endcsname
\expandafter\let\expandafter\@oldendfigurestar \csname endfigure*\endcsname
\renewenvironment{figure*}[1][tbp]{
\@oldfigurestar[#1]%
\begin{center}%
}{%
\end{center}%
\@oldendfigurestar%
\ignorespacesafterend%
}
%% Sideways figure environment
\let\@oldsidewaysfigure\sidewaysfigure
\let\@oldendsidewaysfigure\endsidewaysfigure
\renewenvironment{sidewaysfigure}[1][tbp]{
\@oldsidewaysfigure[#1]%
\begin{center}%
}{%
\end{center}%
\@oldendsidewaysfigure%
\ignorespacesafterend%
}
%% ``Thesis''-prefixed duplicate commands and environments (deprecated)
\newcommand{\thesistypeout}{\typeout{hepthesis: thesis- prefix commands are deprecated and will be removed from hepthesis v1.5 onwards}}
\newenvironment{thesistable}{\thesistypeout\table}{\endtable\ignorespacesafterend}
\newenvironment{thesistabular}{\thesistypeout\tabular}{\endtabular\ignorespacesafterend}
\newenvironment{thesisfigure}{\thesistypeout\expandafter\let\expandafter\@oldoldfigurestar \csname figure*\endcsname \@oldoldfigurestar}%
{\expandafter\let\expandafter\@oldoldendfigurestar \csname endfigure*\endcsname \@oldoldendfigurestar \ignorespacesafterend}
\newenvironment{thesissidewaysfigure}{\thesistypeout\sidewaysfigure}{\endsidewaysfigure\ignorespacesafterend}
\newenvironment{thesisdisplaymath}{\thesistypeout\displaymath}{\enddisplaymath\ignorespacesafterend}
\newenvironment{thesisdisplaymath*}{\thesistypeout\expandafter\let\expandafter\@oldolddisplaymathstar \csname displaymath*\endcsname \@oldolddisplaymathstar}%
{\expandafter\let\expandafter\@oldoldenddisplaymathstar \csname enddisplaymath*\endcsname \@oldoldenddisplaymathstar \ignorespacesafterend}
\newenvironment{thesisequation}{\thesistypeout\equation}{\endequation\ignorespacesafterend}
\newenvironment{thesisequation*}{\thesistypeout\expandafter\let\expandafter\@oldoldequationstar \csname equation*\endcsname \@oldoldequationstar}%
{\expandafter\let\expandafter\@oldoldendequationstar \csname endequation*\endcsname \@oldoldendequationstar \ignorespacesafterend}
\newenvironment{thesisdeclaration}{\thesistypeout\declaration}{\enddeclaration\ignorespacesafterend}
\newenvironment{thesisabstract}[1][Abstract]{\thesistypeout\abstract[#1]}{\endabstract\ignorespacesafterend}
\newenvironment{thesischapterintro}[1]{\thesistypeout\chapterintro{#1}}{\endchapterintro\ignorespacesafterend}
\newenvironment{thesispreface}{\thesistypeout\preface}{\endpreface\ignorespacesafterend}
\newenvironment{thesisacknowledgements}[1]{\thesistypeout\acknowledgements}{\endacknowledgements\ignorespacesafterend}
\newenvironment{thesisfrontmatter}{\thesistypeout\frontmatter}{\ignorespacesafterend}
\newenvironment{thesismainmatter}{\thesistypeout\mainmatter}{\ignorespacesafterend}
\newenvironment{thesisbackmatter}{\thesistypeout\backmatter}{\ignorespacesafterend}
\DeclareRobustCommand{\thesistitlepage}[2][]{\thesistypeout\titlepage{#1}{#2}}
\DeclareRobustCommand{\thesisfrontquote}[2]{\thesistypeout\frontquote{#1}{#2}}
\DeclareRobustCommand{\thesischapterquote}[2]{\thesistypeout\chapterquote{#1}{#2}}
\DeclareRobustCommand{\thesisverysubsection}[1]{\thesistypeout\verysubsection{#1}}
%% In-document references
\DeclareRobustCommand{\Chapter}{Chapter\xspace}
\DeclareRobustCommand{\Section}{Section\xspace}
\DeclareRobustCommand{\Appendix}{Appendix\xspace}
\DeclareRobustCommand{\Figure}{Figure\xspace}
\DeclareRobustCommand{\Table}{Table\xspace}
\DeclareRobustCommand{\Equation}{equation\xspace}
\DeclareRobustCommand{\Reference}{reference\xspace}
%% Standard way to refer to a page number
\DeclareRobustCommand{\Page}{page\xspace}
%% Reference terms with built-in reference
\DeclareRobustCommand{\ChapterRef}[1]{\Chapter~\ref{#1}}
\DeclareRobustCommand{\SectionRef}[1]{\Section~\ref{#1}}
\DeclareRobustCommand{\AppendixRef}[1]{\Appendix~\ref{#1}}
\DeclareRobustCommand{\FigureRef}[1]{\Figure~\ref{#1}}
\DeclareRobustCommand{\TableRef}[1]{\Table~\ref{#1}}
\DeclareRobustCommand{\EquationRef}[1]{\Equation~\eqref{#1}}
\DeclareRobustCommand{\ReferenceRef}[1]{\Reference~\cite{#1}}
\DeclareRobustCommand{\PageRef}[1]{\Page~\pageref{#1}}
|