diff options
author | Karl Berry <karl@freefriends.org> | 2007-09-16 00:13:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-09-16 00:13:07 +0000 |
commit | 11826a2e3ed54621c66e5c34ebe977a0ba45c8ae (patch) | |
tree | 0fdd2516ae1c1675b81539c363888ab2ee078f71 /Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls | |
parent | d85f248e3b38ea0ecda38c5340e3cadd08d65346 (diff) |
hepthesis 1.4 (14sep07)
git-svn-id: svn://tug.org/texlive/trunk@4948 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls | 319 |
1 files changed, 209 insertions, 110 deletions
diff --git a/Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls b/Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls index 71cf0c6769b..e15f2982b05 100644 --- a/Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls +++ b/Master/texmf-dist/tex/latex/hepthesis/hepthesis.cls @@ -15,8 +15,8 @@ %% ======================================================================== %% Admin %% ======================================================================== -\def\fileversion{1.3} -\def\filedate{2006/09/28} +\def\fileversion{1.4} +\def\filedate{2007/09/12} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{hepthesis}[\filedate\space HEP thesis class by Andy Buckley (v\fileversion)] @@ -37,18 +37,26 @@ \def\@useAFour{yes} \def\@requireAFourWide{} \def\@oneside{} +\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}{book}} + \PassOptionsToClass{oneside}{scrbook}} \DeclareOption{twoside}{% \def\@oneside{} - \PassOptionsToClass{twoside}{book}} + \PassOptionsToClass{twoside}{scrbook}} %% Sans serif titles? \DeclareOption{sftitles}{% @@ -111,6 +119,11 @@ \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}} @@ -144,27 +157,27 @@ } \DeclareOption{a5paper}{% \def\@useAFour{}% - \PassOptionsToClass{a5paper}{book}% + \PassOptionsToClass{a5paper}{scrbook}% } \DeclareOption{b5paper}{% \def\@useAFour{}% - \PassOptionsToClass{b5paper}{book}% + \PassOptionsToClass{b5paper}{scrbook}% } \DeclareOption{letterpaper}{% \def\@useAFour{}% - \PassOptionsToClass{letterpaper}{book}% + \PassOptionsToClass{letterpaper}{scrbook}% } \DeclareOption{legalpaper}{% \def\@useAFour{}% - \PassOptionsToClass{legalpaper}{book}% + \PassOptionsToClass{legalpaper}{scrbook}% } \DeclareOption{executivepaper}{% \def\@useAFour{}% - \PassOptionsToClass{executivepaper}{book}% + \PassOptionsToClass{executivepaper}{scrbook}% } %% Handle the A4 default paper size \ifx\@useAFour\@empty\else% - \PassOptionsToClass{a4paper}{book}% + \PassOptionsToClass{a4paper}{scrbook}% \fi @@ -178,19 +191,23 @@ %% Process the options (no package requirement allowed above here) \ProcessOptions + %% ======================================================================== %% Base class and packages %% ======================================================================== %% Base class -\LoadClass[12pt]{book} +\LoadClass[12pt]{scrbook} %% Use wide format if using A4 paper \ifx\@requireAFourWide\@empty\else\RequirePackage{a4wide}\fi -%% Hyperlinks (optional, has to come early in the package list) -\ifx\@requirehyper\@empty\else\RequirePackage[colorlinks=true,bookmarks=true]{hyperref}\fi -%pdfpagemode=None, FullScreen, UseThumbs, UseOutlines +%% 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% @@ -225,6 +242,11 @@ \RequirePackage{sfheaders} \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} @@ -249,12 +271,14 @@ %% ``DRAFT'' underprint and line numbering in draft mode (optional) \ifx\@requiredraft\@empty\else% - \RequirePackage[pagewise, mathlines, displaymath]{lineno} + \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} @@ -265,22 +289,25 @@ %% Verbatim things \RequirePackage{verbatim,comment} -%% Subfigures -\RequirePackage[loose]{subfigure} -\subfiglabelskip=0pt - -%% Nice captions (with continuation option) -\RequirePackage[subfigure]{ccaption} % this one must come first... -\RequirePackage[margin=20pt,labelfont=bf]{caption} - %% 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 + %% Make maths in titles go automatically bold \AtEndOfClass{% \g@addto@macro\bfseries{\boldmath} } + %% ======================================================================== %% Length definitions %% ======================================================================== @@ -303,35 +330,49 @@ \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}% -\newlength{\@maintextwidth}% -\setlength{\@maintextwidth}{\textwidth}% -\newlength{\@frontmattertextwidth}% -\setlength{\@frontmattertextwidth}{\@maintextwidth}% + +%% 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}{3cm}% +\addtolength{\frontmattertitleskip}{2cm}% \addtolength{\@frontmattertitletopskip}{0cm}% \setlength{\@frontmattertopskip}{\frontmattertitleskip}% \addtolength{\@frontmattertopskip}{\@frontmattertitletopskip}% -%% + %% Figure widths \newlength{\smallfigwidth} \newlength{\mediumfigwidth} @@ -341,6 +382,7 @@ \setlength{\mediumfigwidth}{0.6\textwidth} \setlength{\largefigwidth}{0.75\textwidth} \setlength{\hugefigwidth}{0.9\textwidth} + %% Figure width aliases \newlength{\littlefigwidth} \newlength{\bigfigwidth} @@ -356,13 +398,14 @@ %% 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,RE]{\bfseries\thepage}% - \fancyhead[LO,LE]{\bfseries\leftmark}% + \fancyhead[RO,R]{\bfseries\thepage}% + \fancyhead[LO,L]{\bfseries\leftmark}% \fi% \fancyfoot{}% %% Lower case header content @@ -370,6 +413,7 @@ \markboth{#1}{}% } + %% Headers and footers for plain (blank) pages \fancypagestyle{plain}{% \fancyhf{}% @@ -379,6 +423,7 @@ \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{}% @@ -387,12 +432,14 @@ \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} +\DeclareRobustCommand{\listfigurename}{List of figures} +\DeclareRobustCommand{\listtablename}{List of tables} + %% Commenting out front and back matter \ifx\@hidefrontmatter\@yes\AtBeginDocument{\excludecomment{frontmatter}}\fi @@ -403,24 +450,11 @@ %% Internal environments and commands %% ======================================================================== -%% Narrow environment (doesn't work) -\DeclareRobustCommand{\@narrowbegin}[1]{% - \begin{list} - %\begingroup - \setlength{\topsep}{0pt}% - \setlength{\leftmargin}{#1}% - \setlength{\rightmargin}{#1}% - \setlength{\listparindent}{\parindent}% - \setlength{\itemindent}{\parindent}% - \setlength{\parsep}{\parskip}% - \item[]% -} -\DeclareRobustCommand{\@narrowend}{% - %\endgroup - \end{list}% -} -\newenvironment{@narrow}[1]{\@narrowbegin{#1}}{\@narrowend} - +%% Provide dumb quoting commands in case the csquotes package hasn't been used. +\AtEndOfClass{% + \providecommand{\enquote}[1]{``#1''}% + \providecommand{\foreignquote}[1]{``#1''}% +} %% ======================================================================== @@ -428,66 +462,97 @@ %% ======================================================================== -%% Re-define the sectioning commands with optional 1st arg now being the label -%% Oops, actually a bad idea since it clashes with the existing 1st option arg! -%\let\@oldchapter\chapter -%\DeclareRobustCommand{\chapter}[2][]{\def\@argone{#1}\def\@empty{}\chapter{#2}\ifx\@argone\@empty\else\label{#1}\fi} -%\let\@oldsection\section -%\DeclareRobustCommand{\chapter}[2][]{\def\@argone{#1}\def\@empty{}\section{#2}\ifx\@argone\@empty\else\label{#1}\fi} -%\let\@oldsubsection\subsection -%\DeclareRobustCommand{\chapter}[2][]{\def\@argone{#1}\def\@empty{}\subsection{#2}\ifx\@argone\@empty\else\label{#1}\fi} -%\let\@old\ +%% 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 -%\renewenvironment{frontmatter}{% \specialcomment{frontmatter}{% \setcounter{tocdepth}{2}% show down to subsections in contents \setcounter{secnumdepth}{2}% number down to subsections \newcounter{iterlist}% \@oldfrontmatter% - \begin{onehalfspace}% + \adjustwidth[]{\@frontmatterextramargin}{\@frontmatterextramargin}% + \begin{\@frontmatterspacing}% }{% - \end{onehalfspace}% + \end{\@frontmatterspacing}% + \endadjustwidth% \ignorespacesafterend% } + %% Environment for the thesis main body \let\@oldmainmatter\mainmatter \specialcomment{mainmatter}{% - \@oldmainmatter% + %\@oldmainmatter% + \@mainmattertrue \pagenumbering{arabic}% - \begin{onehalfspace}% + \adjustwidth[]{\@mainmatterextramargin}{\@mainmatterextramargin}% + \begin{\@mainmatterspacing}% }{% - \end{onehalfspace}% + \end{\@mainmatterspacing}% + \endadjustwidth% \ignorespacesafterend% } + %% Environment for appendices \specialcomment{appendices}{% - \begin{onehalfspace}% + \adjustwidth[]{\@appendixextramargin}{\@appendixextramargin}% + \begin{\@appendixspacing}% \appendix% }{% - \end{onehalfspace}% + \end{\@appendixspacing}% + \endadjustwidth% \ignorespacesafterend% } + %% Environment for all the junk at the end of the thesis \let\@oldbackmatter\backmatter \specialcomment{backmatter}{% \@oldbackmatter% - \begin{onehalfspace}% + \adjustwidth[]{\@backmatterextramargin}{\@backmatterextramargin}% + \begin{\@backmatterspacing}% \appendix% }{% - \end{onehalfspace}% + \end{\@backmatterspacing}% + \endadjustwidth% \ignorespacesafterend% } + %% Environment for acknowledgements page in frontmatter \newenvironment{acknowledgements}{% - \setlength{\textwidth}{\@frontmattertextwidth}% \cleardoublepage% + \adjustwidth[]{\@acknowledgementsextramargin}{\@acknowledgementsextramargin}% \vspace*{\@frontmattertopskip}% \begin{center}% \begingroup @@ -497,14 +562,15 @@ \end{center}% \vspace*{1cm}% }{% - \setlength{\textwidth}{\@maintextwidth}% + \endadjustwidth% \ignorespacesafterend% } + %% Environment for preface page in frontmatter \newenvironment{preface}{% - \setlength{\textwidth}{\@frontmattertextwidth}% \cleardoublepage% + \adjustwidth[]{\@prefaceextramargin}{\@prefaceextramargin}% \vspace*{\@frontmattertopskip}% \begin{center}% \begingroup @@ -514,17 +580,18 @@ \end{center}% \vspace*{1cm}% }{% - \setlength{\textwidth}{\@maintextwidth}% + \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}{% - \setlength{\textwidth}{\@frontmattertextwidth}% \cleardoublepage% + \adjustwidth[]{\@declarationextramargin}{\@declarationextramargin}% \vspace*{\@frontmattertopskip}% \begin{center}% \begingroup @@ -539,15 +606,15 @@ % \thesisauthor\newline % \today\newline %\end{flushright} - %\setlength{\textwidth}{\@maintextwidth}% + \endadjustwidth% \ignorespacesafterend% } + %% Environment for thesis abstract in frontmatter %% (argument is the thesis title) \newenvironment{abstract}[1][Abstract]{% - %\setlength{\textwidth}{\@frontmattertextwidth}% - %\begin{@narrow}{\@abstractextramargin} + \adjustwidth[]{\@abstractextramargin}{\@abstractextramargin}% \cleardoublepage% \vspace*{\@frontmattertopskip}% \begin{center}% @@ -557,28 +624,29 @@ \endgroup \end{center}% \vspace*{1cm}% - %\larger{% }{% - %}% - %\setlength{\textwidth}{\@maintextwidth}% - %\end{@narrow} + \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% - \begingroup - \ifx\@sftitles\@empty\else\sf\fi + %\@oldtitlepage% + \thispagestyle{empty}% + \begingroup% + \ifx\@sftitles\@empty\else\sf\fi% \begin{center}% \vspace*{\frontmattertitleskip}% \begin{doublespace}% @@ -589,51 +657,82 @@ \vspace*{8cm}% {#2}% \end{center}% - \endgroup - \@oldendtitlepage - \cleardoublepage% + \endgroup% + %\@oldendtitlepage% + %\cleardoublepage% } \renewcommand{\maketitle}[1]{\titlepage{}} -%% A main quote page -\DeclareRobustCommand{\frontquote}[2]{% + +%% A quote on its own page +\newlength{\@oldparindent} +\setlength{\@oldparindent}{\parindent} +\DeclareRobustCommand{\pagequote}[3][same]{% \cleardoublepage% - \vspace*{6.5cm}% - \thispagestyle{plain} - \pagestyle{plain} + \vspace*{\stretch{2}}% + \thispagestyle{plain}% + \pagestyle{plain}% \begin{center}% - \noindent\emph{``#1''}% + \begin{varwidth}{\textwidth}% + \def\@samelang{same}% + \def\@reqlang{#1}% + \ifx\@samelang\@reqlang% + \noindent\textsl{\enquote{#2}}% + \else% + \noindent\textsl{\foreignquote{\@reqlang}{#2}}% + \fi% \newline% - \indent --- #2% + \setlength{\parindent}{\@oldparindent} + \indent --- {#3}% + \end{varwidth}% \end{center}% - \cleardoublepage% + \vspace*{\stretch{4}}% + %\cleardoublepage% + \pagestyle{plain}% } +%% Alias +\let\frontquote\pagequote + -%% A dedication page +%% A quote on its own page \DeclareRobustCommand{\dedication}[1]{% \cleardoublepage% - \vspace*{7cm}% - \thispagestyle{plain} - \pagestyle{plain} + \vspace*{\stretch{2}}% + \thispagestyle{plain}% + \pagestyle{plain}% \begin{center}% - \noindent\emph{#1}% + \begin{varwidth}{\textwidth}% + \noindent\textsl{\enquote{#1}}% + \end{varwidth}% \end{center}% - \cleardoublepage% + \vspace*{\stretch{4}}% + %\cleardoublepage% + \pagestyle{plain}% } + %% Environment for colophon in backmatter \newenvironment{colophon}{% - \chapter{Colophon} + \chapter*{Colophon}% + \@mkboth{\MakeUppercase{Colophon}}{\MakeUppercase{Colophon}}% }{% \ignorespacesafterend % } %% Typesets a chapter quote -\DeclareRobustCommand{\chapterquote}[2]{% - \noindent\emph{``#1''}% +\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 --- #2% + \indent --- #3% + \end{adjustwidth}% \vspace{1cm}% } @@ -714,7 +813,7 @@ %% ``Thesis''-prefixed duplicate commands and environments (deprecated) -\newcommand{\thesistypeout}{\typeout{hepthesis: thesis- prefix commands are deprecated and will soon be removed}} +\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}% |