Debian Codegraph @

texmf-dist/doc/latex/hepthesis/hepthesis.tex

raw
1 \documentclass[12pt]{article}
2 \usepackage{mathpazo}
3 \usepackage{maybemath,xspace,setspace,fancybox,fancyvrb}
4 \usepackage{a4wide,url,relsize,underscore}
5 \usepackage[colorlinks=true,bookmarks=true]{hyperref}
6 \newcommand{\maybemath}{\texttt{maybemath}\xspace}
7 \newcommand{\hepthesis}{\texttt{hepthesis}\xspace}
8
9 \onehalfspacing
10 \DefineShortVerb{\|}
11 \setlength{\fboxsep}{10pt}
12 \addtolength{\fboxrule}{0.6\fboxrule}
13
14 \newcommand{\hepthesisversion}{v1.5.2}
15 \author{Andy Buckley, \texttt{[email protected]}}
16 \title{hepthesis \hepthesisversion \\ \smaller A class for typesetting academic theses}
17
18 %% Bold tt font
19 \DeclareFontShape{OT1}{cmtt}{bx}{n}{<5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88>cmttb10}{}
20
21 \newcommand{\Or}{\texorpdfstring{\ensuremath{\vert}\xspace}{or}}
22 \newcommand{\manifestsAs}{\texorpdfstring{\ensuremath{\Rightarrow\quad}\xspace}{->}}
23 \newcommand{\texcmd}[1]{\texorpdfstring{\texttt{\char`\\#1}}{#1}}
24 \newcommand{\texenv}[1]{\texorpdfstring{\texttt{#1}}{#1}}
25 \newcommand{\texopt}[1]{\texorpdfstring{\texttt{#1}}{#1}}
26 \newcommand{\texarg}[1]{\texorpdfstring{\texttt{\{#1\}}}{\textbraceleft#1\textbraceright}}
27 \newcommand{\texargoptgen}[1]{\texorpdfstring{\texttt{[}\gen{#1}\texttt{]}}{\textbraceleft<#1>\textbraceright}}
28 \newcommand{\texarggen}[1]{\texorpdfstring{\texttt{\{}\gen{#1}\texttt{\}}}{\textbraceleft<#1>\textbraceright}}
29 \newcommand{\gen}[1]{\ensuremath{\langle\text{\mdseries\itshape#1\/}\rangle}}
30 \newcommand{\texpkg}[1]{#1}
31 \newcommand{\texoption}[1]{\texopt{#1}}
32
33 \newenvironment{snippet}{\Verbatim}{\endVerbatim}
34 \newenvironment{fsnippet}%
35 {\VerbatimEnvironment
36 \begin{Sbox}\begin{minipage}{0.82\textwidth}\begin{Verbatim}}%
37 {\end{Verbatim}\end{minipage}\end{Sbox}
38 \setlength{\fboxsep}{12pt}\vspace*{4mm}\newline\fbox{\TheSbox}\vspace{4mm}\par\noindent}
39
40 % \newenvironment{snippet}%
41 % {\begin{minted}{latex}}{\end{minted}}
42 % \newenvironment{fsnippet}%
43 % {\begin{Sbox}\begin{minipage}{0.82\textwidth}\begin{minted}{latex}}%
44 % {\end{minted}\end{minipage}\end{Sbox}
45 % \setlength{\fboxsep}{12pt}\vspace*{4mm}\newline\fbox{\TheSbox}\vspace{4mm}}
46
47 \begin{document}
48 {\larger[3] \sffamily \bfseries \maketitle}
49
50 \abstract{%
51 The \hepthesis class provides an attractive framework in which to write a PhD
52 or Masters' degree dissertation. The commands provided by this package permit
53 most structural aspects of the thesis to be defined more or less semantically,
54 rather than in terms of raw text sizings and position shifts.
55 }
56
57
58 \section{Introduction}
59 When I began my PhD in 2001, I was surprised to find that there was no standard
60 \LaTeX{} thesis class used by students in my field (\emph{h}igh-\emph{e}nergy
61 \emph{p}article physics, hence the ``hep''). In retrospect, this is not so
62 surprising --- research groups often have an informal system of handing down
63 slightly tailored thesis templates (complete with in line \texcmd{vspace}s,
64 \texcmd{Huge}s and all the rest) through generations of students without ever
65 formalising the style and attempting to do it ``properly''.
66
67 By the time it came to write my own thesis it was obvious that I would only
68 retain my sanity through measures of extreme procrastination and so this package
69 came to be. It has now been edited and hacked on and off since roughly mid-2004,
70 taking stylistic features from other theses that I've thought attractive and
71 adding features based on my own pickiness and user requests. The typography
72 isn't motivated by any formal understanding of the subject, though, so I'm sure
73 there's still plenty of room for improvement.
74
75 This document documents the structure of \hepthesis and how to make it work
76 with you rather than against you. I may be unable to resist including other
77 hints and tips on how to make your thesis-writing go smoothly. Please contact me
78 with suggested improvements, either to the package or to this documentation.
79
80
81 \section{Features}
82 Why would you want to use \hepthesis? Here's a list of features, so you can
83 decide for yourself:
84
85 \begin{itemize}
86 \item Semantic macros for defining the front page, abstract, preface, acknowledgements, etc.
87 \item Macros for quotes, including a full-page quote and chapter-wise quotes
88 \item Attractive header and footer structures
89 \item Pre-set margins suitable for binding or for screen viewing
90 \item Nicely (re-)defined figure, table and equation environments
91 \item Optional mode for generating hyper-links when building PDF files
92 \item Built-in draft copy mode with line numbering
93 \item Maths in section titles etc. will automatically be boldened if appropriate
94 \end{itemize}
95
96
97 \section{Recommended usage}
98 The basic usage mode for \hepthesis is to place
99 %
100 \begin{snippet}
101 \documentclass{hepthesis}
102 \end{snippet}
103 %
104 in the preamble of your document. This will then set up the document's appearance and
105 provide the \hepthesis macros as do the standard \LaTeX{} classes like |article|
106 and |report|. A more sophisticated and flexible approach is described in
107 Appendix~\ref{app:DerivedClass}.
108
109 Although strictly unrelated to \hepthesis, it is usual to write each thesis
110 chapter as a separate |.tex| file and to include it with
111 \texcmd{include} or \texcmd{input}. You may find it useful to set your
112 |LATEXINPUTS| environment variable to ensure that the \texcmd{input}'d
113 files are found by \LaTeX.
114
115 \hepthesis takes several optional arguments. Personally, I use
116 %
117 \begin{snippet}
118 \documentclass[hyperpdf,bindnopdf]{hepthesis}
119 \end{snippet}
120 %
121 which produces page-centered, hyper-linked PDF files and PostScript files with
122 margins suitable for binding and no hyper-links, depending on whether you build
123 the document using |latex| or |pdflatex|. The details of the \hepthesis options
124 are described in Section~\ref{sec:Options} of this document.
125
126
127 \section{Requirements}
128 As \hepthesis aims to allow produce a fairly final version of a thesis without
129 much additional tweaking, there are quite a few required packages. Most should
130 be natively available in your \TeX{} distribution; the rest from CTAN.
131
132 Here's the mandatory packages:
133 \begin{itemize}
134 \item \textbf{scrbook\,\cite{scrbook}} (from KOMA-scripts)
135 \item \textbf{setspace\,\cite{setspace}}
136 \item \textbf{fancyhdr\,\cite{fancyhdr}}
137 \item \textbf{rotating\,\cite{rotating}}
138 \item \textbf{comment\,\cite{comment}}
139 \item \textbf{tocbibind\,\cite{tocbibind}}
140 \item \textbf{caption\,\cite{caption}}
141 \item \textbf{changepage\,\cite{changepage}}
142 \item \textbf{varwidth\,\cite{varwidth}}
143 \end{itemize}
144
145 \vspace{0.4cm}
146 \noindent\fbox{\begin{minipage}{0.85\textwidth}\textsl{
147 %
148 Note that the \texpkg{subfig}\,\cite{subfig} (previously \texpkg{subfigure})
149 and \texpkg{ccaption}\,\cite{ccaption} packages, which were required up to
150 version 1.3, are no longer needed.
151 If you need sub-figures then you should \texcmd{usepackage} the package as
152 usual in your document preamble or custom class file, and make use of the
153 \texcmd{ContinuedFloat} command for continuation captions, which is
154 provided by the mandatory \texpkg{caption} package.
155 %
156 }\end{minipage}}
157 \vspace{0.4cm}
158
159 Additionally, there are several packages which are only required depending on
160 the class options:
161
162 \begin{itemize}
163 %\item \textbf{cite\,\cite{cite}}
164 \item \textbf{csquotes\,\cite{csquotes}:} very standard. Quotation commands will use this if loaded.
165 \item \textbf{babel\,\cite{babel}:} very standard. Quotation commands will use this if loaded.
166 \item \textbf{a4wide\,\cite{a4wide}:} very standard. Disabled with any paper size option other than |a4paper|
167 \item \textbf{amsmath\,\cite{amsmath}:} very, \emph{very} standard. Disabled with the |noams| option
168 \item \textbf{hyperref\,\cite{hyperref}:} very standard. Enabled with the |hyper| option
169 \item \textbf{booktabs\,\cite{booktabs}:} very standard. Disable with the |nobooktabs| option
170 \item \textbf{draftcopy\,\cite{draftcopy}:} very standard. Enable with the |draft| option
171 \item \textbf{lineno\,\cite{lineno}:} non-standard (?). Enable with the |draft| option
172 \item \textbf{titling\,\cite{titling}:} non-standard (?). Enable with the |titling| option
173 \end{itemize}
174
175 Some other handy packages (which aren't required at all for compatibility with
176 |hepthesis| but may well help you to write your thesis) are summarised in
177 Section~\ref{sec:ExtraPackages}.
178
179 \subsection{Troublesome interactions}
180 Unfortunately not all \LaTeX{} packages get on well with each other --- if
181 you are unlucky then you may get some of \TeX's wondertully cryptic error
182 messages on trying to use \texpkg{hepthesis}. Here are the problems that I'm
183 aware of\dots
184
185 \begin{itemize}
186 \item
187 If you have problems with \LaTeX{} complaining about bad definitions of
188 \texcmd{pdfstringdefPreHook}, you may be using an old version of \texpkg{csquotes},
189 which doesn't interface well to \texpkg{hyperref}. I think this is fixed in
190 \texpkg{csquotes} version 3.2 and later --- it certainly works for version
191 3.7. Try including the \texpkg{csquotes} package with
192 %
193 \begin{snippet}
194 \usepackage{csquotes}[2007/03/25]
195 \end{snippet}
196 %
197 so that sufficiently recent version will be used.
198
199 \item
200 Similarly, version 0.9 of the \texpkg{varwidth} package has a deformed version
201 string which means that the package doesn't load properly. This version seems to
202 have made its way into some \LaTeX{} package distributions, so if you see such
203 an error then version 0.9a or later can be obtained from CTAN and will work
204 properly. \texpkg{hepthesis} will check to make sure that the version is as
205 required and issue a warning if the version on your system is earlier than those
206 known to be good.
207
208 \end{itemize}
209
210
211 \section{Class options}
212 \label{sec:Options}
213
214 \subsection{\texopt{oneside} \Or \texopt{twoside}}
215 Typeset the thesis for printing in one- or two-sided format: for example, you
216 may wish to present preview and draft copies in two-sided format, but the final
217 submission may be required to be single-sided. Changing to single-sided form
218 will remove the blank facing pages and only use the margins and header/footer
219 format specified for right-hand pages.
220
221 \subsection{\texopt{bind} \Or \texopt{nobind} \Or \texopt{bindnopdf}}
222 Set the margins to be suitable for printing or screen-viewing. Using the
223 \texopt{bind} option produces larger inner margins, so that left- and
224 right-facing pages have LR-reflection symmetry. Using the \texopt{nobind}
225 option makes the margins equal, so that the pages don't jump around when you
226 flick through them in |gv| or Adobe Acrobat. The \texopt{bindnopdf} option
227 will use binding margins when making a PostScript document and screen-view
228 margins when building a PDF. Note that this option requires some carefulness
229 with the |.aux| files: this is described in Appendix \ref{app:AuxFileProblem}.
230
231 \subsection{\texopt{ams} \Or \texopt{noams}}
232 Make use of the AMS mathematical package. This re-defines several \hepthesis
233 mathematical environments using more powerful macros and is enabled by default.
234 If you don't plan on having any maths in your thesis, then disabling this option
235 may speed up your build-time a little.
236
237 \subsection{\texopt{alphafoot}}
238 Use alphanumeric footnote markers.
239
240 \subsection{\texopt{hidefront} \Or \texopt{hideback} \Or \texopt{hidefrontback}}
241 Useful for draft builds, these options respectively hide the front matter, the
242 back matter or both from the \LaTeX{} compilation, giving a faster build time
243 and meaning you don't have to flick through 20 pages of garbage before
244 proof-checking the first real content. Note that hiding the back matter will
245 fail to include the bit where you generate your bibliography, so unless you make
246 a work-around, all your citations will break.
247
248 \subsection{\texopt{draft}}
249 Prints ``DRAFT'' diagonally across the pages and numbers the lines, suitable for
250 proof-reading. This makes use of the standard |draftcopy| and the less-standard
251 |lineno| packages.
252
253 \subsection{\texopt{sftitles}}
254 Uses a sans-serif font for the title page and all chapter, section and
255 subsection headings.
256
257 \subsection{\texopt{rmtitles}}
258 Uses a serif (roman) font for the title page and all chapter, section and
259 subsection headings (this is the default).
260
261 \subsection{\texopt{booktabs} \Or \texopt{nobooktabs}}
262 Use the |booktabs| package to define the \hepthesis tabular environment.
263 |booktabs| produces publication quality tables, as opposed to \TeX's rather
264 ropey defaults, and so this option is enabled by default. You can disable it if
265 your thesis doesn't have any tables and get a slightly faster build, but it is
266 strongly encouraged that any table presentation uses the |booktabs| look and
267 feel because it's so much better!
268
269 \subsection{\texopt{hyper}}
270 The |hyper| option is used to activate the |hyperref| package, with some reasonably
271 sensible default options. Essentially, it's equivalent to putting
272 %
273 \begin{snippet}
274 \usepackage[colorlinks=true,pdfpagemode=FullScreen, \
275 bookmarks=true]{hyperref}
276 \end{snippet}
277 %
278 in the preamble of your document.
279
280 \subsection{\texopt{hyperpdf}}
281 |hyperpdf| has the effect of the |hyper| option when building PDF output, and no
282 effect at all if building PostScript. This can be handy if you consider the PDFs
283 to be for screen-reading purposes and the PS for printing: you probably don't
284 want to print a version where all the references and URLs are coloured! Note
285 that this option requires some carefulness with the |.aux| file, since
286 alternating between PS and PDF builds involves repeatedly writing and removing
287 hyperref tokens. A solution to this is described in Appendix \ref{app:AuxFileProblem}.
288
289 \subsection{\texopt{index}}
290 Include the |makeidx| package, to allow an index to be built. Note that you have
291 to do this by hand and that it's probably best done as a retrospective feature
292 after you've written the thesis. Not many people want to spend \emph{more} time
293 with their thesis when they've done enough to pass!
294
295 \subsection{\texopt{titling}}
296 Use the |titling| package to redefine the \texcmd{title} and \texcmd{author}
297 commands so that their arguments are available through the document as
298 \texcmd{thetitle} and \texcmd{theauthor}. This is used, for example, by the
299 \texcmd{titlepage} command. If this option isn't passed, a more basic attempt is
300 made to do this definition without needing an external package. It's unclear
301 whether titling really helps but there may be complicated cases (such as those
302 where the author includes a \texcmd{thanks}) where |titling| may do a better
303 job. This is untested, though, and the result of using \texcmd{thanks} in a
304 |hepthesis| document is to be considered undefined.
305
306 \subsection{\texopt{a4paper} \Or \texopt{a4narrow} \Or \texopt{letterpaper} \Or \dots}
307 Choose the paper size. Duh.
308
309
310 \section{Environments and commands}
311 The \hepthesis environments and commands are a mix of new macros and tweaked
312 versions of existing standard ones. The ones that re-define standard macros
313 can't be disabled (at least, not in this version), so if you don't like them
314 then you can either hack \hepthesis to be the way you'd like (preferably in a
315 nice way which I can integrate into a future release) or use something else. The
316 choice is yours!
317
318 Here are the environments and commands, roughly in the order that you'd use them:
319
320 \subsection{\texcmd{set{\dots}spacing}\texarggen{spacing}}
321 A selection of spacing commands are available to change the overall line spacing
322 of the thesis, or to change the spacing within specific document sections if for
323 some reason you want to do that. (Personally, I wouldn't --- inconsistent spacing
324 is very disconcerting.) Here are the available commands, explicitly:
325 \begin{itemize}
326 \item \texcmd{setspacing} --- set the following spacings all at once;
327 \item \texcmd{setfrontmatterspacing}
328 \item \texcmd{setmainmatterspacing}
329 \item \texcmd{setappendixspacing}
330 \item \texcmd{setbackmatterspacing}
331 \end{itemize}
332 %
333 Each command takes a single argument, which can take the values |single|,
334 |onehalf| and |double|, for single spacing, one-and-a-half spacing
335 and double spacing respectively. The default is |onehalf|, since I think
336 that looks most elegant. If making a draft version, double spacing might be
337 useful since it leaves a bit of room for annotations. I can't recommend single
338 spacing --- it just looks cramped.
339 %
340 \begin{fsnippet}
341 \documentclass[...]{hepthesis}
342 \setmainmatterspacing{double}
343 ...
344 \begin{document}
345 ...
346 \end{fsnippet}
347
348
349 \subsection{\texcmd{set{\dots}extramargins}\texarggen{length}}
350 A selection of commands are available to change the text width on a per-section
351 basis. These shouldn't be tweaked too much, but in case you need it, the ability
352 for configuration is available. The text width itself is not explicitly
353 specified --- instead the commands take as an argument the width to be added to
354 both margins. Unless explicitly specified below, all these lengths are zero by
355 default so any use of these commands with a positive argument is likely to
356 reduce the text width. Here are the ``large-scale'' extra margins commands:
357 %
358 \begin{itemize}
359 \item \texcmd{setextramargins}\texarggen{len} --- set the following lengths all at once;
360 \item \texcmd{setfrontmatterextramargins}\texarggen{len}
361 \item \texcmd{setmainmatterextramargins}\texarggen{len}
362 \item \texcmd{setappendixextramargins}\texarggen{len}
363 \item \texcmd{setbackmatterextramargins}\texarggen{len}
364 \end{itemize}
365 %
366 The following commands all add extra margin widths to subsections within the
367 front matter. Note that they apply \emph{in addition} to the front matter length.
368 %
369 \begin{itemize}
370 \item \texcmd{setabstractextramargins}\texarggen{len} --- |1.5cm| by default;
371 \item \texcmd{setdeclarationextramargins}\texarggen{len} --- |1.5cm| by default;
372 \item \texcmd{setacknowledgementsextramargins}\texarggen{len}
373 \item \texcmd{setprefaceextramargins}\texarggen{len}
374 \end{itemize}
375 %
376 Each command takes a single argument, which is just a \TeX{} length. Here's an example:
377 \nobreak
378 %
379 \begin{fsnippet}
380 \documentclass[...]{hepthesis}
381 \setfrontmatterextramargins{1.5}
382 ...
383 \begin{document}
384 ...
385 \end{fsnippet}
386
387
388 %% TODO Change in v1.5
389 \subsection{\texcmd{title}\texarggen{title} and \texcmd{author}\texarggen{author}}
390 The usual commands for setting the author and title. Don't use \texcmd{thanks} in
391 the \hepthesis author argument: the results are undefined!
392 %
393 \begin{fsnippet}
394 \title{A study of \BToKPi decays with the \LHCb experiment}
395 \author{Andrew Gordon Buckley}
396 ...
397 \begin{document}
398 ...
399 \end{fsnippet}
400
401 Once these commands have been executed, the title and author strings are available
402 via the \texcmd{thetitle} and \texcmd{theauthor} commands. These are used by
403 \texcmd{titlepage}.
404
405 N.B. Up to version 1.3, a special \texcmd{definethesis} command was used to specify
406 the thesis author and title. While this is still retained for backwards compatibility,
407 it is deprecated and you should use the standard \texcmd{title} and \texcmd{author}
408 macros instead. \textbf{\texcmd{definethesis} will be removed in version 1.5}
409
410
411 \subsection{\texenv{frontmatter}, \texenv{mainmatter}, \texenv{appendices} and \texenv{backmatter} environments}
412 Use these to delimit the auxiliary parts of your thesis from the main feature
413 (being all that clever work you spent years working on). In practice, these
414 commands change the page-numbering style and set/reset some section counters
415 appropriately: the frontmatter and backmatter environments will not use chapter
416 numbering but will insert the un-numbered chapter titles in the table of
417 contents. Note that this means appendices should be placed in the appendices
418 environment between mainmatter and backmatter, rather than in the back matter
419 itself, which is intended for such things as the bibliography, colophon etc.
420
421 \subsection{\texcmd{titlepage}}
422 The \texcmd{titlepage} macro generates a title page for the thesis and as such
423 should probably be the first item in the front matter. It takes two arguments:
424 an optional elaboration of the author name and the description of the award for
425 which the thesis is being submitted. You may need to use a different macro if
426 your institution has a very different prescribed format for the layout of thesis
427 title pages: in such a case, the \texcmd{theauthor} and \texcmd{thetitle}
428 commands will probably be useful. Here's an example of usage:
429 %
430 \begin{fsnippet}
431 \titlepage[of \\ Churchill College]%
432 {A dissertation submitted to the University of Cambridge\\
433 for the degree of Doctor of Philosophy}
434 \end{fsnippet}
435 %
436 Additionally, the \texcmd{maketitle} command has been redefined to behave as
437 \texcmd{titlepage} with two empty arguments. This is only provided to not
438 confuse users who convert to |hepthesis| from a standard \LaTeX{} class and
439 expect \texcmd{maketitle} to work: \texcmd{titlepage} is a more powerful
440 command and should be used by those who are aware of it. That includes you!
441
442 \subsection{\texenv{abstract} environment}
443 Where you present the summary of your thesis: this should be within the
444 \texenv{frontmatter} environment. The \texenv{abstract} environment takes one
445 optional argument, which will be the heading above the abstract. If this isn't
446 specified, the heading will simply be ``Abstract''. This may be useful for
447 providing a stand-alone summary page, with a snippet like:
448 %
449 \begin{fsnippet}
450 \begin{abstract}%
451 [\smaller\thetitle\\ \vspace*{1cm} \smaller{\theauthor}]
452 \thispagestyle{empty}
453 This thesis describes all the really cool work I did on...
454 \end{abstract}
455 \end{fsnippet}
456
457 \subsection{\texenv{declaration} environment}
458 Where you declare that the thesis was all your own work, lies within word
459 limits, etc. Use it in the front matter area, of course, with something like
460 %
461 \begin{fsnippet}
462 \begin{declaration}
463 This dissertation is the result of my own work...
464 \vspace*{1cm}
465 \begin{flushright}
466 Andy Buckley
467 \end{flushright}
468 \end{declaration}
469 \end{fsnippet}
470
471 \subsection{\texenv{acknowledgements} environment}
472 A nice little environment for putting all those gushing thank-you's (and the
473 obligatory thanks to a supervisor). Use it (in the front matter again) like:
474 %
475 \begin{fsnippet}
476 \begin{acknowledgements}
477 Of the many people who deserve thanks, some are
478 particularly prominent, for example...
479 \end{acknowledgements}
480 \end{fsnippet}
481
482 \subsection{\texenv{preface} environment}
483 Here's where you summarise the structure of the thesis to come, just before the
484 main matter starts, with something like:
485 %
486 \begin{fsnippet}
487 \begin{preface}
488 This thesis describes my research on various aspects of...
489 \end{preface}
490 \end{fsnippet}
491
492 \subsection{\texcmd{dedication}\texarggen{text}}
493 Dedicate your thesis to someone/something:
494 %
495 \begin{fsnippet}
496 \begin{mainmatter}
497 \dedication{For Jo}
498 ...
499 \end{frontmatter}
500 \end{fsnippet}
501
502
503 \subsection{\texcmd{frontquote}\texargoptgen{lang}\texarggen{quote}\texarggen{who}}
504 Use this at the start of the main matter if you want to present the ethos of
505 your thesis in a few choice words, for example:
506 %
507 \begin{fsnippet}
508 \frontquote%
509 {Writing in English is the most ingenious torture\\
510 ever devised for sins committed in previous lives.}%
511 {James Joyce}
512 ...
513 \end{frontmatter}
514 \end{fsnippet}
515 %
516 \texcmd{frontquote} also takes an optional argument indicating which language the
517 quote is in. This will change the quotation mark and hyphenation styles, if the
518 \texpkg{babel} and \texpkg{csquotes} packages are loaded:
519 %
520 \begin{fsnippet}
521 \frontquote[french]%
522 {Le savant n'\'etudie pas la nature parce que cela est utile; \\
523 il l'\'etudie parce qu'il y prend plaisir et il y prend plaisir
524 parce qu'elle est belle.}%
525 {Henri Poincar\'e, 1854--1912}
526 ...
527 \end{frontmatter}
528 \end{fsnippet}
529
530 \subsection{\texcmd{chapterquote}\texargoptgen{lang}\texarggen{quote}\texarggen{who}}
531 Something flippant/emotive to put at the start of chapters:
532 %
533 \begin{fsnippet}
534 \chapter{\CP violation in the \Bmeson system}
535 \label{chap:basictheory}
536 \chapterquote{Laws were made to be broken.}%
537 {Christopher North 1785--1854}
538 ...
539 \end{fsnippet}
540 %
541 As for \texcmd{frontquote}, an optional language argument can be used.
542
543 \subsection{\texenv{colophon} environment}
544 A colophon is an inscription placed at the end of a book or other work that
545 talks about how the work was created and what things were used in its creation.
546 This should go in the back matter of your thesis and is completely
547 optional. Frankly, I've only ever seen them in O'Reilly tech books (and my own
548 thesis, of course). If you use this, please mention \hepthesis' r\^ole in
549 making your thesis! Here's an example:
550 %
551 \begin{fsnippet}
552 \begin{backmatter}
553 \begin{colophon}
554 This thesis was made with ``hepthesis'' and it blew my mind...
555 \end{colophon}
556 ...
557 \end{fsnippet}
558
559
560 \subsection{\texenv{table} environment}
561 Tables --- use like any other table (probably combined with the tabular
562 environment). It has been slightly modified to be horizontally centered and have
563 an slightly increased vertical spacing at the top. It supports the standard
564 \LaTeX{} ``[!htbp]'' float placement specifiers.
565
566 \subsection{\texenv{tabular} environment}
567 If the |booktabs| package is used (enabled by default), then the tabular
568 environment is re-defined to have a horizontal bar at top and bottom, which
569 looks much nicer than \TeX's default tables.
570
571 \subsection{\texenv{figure} and \texenv{sidewaysfigure} environments}
572 The \texenv{figure}, \texenv{figure*} and \texenv{sidewaysfigure} environments
573 are re-defined to be automatically centered. They support the standard \LaTeX{}
574 ``[!htbp]'' float placement specifiers.
575
576 \subsection{\texenv{equation} and \texenv{displaymath} environments}
577 These environments and their starred versions are re-defined so that
578 \texenv{equation} behaves like the normal \texenv{displaymath} environment. If
579 the AMS package is used (which it is by default) then both are redefined to use
580 the AMS \texenv{align} environment, which is much more powerful: it supports
581 more intelligent label-placement, sub-equations and boasts a better alignment
582 syntax than the default \LaTeX{} displayed math environments. The AMS re-defined
583 \texenv{equation} is suitable for most purposes --- \emph{all} my purposes, in
584 fact.
585
586 \subsection{\texcmd{verysubsection}\texarggen{title}}
587 A little command for in-line mini section headings, consisting of a boldened
588 phrase specified by the argument, a bold colon and a space. Just for
589 convenience, really, when all you want to do is label a paragraph without
590 incurring all the vertical space of \texcmd{subsubsub...subsection}s. Use it
591 like:
592 %
593 \begin{fsnippet}
594 \verysubsection{\Tevatron Run II experiments}
595 Since 1983 and until the commissioning of the \LHC is complete...
596 \end{fsnippet}
597
598 \subsection{Semantic figure widths}
599 Rather than specifying figure widths in raw terms, like centimetres, or document
600 parameters like \texcmd{textwidth}, it's nice to be able to have a more semantic
601 reference. Having a few standard width also helps to keep things looking
602 consistent through the document. For these reasons, |hepthesis| provides four
603 standard figure widths, \texcmd{smallfigwidth}, \texcmd{mediumfigwidth},
604 \texcmd{largefigwidth} and \texcmd{hugefigwidth}, which are defined in terms of
605 the text width and chosen to avoid overflows. Use them like this:
606 %
607 \begin{fsnippet}
608 \begin{figure}
609 \includegraphics[width=\largefigwidth]{ckmfitter-alpha-combined}
610 \caption{CKM Fitter constraints on \alphaCKM.}
611 \label{fig:CKMFitter}
612 \end{figure}
613 \end{fsnippet}
614
615 Note also that this way of including images will automatically look for an
616 |.eps| file when building PostScript and a |.pdf| file when building PDF. You
617 may find the |eps2pdf| and |pdf2eps| utilities useful.
618
619 \subsection{Standard in-document reference terms}
620 It's nice to be able to refer to portions of your document with standard names,
621 capitalisation, etc. For this reason, I've defined a bunch of macros which give
622 consistent and sensible capitalisations. Using them systematically will ensure
623 consistency in your references:
624 %
625 \begin{itemize}
626 \item \texcmd{Chapter} \manifestsAs Chapter
627 \item \texcmd{Section} \manifestsAs Section
628 \item \texcmd{Appendix} \manifestsAs Appendix
629 \item \texcmd{Figure} \manifestsAs Figure
630 \item \texcmd{Table} \manifestsAs Table
631 \item \texcmd{Equation} \manifestsAs equation
632 \item \texcmd{Reference} \manifestsAs reference
633 \item \texcmd{Page} \manifestsAs page
634 \end{itemize}
635
636 Taking this consistency thing a step further, here are versions of the same
637 commands which take the reference label as a argument:
638 %
639 \begin{itemize}
640 \item \texcmd{ChapterRef}
641 \item \texcmd{SectionRef}
642 \item \texcmd{AppendixRef}
643 \item \texcmd{FigureRef}
644 \item \texcmd{TableRef}
645 \item \texcmd{EquationRef}
646 \item \texcmd{ReferenceRef}
647 \item \texcmd{PageRef}
648 \end{itemize}
649 %
650 Using these forms will ensure that the spacing between e.g. the worked
651 ``Chapter'' and the chapter number is always the same, and that it won't wrap
652 over line breaks. The equation, reference and page forms will call the
653 \texcmd{eqref}, \texcmd{cite} and \texcmd{pageref} reference macros rather than
654 \texcmd{ref}, which is used for all others.
655
656 % \subsection{``thesis---'' prefix versions}
657 % Additionally, all \hepthesis environments and commands have an alternative name,
658 % which is the version described above, prefixed with ``thesis''\footnote{This
659 % is a hang-over from early versions of my thesis, when I didn't know how to
660 % robustly extend and re-define environments and commands.}. These forms are
661 % frankly a bit of a pain to use, so use the short versions, please. The
662 % ``thesis---'' versions should be considered deprecated and \textbf{will be removed
663 % in the next release, version 1.5}.
664
665
666 \section{Recommended extra packages}
667 \label{sec:ExtraPackages}
668 Here are some other packages it might be good to know about:
669 \begin{itemize}
670 \item \textbf{SIunits\,\cite{SIunits}:} \emph{the} way to do units and get it right.
671 \item \textbf{hepunits\,\cite{hepunits}:} my extension of |SIunits| to include some common HEP units not used elsewhere.
672 \item \textbf{hepnames\,\cite{hepnames} and hepparticles\,\cite{hepparticles}:} my packages for typesetting HEP particle names \emph{properly}, with |hepnames| defining macros for a lot of the standard ones. Requires |maybemath|\,\cite{maybemath}
673 \item \textbf{braket\,\cite{braket}:} decent implementation of Dirac bra and ket notation
674 \item \textbf{cancel\,\cite{cancel}:} the best way to do Feynman slashes (in my opinion)
675 \item \textbf{feynmf/feynmp\,\cite{feynmf} and axodraw\,\cite{axodraw}:} various approaches to doing Feynman diagrams, especially in equations, inline contexts and so-on.
676 \end{itemize}
677 %
678 and some related software:
679 %
680 \begin{itemize}
681 \item \textbf{FeynDiagram\,\cite{feyndiagram} and Jaxodraw\,\cite{jaxodraw}}: for Feynman diagrams outside \TeX. You might also
682 be interested in my |pyfeyn|\,\cite{pyfeyn} program.
683 \item \textbf{SLAC SPIRES' biblio tools service:} see \url{www.slac.stanford.edu/spires/}
684 \end{itemize}
685
686
687
688 \section{An example \texttt{hepthesis} thesis}
689 Here are some selected snippets from my thesis, which hopefully demonstrate the
690 features described. I split my thesis into |preamble.tex| and
691 |thesis.tex| files, with the front matter, back matter and chapters
692 \texcmd{input}'d into |thesis.tex|. The output was built by running e.g.
693 %
694 \begin{snippet}
695 pdflatex thesis.tex && bibtex thesis && pdflatex thesis.tex
696 \end{snippet}
697 %
698 (though I used a Makefile rather than do it directly). You should note that you
699 might not be able to build this exact thesis due to missing packages: if you're
700 writing a HEP thesis then I'd encourage you to use the |hepnames| \LaTeX{}
701 package for typesetting particle names --- it depends on the extra
702 |hepparticles| and |maybemath| packages. The
703 examples used here also rely on the |hepunits| package: you can all these extra
704 packages from the CTAN\,\cite{CTAN}. See Appendix~\ref{app:InstallingPackages} for
705 a quick guide on how to install personal copies of \LaTeX{} packages.
706
707
708 \subsection{\texttt{preamble.tex}}
709 {\smaller \VerbatimInput{example/preamble.tex}}
710
711 \subsection{\texttt{thesis.tex}}
712 {\smaller \VerbatimInput{example/example.tex}}
713
714 \subsection{\texttt{frontmatter.tex}}
715 {\smaller \VerbatimInput{example/frontmatter.tex}}
716
717 \subsection{\texttt{chap1.tex}}
718 {\smaller \VerbatimInput{example/chap1.tex}}
719
720 \subsection{\texttt{chap2.tex}}
721 {\smaller \VerbatimInput{example/chap2.tex}}
722
723 \subsection{\texttt{backmatter.tex}}
724 {\smaller \VerbatimInput{example/backmatter.tex}}
725
726
727 \section{Wishlist / TODO}
728 I'm not planning on writing another thesis, but maybe I'll add features if
729 there's demand. If you add a nice feature, pass it on to me and I'll think about
730 including it in the package (and will give you some credit, of course). But anyway,
731 here's the TODO:
732 %
733 \begin{itemize}
734 \item Make the spacing in the \texcmd{SectionRef} etc. commands customisable.
735 \item Allow the PDF page style to be specified as a class argument
736 \item Allow section titles to be centre / right justified?
737 \item User control of frontmatter title sizes and alignments? (Probably not\dots)
738 \item Provide different styles for the titlepage etc.
739 \item Themes, like for Beamer?
740 \item Make the vertical spacings on the quote, dedication and title pages change by paper size
741 \end{itemize}
742
743
744 \section{Feedback}
745 \hepthesis has taken a lot of work\dots I hope you think it was worthwhile and
746 that you enjoy using it. Or at least, I hope you enjoy writing your thesis more
747 than you would have done without it! If you're feeling appreciative, then a teeny
748 credit in your thesis acknowledgements would be hugely appreciated.
749
750 Other than that, any feedback on the package is very welcome, especially if it's
751 constructive criticism! Email your thoughts to
752 \texttt{[email protected]}, please.
753
754
755 \section{Acknowledgements}
756 I'd like to thank all the people who have provided bug reports, patches, suggestions
757 and who have otherwise helped me to get \hepthesis to the state it's in. See the
758 |ChangeLog| file in the distribution for names!
759
760
761 \appendix
762
763 \section{Using your own derived document class}
764 \label{app:DerivedClass}
765 If you're feeling sophisticated, then you can make your own document class based on
766 \hepthesis by placing
767 %
768 \begin{snippet}
769 \LoadClass{hepthesis}
770 \end{snippet}
771 %
772 in your own class definition file. This is a rather nice way of working, since
773 it allows you to tweak the \hepthesis defaults without cluttering your
774 |.tex| file with preamble junk.
775
776
777 \section{Installing personal copies of \LaTeX{} packages}
778 \label{app:InstallingPackages}
779 Since |hepthesis| depends on several non-standard \LaTeX{} packages, you may have to
780 download and install them yourself. If you don't have |root| access to the computer
781 on which you're working then you'll probably have to install them into your own home
782 directory or similar. Since I expect quite a few prospective users of |hepthesis| will
783 be non-experts in the ways of \TeX{}, this is a quick guide on what to do.
784
785 \begin{enumerate}
786 \item Make a \TeX{} directory tree in your home directory (or any other area you can write to), e.g.
787 \begin{snippet}
788 $ mkdir -p $HOME/local/texmf/tex/latex
789 $ mkdir -p $HOME/local/texmf/bibtex/bib
790 $ mkdir -p $HOME/local/texmf/bibtex/bst
791 \end{snippet}
792 \item Download the packages from CTAN\,\cite{CTAN} or wherever.
793 \item Follow the packages' installation instructions to install them into the \\
794 |$HOME/local/texmf/tex/latex| %$
795 directory you made above (or an appropriately-named sub-directory of it if you
796 want to be neat). For simple |.sty| or |.cls| files, this will just involve
797 copying them into your directory of choice. |.dtx| files will probably require
798 running |latex| to build the files to be installed.
799 \item If you use the |bash| shell, add the following to your |~/.bashrc| file:
800 \begin{snippet}
801 export TEXINPUTS="$HOME/local/texmf/tex//:$TEXINPUTS"
802 export LATEXINPUTS="$HOME/local/texmf/tex/latex//:$LATEXINPUTS"
803 export BIBINPUTS="$HOME/local/texmf/bibtex//:$BIBINPUTS"
804 \end{snippet}
805 or, if you use the |(t)csh| shell, add the following to your |~/.cshrc| file:
806 \begin{snippet}
807 setenv TEXINPUTS "$HOME/local/texmf/tex//:$TEXINPUTS"
808 setenv LATEXINPUTS "$HOME/local/texmf/tex/latex//:$LATEXINPUTS"
809 setenv BIBINPUTS "$HOME/local/texmf/bibtex//:$BIBINPUTS"
810 \end{snippet}
811 \item That's all: the lines above mean that \LaTeX{} will look for input files
812 such as classes, packages, images, \texcmd{input}'d |.tex| files etc. recursively under \\
813 |$HOME/local/texmf/tex/latex| %$
814 and that BibTeX will look for its style and database files recursively under
815 |$HOME/local/texmf/bibtex|.%$
816 You can probably see how this can be extended to keep your thesis development
817 directories neat, too!
818 \end{enumerate}
819
820
821 \section{Distinguishing PS/PDF output in thesis builds}
822 \label{app:AuxFileProblem}
823
824 The options \texopt{bindnopdf} and \texopt{hyperpdf} change the behaviour
825 depending on whether you're building PDF or PostScript output. This is fine if
826 you only ever do one, but if you want to switch rapidly between these output
827 formats then you'll have problems. This is because the |.aux| file, which
828 records the reference keys and suchlike changes depending on whether you're
829 making hyper-refs and if the changes of margins force sections on to different
830 pages.
831
832 A nice solution to this involves using a Makefile, which you probably want to be
833 doing anyway. You'll have to read up on the details of Makefiles (and possibly
834 GNU automake) elsewhere, but to save on Make-newbie angst, I'll tell you that
835 the indents in the following snippet \emph{must} be tabs, rather than spaces!
836 Here goes --- put the following into a file called |Makefile|, change the
837 |DOCNAME| variable to something which suits your project and run |make thesis| or |make thesispdf|:
838 \begin{fsnippet}
839 # For a main thesis LaTeX file called ``thesis.tex''
840 DOCNAME = thesis
841
842 thesis: $(TEXSOURCES) $(DOCNAME).bbl
843 test -f $(DOCNAME).aux.ps && cp $(DOCNAME).aux.ps \
844 $(DOCNAME).aux || true
845 latex $(DOCNAME)
846 cp $(DOCNAME).aux $(DOCNAME).aux.ps
847 ./thesisstats.sh >> buildlog.dat
848
849 thesispdf: $(TEXSOURCES) $(DOCNAME).bbl
850 test -f $(DOCNAME).aux.pdf && cp $(DOCNAME).aux.pdf \
851 $(DOCNAME).aux || true
852 pdflatex $(DOCNAME)
853 cp $(DOCNAME).aux $(DOCNAME).aux.pdf
854 ./thesisstats.sh >> buildlog.dat
855 \end{fsnippet}
856
857 Otherwise you can just delete the |.aux| file when you change between using
858 |latex| and |pdflatex|, but this will require more passes, since the
859 |.aux| file has to be replaced each time.
860
861 \begin{thebibliography}{99}
862 \bibitem{CTAN}{CTAN: \url{http://www.ctan.org}. \url{http://www.tex.ac.uk/tex-archive} is shortened to |ctan:| below.}
863 \bibitem{scrbook}{scrbook: \url{ctan:/macros/latex/contrib/komascript/}}
864 \bibitem{cite}{cite: \url{ctan:/macros/latex/contrib/cite/}}
865 \bibitem{setspace}{setspace: \url{ctan:/macros/latex/setspace/}}
866 \bibitem{fancyhdr}{fancyhdr: \url{ctan:/macros/latex/contrib/fancyhdr/}}
867 \bibitem{rotating}{rotating: \url{ctan:/macros/latex/contrib/rotating/}}
868 \bibitem{tocbibind}{tocbibind: \url{ctan:/macros/latex/contrib/tocbibind/}}
869 \bibitem{subfig}{subfig: \url{ctan:/obsolete/macros/latex/contrib/subfig/}}
870 \bibitem{caption}{caption: \url{ctan:/macros/latex/contrib/caption/}}
871 \bibitem{ccaption}{ccaption: \url{ctan:/macros/latex/contrib/ccaption/}}
872 \bibitem{changepage}{changepage: \url{ctan:/macros/latex/contrib/changepage/}}
873 \bibitem{varwidth}{varwidth: \url{ctan:/macros/latex/contrib/varwidth/}}
874 \bibitem{csquotes}{csquotes: \url{ctan:/macros/latex/contrib/csquotes/}}
875 \bibitem{babel}{babel: \url{ctan:/macros/latex/contrib/babel/}}
876 \bibitem{a4wide}{a4wide: \url{ctan:/macros/latex/contrib/misc/a4wide.sty}}
877 \bibitem{amsmath}{amsmath: \url{ctan:/macros/latex/required/amslatex/math/}}
878 \bibitem{hyperref}{hyperref: \url{ctan:/macros/latex/contrib/hyperref/}}
879 \bibitem{booktabs}{booktabs: \url{ctan:/macros/latex/contrib/booktabs/}}
880 \bibitem{draftcopy}{draftcopy: \url{ctan:/macros/latex/contrib/draftcopy/}}
881 \bibitem{lineno}{lineno: \url{ctan:/macros/latex/contrib/lineno/}}
882 \bibitem{titling}{titling: \url{ctan:/macros/latex/contrib/titling/}}
883 \bibitem{SIunits}{SIunits: \url{ctan:/macros/latex/contrib/SIunits/}}
884 \bibitem{hepunits}{hepunits: \url{ctan:/macros/latex/contrib/hepunits/}}
885 \bibitem{hepnames}{hepnames: \url{ctan:/macros/latex/contrib/hepnames/}}
886 \bibitem{hepparticles}{hepparticles: \url{ctan:/macros/latex/contrib/hepparticles/}}
887 \bibitem{maybemath}{maybemath: \url{ctan:/macros/latex/contrib/maybemath/}}
888 \bibitem{braket}{braket: \url{ctan:/macros/latex/contrib/misc/braket.sty}}
889 \bibitem{cancel}{cancel: \url{ctan:/macros/latex/contrib/misc/cancel.sty}}
890 \bibitem{feynmf}{feynmf: \url{ctan:/macros/latex/contrib/feynmf/}}
891 \bibitem{axodraw}{axodraw: \url{http://www.nikhef.nl/~form/FORMdistribution/axodraw/}}
892 \bibitem{feyndiagram}{FeynDiagram: \url{http://www.feyndiagram.com}}
893 \bibitem{jaxodraw}{Jaxodraw: \url{http://http://jaxodraw.sourceforge.net/}}
894 \bibitem{pyfeyn}{PyFeyn: \url{http://hepforge.cedar.ac.uk/pyfeyn/}}
895 \end{thebibliography}
896
897 \end{document}