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