Version 1.1
[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}[2008/03/12 v1.1
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 }
132 \addto\captionsenglish{%
133   \def\theoremname{Theorem}%
134   \def\corollaryname{Corollary}%
135   \def\lemmaname{Lemma}%
136   \def\propositionname{Proposition}%
137   \def\definitionname{Definition}%
138   \def\examplename{Example}%
139   \def\remarkname{Remark}%
140   \def\notename{Note}%
141 }
142 \addto\captionsfrench{%
143   \def\theoremname{Th\'eor\`eme}%
144   \def\corollaryname{Corollaire}%
145   \def\lemmaname{Lemma}%
146   \def\propositionname{Proposition}%
147   \def\definitionname{D\'efinition}%
148   \def\examplename{Exemple}%
149   \def\remarkname{Remarque}%
150   \def\notename{Note}%
151 }
152
153 \theoremstyle{plain}
154 \newtheorem{thm}{\theoremname}[section]
155 \newtheorem{cor}[thm]{\corollaryname}
156 \newtheorem{lemma}[thm]{\lemmaname}
157 \newtheorem{prop}[thm]{\propositionname}
158
159 \theoremstyle{definition}
160 \newtheorem{dfn}[thm]{\definitionname}
161 \newtheorem{exa}[thm]{\examplename}
162 \newtheorem{rem}[thm]{\remarkname}
163 \newtheorem{note}[thm]{\notename}
164
165 %%% Commands that define the article information
166 \let\originaltitlecmd\title
167 \def\title#1{\originaltitlecmd{#1}\titlemark{#1}}
168 \def\subtitle#1{\def\sub@title{#1}}
169 \subtitle{}
170 \def\titlemark#1{\gdef\@htitle{\MakeUppercase{#1}}}
171 \def\titlenote#1{\expandafter\@titlenote\expandafter{\the\@titlenote\thanks{#1}}}
172 \newtoks\@titlenote
173
174 \def\makeshortauthor#1#2 #3\relax{
175 \if@shortauthortoks
176 \expandafter\@shortauthortoks\expandafter{\the\@shortauthortoks\space - \MakeUppercase{#1}. \MakeUppercase{#3}}%
177 \else
178 \@shortauthortoks{\MakeUppercase{#1}. \MakeUppercase{#3}}%
179 \@shortauthortokstrue
180 \fi
181 \def\@shortauthor{\the\@shortauthortoks}%
182 }
183 \newtoks\@shortauthortoks
184 \newif\if@shortauthortoks\@shortauthortoksfalse
185
186 \def\authormark#1{\gdef\@hauthor{\MakeUppercase{#1}}}
187 \def\author#1{%
188 \if@authortoks
189 \expandafter\@authortoks\expandafter{\the\@authortoks\space - \MakeUppercase{#1}}%
190 \else
191 \expandafter\@authortoks\expandafter{\the\@authortoks\MakeUppercase{#1}}%
192 \@authortokstrue
193 \fi
194 \makeshortauthor#1\relax%
195 \authormark{\the\@authortoks}%
196 \def\@author{\the\@authortoks}%
197 \@lastauthor{#1}%
198 }
199 \newtoks\@authortoks
200 \@authortoks{}
201 \newif\if@authortoks\@authortoksfalse
202 \newtoks\@lastauthor
203
204 \def\authorline@hyphen{ - }
205 \let\authorline@sep\authorline@hyphen
206 \def\authorline{%
207 \@authortoksfalse
208 \expandafter\@authortoks\expandafter{\the\@authortoks\protect\authorline@sep}%
209 }
210
211 \def\shortauthormark{\authormark{\the\@shortauthortoks}}
212
213 \newif\if@author\@authortrue
214 \def\noauthor{\@authorfalse\gdef\@hauthor{\@htitle}}
215
216 \def\address#1{%
217 \expandafter\expandafter\expandafter\@addresstoks\expandafter\expandafter\expandafter{%
218 \expandafter\the\expandafter\@addresstoks\expandafter\par
219 \expandafter\bigskip
220 \expandafter\filbreak
221 \expandafter\MakeUppercase\expandafter{\the\@lastauthor}\\
222 #1}%
223 }
224 \newtoks\@addresstoks
225 \def\@address{\par\bigskip\begin{flushright}%
226   \itshape
227   \the\@addresstoks
228 \end{flushright}}
229 \AtEndDocument{\@address}
230
231 %% Mathematics Subject Classification
232 \def\MSC#1{\gdef\@MSC{#1}}
233 \def\@MSC{}
234 %% Keywords
235 \def\keywords#1{\gdef\@keywords{#1}}
236 \def\@keywords{}
237
238 %% Year/Volume/Number/First Page/Last Page
239 \def\LM@Year{????}
240 \def\LM@Vol{???}
241 \def\LM@Num{??}
242 \def\LM@FirstPg{??}
243 \def\LM@LastPg{??}
244
245 %% Redefine \date to parse a string yyyy/mm/dd, which will be used
246 %% as submission date
247 \newcounter{LM@year}
248 \newcounter{LM@month}
249 \newcounter{LM@day}
250 \def\date#1{\LM@parsedate#1\LM@enddate}
251 \def\LM@parsedate#1/#2/#3\LM@enddate{%
252 \setcounter{LM@year}{#1}%
253 \setcounter{LM@month}{#2}%
254 \setcounter{LM@day}{#3}%
255 }
256
257 %% turn a number/counter into an italian month
258 \def\@itmonth#1{\ifcase#1\or gennaio\or febbraio\or marzo\or aprile\or
259 maggio\or giugno\or luglio\or agosto\or settembre\or ottobre\or novembre\or
260 dicembre\else\textbf{??}\fi}
261 \def\itmonth#1{\expandafter\@itmonth\csname c@#1\endcsname}
262
263 \renewcommand{\maketitle}{%
264   \begingroup
265     \renewcommand\thefootnote{}%
266     \def\@makefnmark{}%
267     \long\def\@makefntext##1{\parindent 1em\noindent##1}%
268     \newpage
269     \global\@topnum\z@   % Prevents figures from going at top of page.
270     \@maketitle
271     \thispagestyle{empty}\@thanks
272   \endgroup
273   \setcounter{footnote}{0}%
274   \global\let\thanks\relax
275   \global\let\maketitle\relax
276   \global\let\@maketitle\relax
277   \global\let\@thanks\@empty
278   \global\let\@author\@empty
279   \global\let\@shortauthor\@empty
280   \global\let\@date\@empty
281   \global\let\@title\@empty
282   \global\let\sub@title\@empty
283   \global\let\title\relax
284   \global\let\subtitle\relax
285   \global\let\author\relax
286   \global\let\date\relax
287   \global\let\and\relax
288   \global\let\MSC\relax
289   \global\let\@MSC\relax
290   \global\let\keywords\relax
291   \global\let\@keywords\relax
292   \global\let\titlenote\relax
293   \global\let\@titlenote\relax
294 }
295
296 %% insert the article information in the top right corner
297 \def\@articleinfo{%
298 \noindent\footnotesize LE MATEMATICHE\\
299 Vol.~\LM@Vol~(\LM@Year)~--~Fasc.~\LM@Num,~pp.~\LM@FirstPg--\LM@LastPg
300 }
301
302 \newif\ifsubmissiondate
303 \submissiondatetrue
304
305 \newif\ifshortauthors\shortauthorsfalse
306 %% Make the title page
307 \def\@maketitle{%
308   \newpage
309   \@articleinfo
310   %% Submission date (at the bottom)
311   \ifsubmissiondate
312     \thanks{%
313       \hskip0.8cm Entrato in redazione \arabic{LM@day} \itmonth{LM@month} \arabic{LM@year}\smallskip}%
314   \fi
315   %% MSC, if present
316   \ifx\@MSC\empty\else\thanks{%
317   \textit{AMS 2000 Subject Classification:} \@MSC
318   }\fi%
319   %% Keywords, if present
320   \ifx\@keywords\empty\else\thanks{%
321   \textit{Keywords:} \@keywords
322   }\fi%
323   \vskip 4.5truecm%
324   \begin{center}%
325   \let \footnote \thanks
326     {\def\\{\protect\linebreak}%
327     \fontsize{12}{15}\selectfont\bfseries \MakeUppercase{\@title}
328     \ifx\sub@title\empty\else\vskip5pt\fontsize{10}{14}\selectfont\bfseries \MakeUppercase{\sub@title}\fi
329     %% Title note, if present
330     \the\@titlenote
331     \par}%
332     \if@author
333     \vskip 0.5truecm%
334     {\fontsize{11.5}{14}\selectfont
335       \begin{tabular}[t]{c}%
336         \let\authorline@sep\tabularnewline
337         \ifshortauthors\@shortauthor\else\@author\fi
338       \end{tabular}\par
339     }%
340     \fi
341   \end{center}%
342   \par
343   \vskip 0.5truecm}
344
345 \renewenvironment{abstract}{%
346 \small\quotation
347 }{%
348 \endquotation
349 }
350
351 % In case the author forgets it:
352 \AtBeginDocument{\maketitle}
353
354 \expandafter\IfFileExists\expandafter{\jobname.pub}{%
355   \InputIfFileExists{\jobname.pub}{\typeout{Volume data loaded}}\relax%
356   \c@page=\LM@FirstPg\relax
357   \AtEndDocument{%
358     \@bsphack
359     \protected@write\@auxout{}%
360       {\string\xdef\string\LM@LastPg{\thepage}}%
361     \@esphack
362   }%
363 }{}