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