Version 0.8a
[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/04 v0.8a
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 %
61 \def\bibsection{%
62   \par
63   \vspace{2cm}%
64   \centering{\MakeUppercase{\refname}}%
65   \par\samepage
66   \small
67 }
68 \setlength{\bibsep}{3pt}
69
70 % %\magnification\magstephalf
71 %%% Page geometry, using the `geometry' package
72 \RequirePackage[paperwidth=17cm,%
73                 paperheight=24cm,%
74                 footskip=0pt,%
75                 headsep=0.5cm,%
76                 headheight=0.5cm,%
77                 width=12.2cm,%
78                 %height=18.5cm,% overspecification, comment out
79                 left=2cm,%
80                 top=2cm,%
81                 bottom=2.5cm]{geometry}
82
83 %%% Our default head/foot style
84
85 \renewcommand{\ps@plain}{%
86   \renewcommand{\@oddhead}{\hfill{\footnotesize\@htitle}\hfill\thepage}%
87   \renewcommand{\@evenhead}{\thepage\hfill{\footnotesize\@hauthor}\hfill}%
88   \renewcommand{\@oddfoot}{}%
89   \renewcommand{\@evenfoot}{}%
90 }
91 \pagestyle{plain}
92
93 \def\@htitle{\textbf{(no title)}}
94 \def\@hauthor{\textbf{(no author)}}
95
96 %%% Footnotes
97 \renewcommand\footnoterule{%
98   \hrule\@width.4\columnwidth
99   \kern2.6\p@}
100
101 %%% Section styles
102 \def\@seccntformat#1{\csname the#1\endcsname.\quad}
103 \renewcommand\section{\@startsection {section}{1}{\z@}%
104                                    {-24pt \@plus -6pt \@minus -3pt}%
105                                    {\medskipamount}%
106                                    {\normalfont\bfseries}}
107
108 %%% Theorem environments
109 \addto\captionsitalian{%
110   \def\theoremname{Teorema}%
111   \def\corollaryname{Corollario}%
112   \def\lemmaname{Lemma}%
113   \def\propositionname{Proposizione}%
114   \def\definitionname{Definizione}%
115   \def\examplename{Esempio}%
116   \def\remarkname{Osservazione}%
117   \def\notename{Nota}%
118 }
119 \addto\captionsenglish{%
120   \def\theoremname{Theorem}%
121   \def\corollaryname{Corollary}%
122   \def\lemmaname{Lemma}%
123   \def\propositionname{Proposition}%
124   \def\definitionname{Definition}%
125   \def\examplename{Example}%
126   \def\remarkname{Remark}%
127   \def\notename{Note}%
128 }
129 \addto\captionsfrench{%
130   \def\theoremname{Th\'eor\`eme}%
131   \def\corollaryname{Corollaire}%
132   \def\lemmaname{Lemma}%
133   \def\propositionname{Proposition}%
134   \def\definitionname{D\'efinition}%
135   \def\examplename{Exemple}%
136   \def\remarkname{Remarque}%
137   \def\notename{Note}%
138 }
139
140 \theoremstyle{plain}
141 \newtheorem{thm}{\theoremname}[section]
142 \newtheorem{cor}[thm]{\corollaryname}
143 \newtheorem{lemma}[thm]{\lemmaname}
144 \newtheorem{prop}[thm]{\propositionname}
145
146 \theoremstyle{definition}
147 \newtheorem{dfn}[thm]{\definitionname}
148 \newtheorem{exa}[thm]{\examplename}
149 \newtheorem{rem}[thm]{\remarkname}
150 \newtheorem{note}[thm]{\notename}
151
152 %%% Commands that define the article information
153 \let\originaltitlecmd\title
154 \def\title#1{\originaltitlecmd{#1}\titlemark{#1}}
155 \def\titlemark#1{\gdef\@htitle{\MakeUppercase{#1}}}
156 \def\titlenote#1{\expandafter\@titlenote\expandafter{\the\@titlenote\thanks{#1}}}
157 \newtoks\@titlenote
158
159 \def\authormark#1{\gdef\@hauthor{\MakeUppercase{#1}}}
160 \def\author#1{%
161 \if@authortoks
162 \expandafter\@authortoks\expandafter{\the\@authortoks{} - #1}%
163 \else
164 \@authortoks{#1}%
165 \@authortokstrue
166 \fi
167 \authormark{\the\@authortoks}%
168 \def\@author{\the\@authortoks}%
169 \@lastauthor{#1}%
170 }
171 \newtoks\@authortoks
172 \newif\if@authortoks\@authortoksfalse
173 \newtoks\@lastauthor
174
175 \def\address#1{%
176 \expandafter\expandafter\expandafter\@addresstoks\expandafter\expandafter\expandafter{%
177 \expandafter\the\expandafter\@addresstoks\expandafter\par
178 \expandafter\bigskip
179 \expandafter\MakeUppercase\expandafter{\the\@lastauthor}\\
180 #1}%
181 }
182 \newtoks\@addresstoks
183 \def\@address{\par\bigskip\begin{flushright}%
184   \itshape
185   \the\@addresstoks
186 \end{flushright}}
187 \AtEndDocument{\@address}
188
189 %% Mathematics Subject Classification
190 \def\MSC#1{\gdef\@MSC{#1}}
191 \def\@MSC{}
192 %% Keywords
193 \def\keywords#1{\gdef\@keywords{#1}}
194 \def\@keywords{}
195
196 %% Year/Volume/Number/First Page/Last Page
197 \def\LM@Year{????}
198 \def\LM@Vol{???}
199 \def\LM@Num{??}
200 \def\LM@FirstPg{??}
201 \def\LM@LastPg{??}
202
203 %% Redefine \date to parse a string yyyy/mm/dd, which will be used
204 %% as submission date
205 \newcounter{LM@year}
206 \newcounter{LM@month}
207 \newcounter{LM@day}
208 \def\date#1{\LM@parsedate#1\LM@enddate}
209 \def\LM@parsedate#1/#2/#3\LM@enddate{%
210 \setcounter{LM@year}{#1}%
211 \setcounter{LM@month}{#2}%
212 \setcounter{LM@day}{#3}%
213 }
214
215 %% turn a number/counter into an italian month
216 \def\@itmonth#1{\ifcase#1\or gennaio\or febbraio\or marzo\or aprile\or
217 maggio\or giugno\or luglio\or agosto\or settembre\or ottobre\or novembre\or
218 dicembre\else\textbf{??}\fi}
219 \def\itmonth#1{\expandafter\@itmonth\csname c@#1\endcsname}
220
221 \renewcommand{\maketitle}{%
222   \begingroup
223     \renewcommand\thefootnote{}%
224     \def\@makefnmark{}%
225     \long\def\@makefntext##1{\parindent 1em\noindent##1}%
226     \newpage
227     \global\@topnum\z@   % Prevents figures from going at top of page.
228     \@maketitle
229     \thispagestyle{empty}\@thanks
230   \endgroup
231   \setcounter{footnote}{0}%
232   \global\let\thanks\relax
233   \global\let\maketitle\relax
234   \global\let\@maketitle\relax
235   \global\let\@thanks\@empty
236   \global\let\@author\@empty
237   \global\let\@date\@empty
238   \global\let\@title\@empty
239   \global\let\title\relax
240   \global\let\author\relax
241   \global\let\date\relax
242   \global\let\and\relax
243   \global\let\MSC\relax
244   \global\let\@MSC\relax
245   \global\let\keywords\relax
246   \global\let\@keywords\relax
247   \global\let\titlenote\relax
248   \global\let\@titlenote\relax
249 }
250
251 %% insert the article information in the top right corner
252 \def\@articleinfo{%
253 \noindent\footnotesize LE MATEMATICHE\\
254 Vol.~\LM@Vol~(\LM@Year)~--~Fasc.~\LM@Num,~pp.~\LM@FirstPg--\LM@LastPg
255 }
256
257 \newif\ifsubmissiondate
258 \submissiondatetrue
259
260 %% Make the title page
261 \def\@maketitle{%
262   \newpage
263   \@articleinfo
264   %% Submission date (at the bottom)
265   \ifsubmissiondate
266     \thanks{%
267       \hskip0.8cm Entrato in redazione \arabic{LM@day} \itmonth{LM@month} \arabic{LM@year}\smallskip}%
268   \fi
269   %% MSC, if present
270   \ifx\@MSC\empty\else\thanks{%
271   \textit{AMS 2000 Subject Classification:} \@MSC
272   }\fi%
273   %% Keywords, if present
274   \ifx\@keywords\empty\else\thanks{%
275   \textit{Keywords:} \@keywords
276   }\fi%
277   \vskip 4.5truecm%
278   \begin{center}%
279   \let \footnote \thanks
280     {\def\\{\protect\linebreak}%
281     \fontsize{12}{15}\selectfont\bfseries \MakeUppercase{\@title}
282     %% Title note, if present
283     \the\@titlenote
284     \par}%
285     \vskip 0.5truecm%
286     {\fontsize{11.5}{14}\selectfont
287       \begin{tabular}[t]{c}%
288         \MakeUppercase{\@author}
289       \end{tabular}\par
290     }%
291   \end{center}%
292   \par
293   \vskip 0.5truecm}
294
295 \renewenvironment{abstract}{%
296 \small\quotation
297 }{%
298 \endquotation
299 }
300
301 % In case the author forgets it:
302 \AtBeginDocument{\maketitle}
303
304 \expandafter\IfFileExists\expandafter{\jobname.pub}{%
305   \InputIfFileExists{\jobname.pub}{\typeout{Volume data loaded}}\relax%
306   \c@page=\LM@FirstPg\relax
307   \AtEndDocument{%
308     \@bsphack
309     \protected@write\@auxout{}%
310       {\string\xdef\string\LM@LastPg{\thepage}}%
311     \@esphack
312   }%
313 }{}