duview build added
[projects.git] / tools / tex / titling.sty
1 %%
2 %% This is file `titling.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% titling.dtx  (with options: `usc')
8 %% 
9 %% -----------------------------------------------------------------
10 %%   Author: Peter Wilson (Herries Press)
11 %%   Maintainer: Will Robertson (will dot robertson at latex-project dot org)
12 %%   Copyright 2000--2004 Peter R. Wilson
13 %% 
14 %%   This work may be distributed and/or modified under the
15 %%   conditions of the LaTeX Project Public License, either
16 %%   version 1.3c of this license or (at your option) any
17 %%   later version: <http://www.latex-project.org/lppl.txt>
18 %% 
19 %%   This work has the LPPL maintenance status "maintained".
20 %%   The Current Maintainer of this work is Will Robertson.
21 %% 
22 %%   This work consists of the files listed in the README file.
23 %% -----------------------------------------------------------------
24 %% 
25 \NeedsTeXFormat{LaTeX2e}
26 \ProvidesPackage{titling}[2009/09/04 v2.1d maketitle typesetting]
27
28 \newcommand{\pretitle}[1]{\def\@bspretitle{#1}}
29 \newcommand{\posttitle}[1]{\def\@bsposttitle{#1}}
30 \newcommand{\preauthor}[1]{\def\@bspreauthor{#1}}
31 \newcommand{\postauthor}[1]{\def\@bspostauthor{#1}}
32 \newcommand{\predate}[1]{\def\@bspredate{#1}}
33 \newcommand{\postdate}[1]{\def\@bspostdate{#1}}
34
35 \if@titlepage
36   \pretitle{\begin{center}\LARGE}
37   \posttitle{\par\end{center}\vskip 2em}
38   \preauthor{\begin{center}
39     \large \lineskip .75em%
40     \begin{tabular}[t]{c}}
41   \postauthor{\end{tabular}\par\end{center}}
42   \predate{\begin{center}\large}
43   \postdate{\par\end{center}}
44 \else
45   \pretitle{\begin{center}\LARGE}
46   \posttitle{\par\end{center}\vskip 0.5em}
47   \preauthor{\begin{center}
48     \large \lineskip .5em%
49     \begin{tabular}[t]{c}}
50   \postauthor{\end{tabular}\par\end{center}}
51   \predate{\begin{center}\large}
52   \postdate{\par\end{center}}
53 \fi
54
55 \newcommand{\maketitlehooka}{}
56 \newcommand{\maketitlehookb}{}
57 \newcommand{\maketitlehookc}{}
58 \newcommand{\maketitlehookd}{}
59
60 \newcommand{\thanksmarkseries}[1]{%
61   \def\@bsmarkseries{\renewcommand{\thefootnote}{\@nameuse{#1}{footnote}}}}
62 \newcommand{\symbolthanksmark}{\thanksmarkseries{\fnsymbol}}
63 \newcommand{\@bscontmark}{\setcounter{footnote}{0}}
64 \newcommand{\continuousmarks}{\def\@bscontmark{}}
65 \newcommand{\thanksheadextra}[2]{%
66   \def\@bsthanksheadpre{#1}%
67   \def\@bsthanksheadpost{#2}}
68 \newcommand{\thanksfootextra}[2]{%
69   \def\thanksfootpre{#1}%
70   \def\thanksfootpost{#2}}
71
72 \DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]}
73 \newcommand{\thanksgap}[1]{\hspace{#1}}
74 \newcommand{\tamark}{\@thefnmark}
75
76 \newlength{\thanksmarkwidth}
77 \newlength{\thanksmargin}
78 \newcommand{\thanksscript}[1]{\textsuperscript{#1}}
79 \newcommand{\makethanksmarkhook}{}
80
81 \newcommand{\thanksfootmark}{%
82   \hb@xt@\thanksmarkwidth{\hfil\normalfont\thanksscript{%
83     \thanksfootpre \tamark \thanksfootpost}}}
84
85 \newcommand{\makethanksmark}{%
86   \leavevmode%
87   \makethanksmarkhook\relax
88   \parindent 1em\noindent
89   \leftskip\thanksmargin\relax
90   \advance\leftskip \thanksmarkwidth \null\nobreak\hskip -\leftskip
91   \thanksfootmark
92 }
93
94 \newcommand{\usethanksrule}{\let\footnoterule\thanksrule}
95 \newcommand{\cancelthanksrule}{\let\footnoterule\@bsfootnoterule}
96
97 \if@titlepage
98   \thanksmarkseries{arabic}    % normal footnote numbers
99 \else
100   \thanksmarkseries{fnsymbol}
101 \fi
102 \thanksheadextra{}{}
103 \thanksfootextra{}{}
104 \setlength{\thanksmarkwidth}{1.8em}
105 \setlength{\thanksmargin}{-\thanksmarkwidth}
106
107 \AtBeginDocument{%
108   \let\thanksrule\footnoterule
109   \let\@bsfootnoterule\footnoterule
110 }
111
112 \newlength{\droptitle}
113 \setlength{\droptitle}{0pt}
114
115 \providecommand{\maketitle}{}
116 \if@titlepage
117   \renewcommand{\maketitle}{\begin{titlepage}%
118     \let\footnotesize\small
119     \let\footnoterule\relax
120     \let \footnote \thanks
121     \@bsmarkseries
122       \def\@makefnmark{\rlap{\@textsuperscript{%
123          \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}}%
124       \long\def\@makefntext##1{\makethanksmark ##1}
125     \null\vfil
126     \vskip 60\p@
127     \vspace*{\droptitle}
128     \maketitlehooka
129     {\@bspretitle \@title \@bsposttitle}
130     \maketitlehookb
131     {\@bspreauthor \@author \@bspostauthor}
132     \maketitlehookc
133     {\@bspredate \@date \@bspostdate}
134     \maketitlehookd
135     \par
136     \@thanks
137     \vfil\null
138     \end{titlepage}%
139     \@bscontmark  %  \setcounter{footnote}{0}%
140 %%%    \@bsmtitlempty
141   } % end titlepage defs
142 \else
143   \renewcommand{\maketitle}{\par
144     \begingroup
145       \@bsmarkseries
146       \def\@makefnmark{\rlap{\@textsuperscript{%
147          \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}}%
148       \long\def\@makefntext##1{\makethanksmark ##1}
149       \if@twocolumn
150         \ifnum \col@number=\@ne
151           \@maketitle
152         \else
153           \twocolumn[\@maketitle]%
154         \fi
155       \else
156         \newpage
157         \global\@topnum\z@
158         \@maketitle
159       \fi
160       \thispagestyle{plain}\@thanks
161     \endgroup
162     \@bscontmark  %  \setcounter{footnote}{0}%
163 %%%    \@bsmtitlempty
164   } % end non-titlepage
165
166   \def\@maketitle{%
167     \newpage
168     \null
169     \vskip 2em%
170           \vspace*{\droptitle}
171     \maketitlehooka
172     {\@bspretitle \@title \@bsposttitle}
173     \maketitlehookb
174     {\@bspreauthor \@author \@bspostauthor}
175     \maketitlehookc
176     {\@bspredate \@date \@bspostdate}
177     \maketitlehookd
178     \par
179     \vskip 1.5em}
180 \fi
181
182 \newenvironment{titlingpage}%
183   {%
184    \let\footnoterule\relax
185    \let\footnotesize\small
186    \if@twocolumn
187      \@restonecoltrue\onecolumn
188    \else
189      \@restonecolfalse
190    \fi
191    \thispagestyle{empty}
192    \setcounter{page}\@ne
193   }{%
194    \thispagestyle{empty}
195    \if@restonecol\twocolumn \else \newpage \fi
196    \if@twoside\else \setcounter{page}\@ne\fi}
197
198 \newcommand{\calccentering}[2]{
199   #1 = \paperwidth
200   \advance #1 by -\textwidth
201   \divide #1 by \tw@
202   \advance #1 by -#2
203   \advance #1 by -\hoffset
204   \advance #1 by -1in
205 }
206
207 \newcommand{\emptythanks}{\global\let\@thanks\@empty}
208
209 \newcommand{\@bsmtitlempty}{%
210   \global\let\maketitle\relax
211   \global\let\@maketitle\relax
212   \global\let\title\relax
213   \global\let\author\relax
214   \global\let\date\relax
215   \global\let\thanksmarkseries\relax
216   \global\let\thanksheadextra\relax
217   \global\let\thanksfootextra\relax
218   \global\let\thanksmark\relax
219   \global\let\thanksgap\relax
220 }
221
222 \newcommand{\keepthetitle}{%
223   \@bsmtitlempty
224   \global\let\thanks\relax
225   \global\let\and\relax
226   \global\let\@thanks\@empty
227   \global\let\@title\@empty
228   \global\let\@author\@empty
229   \global\let\@date\@empty
230 }
231
232 \providecommand{\killtitle}{}
233 \renewcommand{\killtitle}{%
234   \keepthetitle
235   \global\let\thetitle\relax
236   \global\let\theauthor\relax
237   \global\let\thedate\relax
238 }
239
240 \providecommand{\appendiargdef}[2]{\begingroup
241   \toks@\expandafter{#1{##1}#2}%
242   \edef\@bsx{\endgroup \def\noexpand#1####1{\the\toks@}}%
243   \@bsx}
244
245 \appendiargdef{\title}{%
246   \begingroup
247     \renewcommand{\thanks}[1]{}
248     \renewcommand{\thanksmark}[1]{}
249     \renewcommand{\thanksgap}[1]{}
250     \protected@xdef\thetitle{#1}
251   \endgroup}
252 \appendiargdef{\author}{%
253   \begingroup
254     \renewcommand{\thanks}[1]{}
255     \renewcommand{\and}{\unskip, }
256     \renewcommand{\thanksmark}[1]{}
257     \renewcommand{\thanksgap}[1]{}
258     \protected@xdef\theauthor{#1}
259   \endgroup}
260 \appendiargdef{\date}{%
261   \begingroup
262     \renewcommand{\thanks}[1]{}
263     \renewcommand{\thanksmark}[1]{}
264     \renewcommand{\thanksgap}[1]{}
265     \protected@xdef\thedate{#1}
266   \endgroup}
267
268 \endinput
269 %%
270 %% End of file `titling.sty'.