Subtitle command
[lematema] / lematema.cls
1 %%%% Class file for Le Matematiche
2 %%% Author: Giuseppe Bilotta
3 %%% Email (work): bilotta@dmi.unict.it
4 %%% Email (home): giuseppe.bilotta@gmail.com
5 %
6 % Additional commands:
7 %
8 % *  \authorline          : put the following authors on another line
9 % *  \submissiondatefalse : hide the submission date on the first article page
10 % *  \shortauthorstrue    : shorten the author names under the title
11 % *  \shortauthormark     : shorten the author names in the headings
12
13 \NeedsTeXFormat{LaTeX2e}
14 \ProvidesClass{lematema}[2008/03/10 v1.0
15 Class for articles in ``Le Matematiche'']
16
17 \newif\if@langsel
18 \@langselfalse
19 %%% Language options
20 \DeclareOption{english}{\PassOptionsToPackage{\CurrentOption}{babel}\@langseltrue}
21 \DeclareOption{french}{\PassOptionsToPackage{\CurrentOption}{babel}\@langseltrue}
22 \DeclareOption{italian}{\PassOptionsToPackage{\CurrentOption}{babel}\@langseltrue}
23
24 %%% draft/final
25 \DeclareOption{draft}{\PassOptionsToClass{\CurrentOption}{article}}
26 \DeclareOption{final}{\PassOptionsToClass{\CurrentOption}{article}}
27
28 \ProcessOptions\relax
29
30 \if@langsel\else
31 \ClassWarning{lematema}{No language specified, defaulting to english}
32 \PassOptionsToPackage{english}{babel}
33 \fi
34
35 %%% Class based on the standard article class
36 \LoadClass[11pt,twoside]{article}
37 %%% Font: times (and math stuff)
38 \usepackage{mathptmx}
39 %%% Package `babel' for language management
40 \RequirePackage{babel}
41 %%% Package `url' for urls
42 \RequirePackage{url}
43 %%% Define an \email{...} command, but let's not use the url package for this
44 \newcommand{\email}[1]{{e-mail: \upshape\ttfamily#1}}
45
46 %%% AMS math environments and symbols
47 \RequirePackage{amsmath}
48 \RequirePackage{amssymb}
49 \RequirePackage{amsthm}
50
51 %%% Bibliography
52 \RequirePackage[square,numbers,sort&compress,sectionbib]{natbib}
53 \bibliographystyle{lematema}
54 \def\bibhere{\bibliography{\jobname}}
55 \addto\captionsitalian{%
56   \def\refname{Bibliografia}%
57   \def\bibname{Bibliografia}%
58 }
59 \addto\captionsenglish{%
60   \def\refname{References}%
61   \def\bibname{References}%
62 }
63 \addto\captionsfrench{%
64   \def\refname{Bibliographie}%
65   \def\bibname{Bibliographie}%
66 }
67 % from the needspace package
68 \newcommand{\needspace}[1]{\begingroup\setlength{\dimen@}{#1}%
69   \vskip\z@\@plus\dimen@ \penalty -100\vskip\z@\@plus -\dimen@
70     \vskip\dimen@ \penalty 9999\vskip -\dimen@\endgroup}
71 %
72 \def\bibsection{%
73   \par
74   \needspace{4cm}
75   \vspace{2cm}
76   \centering{\MakeUppercase{\refname}}%
77   \par
78   \small
79 }
80 \setlength{\bibsep}{3pt}
81
82 % %\magnification\magstephalf
83 %%% Page geometry, using the `geometry' package
84 \RequirePackage[paperwidth=17cm,%
85                 paperheight=24cm,%
86                 footskip=0pt,%
87                 headsep=0.5cm,%
88                 headheight=0.5cm,%
89                 width=12.2cm,%
90                 %height=18.5cm,% overspecification, comment out
91                 left=2cm,%
92                 top=2cm,%
93                 bottom=2.5cm]{geometry}
94
95 %%% Our default head/foot style
96
97 \renewcommand{\ps@plain}{%
98   \renewcommand{\@oddhead}{\hfill{\footnotesize\@htitle}\hfill\thepage}%
99   \renewcommand{\@evenhead}{\thepage\hfill{\footnotesize\@hauthor}\hfill}%
100   \renewcommand{\@oddfoot}{}%
101   \renewcommand{\@evenfoot}{}%
102 }
103 \pagestyle{plain}
104
105 \def\@htitle{\textbf{(no title)}}
106 \def\@hauthor{\textbf{(no author)}}
107
108 %%% Footnotes
109 \renewcommand\footnoterule{%
110   \hrule\@width.4\columnwidth
111   \kern2.6\p@}
112
113 %%% Section styles
114 \def\@seccntformat#1{\csname the#1\endcsname.\quad}
115 \renewcommand\section{\@startsection {section}{1}{\z@}%
116                                    {-24pt \@plus -6pt \@minus -3pt}%
117                                    {\medskipamount}%
118                                    {\normalfont\bfseries}}
119
120 %%% Theorem environments
121 \addto\captionsitalian{%
122   \def\theoremname{Teorema}%
123   \def\corollaryname{Corollario}%
124   \def\lemmaname{Lemma}%
125   \def\propositionname{Proposizione}%
126   \def\definitionname{Definizione}%
127   \def\examplename{Esempio}%
128   \def\remarkname{Osservazione}%
129   \def\notename{Nota}%
130 }
131 \addto\captionsenglish{%
132   \def\theoremname{Theorem}%
133   \def\corollaryname{Corollary}%
134   \def\lemmaname{Lemma}%
135   \def\propositionname{Proposition}%
136   \def\definitionname{Definition}%
137   \def\examplename{Example}%
138   \def\remarkname{Remark}%
139   \def\notename{Note}%
140 }
141 \addto\captionsfrench{%
142   \def\theoremname{Th\'eor\`eme}%
143   \def\corollaryname{Corollaire}%
144   \def\lemmaname{Lemma}%
145   \def\propositionname{Proposition}%
146   \def\definitionname{D\'efinition}%
147   \def\examplename{Exemple}%
148   \def\remarkname{Remarque}%
149   \def\notename{Note}%
150 }
151
152 \theoremstyle{plain}
153 \newtheorem{thm}{\theoremname}[section]
154 \newtheorem{cor}[thm]{\corollaryname}
155 \newtheorem{lemma}[thm]{\lemmaname}
156 \newtheorem{prop}[thm]{\propositionname}
157
158 \theoremstyle{definition}
159 \newtheorem{dfn}[thm]{\definitionname}
160 \newtheorem{exa}[thm]{\examplename}
161 \newtheorem{rem}[thm]{\remarkname}
162 \newtheorem{note}[thm]{\notename}
163
164 %%% Commands that define the article information
165 \let\originaltitlecmd\title
166 \def\title#1{\originaltitlecmd{#1}\titlemark{#1}}
167 \def\subtitle#1{\def\sub@title{#1}}
168 \subtitle{}
169 \def\titlemark#1{\gdef\@htitle{\MakeUppercase{#1}}}
170 \def\titlenote#1{\expandafter\@titlenote\expandafter{\the\@titlenote\thanks{#1}}}
171 \newtoks\@titlenote
172
173 \def\makeshortauthor#1#2 #3\relax{
174 \if@shortauthortoks
175 \expandafter\@shortauthortoks\expandafter{\the\@shortauthortoks\space - \MakeUppercase{#1}. \MakeUppercase{#3}}%
176 \else
177 \@shortauthortoks{\MakeUppercase{#1}. \MakeUppercase{#3}}%
178 \@shortauthortokstrue
179 \fi
180 \def\@shortauthor{\the\@shortauthortoks}%
181 }
182 \newtoks\@shortauthortoks
183 \newif\if@shortauthortoks\@shortauthortoksfalse
184
185 \def\authormark#1{\gdef\@hauthor{\MakeUppercase{#1}}}
186 \def\author#1{%
187 \if@authortoks
188 \expandafter\@authortoks\expandafter{\the\@authortoks\space - \MakeUppercase{#1}}%
189 \else
190 \expandafter\@authortoks\expandafter{\the\@authortoks\MakeUppercase{#1}}%
191 \@authortokstrue
192 \fi
193 \makeshortauthor#1\relax%
194 \authormark{\the\@authortoks}%
195 \def\@author{\the\@authortoks}%
196 \@lastauthor{#1}%
197 }
198 \newtoks\@authortoks
199 \@authortoks{}
200 \newif\if@authortoks\@authortoksfalse
201 \newtoks\@lastauthor
202
203 \def\authorline@hyphen{ - }
204 \let\authorline@sep\authorline@hyphen
205 \def\authorline{%
206 \@authortoksfalse
207 \expandafter\@authortoks\expandafter{\the\@authortoks\protect\authorline@sep}%
208 }
209
210 \def\shortauthormark{\authormark{\the\@shortauthortoks}}
211
212 \def\address#1{%
213 \expandafter\expandafter\expandafter\@addresstoks\expandafter\expandafter\expandafter{%
214 \expandafter\the\expandafter\@addresstoks\expandafter\par
215 \expandafter\bigskip
216 \expandafter\MakeUppercase\expandafter{\the\@lastauthor}\\
217 #1}%
218 }
219 \newtoks\@addresstoks
220 \def\@address{\par\bigskip\begin{flushright}%
221   \itshape
222   \the\@addresstoks
223 \end{flushright}}
224 \AtEndDocument{\@address}
225
226 %% Mathematics Subject Classification
227 \def\MSC#1{\gdef\@MSC{#1}}
228 \def\@MSC{}
229 %% Keywords
230 \def\keywords#1{\gdef\@keywords{#1}}
231 \def\@keywords{}
232
233 %% Year/Volume/Number/First Page/Last Page
234 \def\LM@Year{????}
235 \def\LM@Vol{???}
236 \def\LM@Num{??}
237 \def\LM@FirstPg{??}
238 \def\LM@LastPg{??}
239
240 %% Redefine \date to parse a string yyyy/mm/dd, which will be used
241 %% as submission date
242 \newcounter{LM@year}
243 \newcounter{LM@month}
244 \newcounter{LM@day}
245 \def\date#1{\LM@parsedate#1\LM@enddate}
246 \def\LM@parsedate#1/#2/#3\LM@enddate{%
247 \setcounter{LM@year}{#1}%
248 \setcounter{LM@month}{#2}%
249 \setcounter{LM@day}{#3}%
250 }
251
252 %% turn a number/counter into an italian month
253 \def\@itmonth#1{\ifcase#1\or gennaio\or febbraio\or marzo\or aprile\or
254 maggio\or giugno\or luglio\or agosto\or settembre\or ottobre\or novembre\or
255 dicembre\else\textbf{??}\fi}
256 \def\itmonth#1{\expandafter\@itmonth\csname c@#1\endcsname}
257
258 \renewcommand{\maketitle}{%
259   \begingroup
260     \renewcommand\thefootnote{}%
261     \def\@makefnmark{}%
262     \long\def\@makefntext##1{\parindent 1em\noindent##1}%
263     \newpage
264     \global\@topnum\z@   % Prevents figures from going at top of page.
265     \@maketitle
266     \thispagestyle{empty}\@thanks
267   \endgroup
268   \setcounter{footnote}{0}%
269   \global\let\thanks\relax
270   \global\let\maketitle\relax
271   \global\let\@maketitle\relax
272   \global\let\@thanks\@empty
273   \global\let\@author\@empty
274   \global\let\@shortauthor\@empty
275   \global\let\@date\@empty
276   \global\let\@title\@empty
277   \global\let\sub@title\@empty
278   \global\let\title\relax
279   \global\let\subtitle\relax
280   \global\let\author\relax
281   \global\let\date\relax
282   \global\let\and\relax
283   \global\let\MSC\relax
284   \global\let\@MSC\relax
285   \global\let\keywords\relax
286   \global\let\@keywords\relax
287   \global\let\titlenote\relax
288   \global\let\@titlenote\relax
289 }
290
291 %% insert the article information in the top right corner
292 \def\@articleinfo{%
293 \noindent\footnotesize LE MATEMATICHE\\
294 Vol.~\LM@Vol~(\LM@Year)~--~Fasc.~\LM@Num,~pp.~\LM@FirstPg--\LM@LastPg
295 }
296
297 \newif\ifsubmissiondate
298 \submissiondatetrue
299
300 \newif\ifshortauthors\shortauthorsfalse
301 %% Make the title page
302 \def\@maketitle{%
303   \newpage
304   \@articleinfo
305   %% Submission date (at the bottom)
306   \ifsubmissiondate
307     \thanks{%
308       \hskip0.8cm Entrato in redazione \arabic{LM@day} \itmonth{LM@month} \arabic{LM@year}\smallskip}%
309   \fi
310   %% MSC, if present
311   \ifx\@MSC\empty\else\thanks{%
312   \textit{AMS 2000 Subject Classification:} \@MSC
313   }\fi%
314   %% Keywords, if present
315   \ifx\@keywords\empty\else\thanks{%
316   \textit{Keywords:} \@keywords
317   }\fi%
318   \vskip 4.5truecm%
319   \begin{center}%
320   \let \footnote \thanks
321     {\def\\{\protect\linebreak}%
322     \fontsize{12}{15}\selectfont\bfseries \MakeUppercase{\@title}
323     \ifx\sub@title\empty\else\vskip5pt\fontsize{10}{14}\selectfont\bfseries \MakeUppercase{\sub@title}\fi
324     %% Title note, if present
325     \the\@titlenote
326     \par}%
327     \vskip 0.5truecm%
328     {\fontsize{11.5}{14}\selectfont
329       \begin{tabular}[t]{c}%
330         \let\authorline@sep\tabularnewline
331         \ifshortauthors\@shortauthor\else\@author\fi
332       \end{tabular}\par
333     }%
334   \end{center}%
335   \par
336   \vskip 0.5truecm}
337
338 \renewenvironment{abstract}{%
339 \small\quotation
340 }{%
341 \endquotation
342 }
343
344 % In case the author forgets it:
345 \AtBeginDocument{\maketitle}
346
347 \expandafter\IfFileExists\expandafter{\jobname.pub}{%
348   \InputIfFileExists{\jobname.pub}{\typeout{Volume data loaded}}\relax%
349   \c@page=\LM@FirstPg\relax
350   \AtEndDocument{%
351     \@bsphack
352     \protected@write\@auxout{}%
353       {\string\xdef\string\LM@LastPg{\thepage}}%
354     \@esphack
355   }%
356 }{}