Missing '\fi's
[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}[2007/01/01 v0.1
8 Class for articles in ``Le Matematiche'']
9
10 %%% Language options
11 \DeclareOption{english}{\PassOptionsToPackage{\CurrentOption}{babel}}
12 \DeclareOption{french}{\PassOptionsToPackage{\CurrentOption}{babel}}
13 \DeclareOption{italian}{\PassOptionsToPackage{\CurrentOption}{babel}}
14
15 %%% draft/final
16 \DeclareOption{draft}{\PassOptionsToClass{\CurrentOption}{article}}
17 \DeclareOption{final}{\PassOptionsToClass{\CurrentOption}{article}}
18
19 \ProcessOptions\relax
20
21 %%% Class based on the standard article class
22 \LoadClass[10pt,twoside]{article}
23 %%% Package `babel' for language management
24 \RequirePackage[italian]{babel}
25 %%% Package `url' for urls and emails
26 \RequirePackage{url}
27 %% Define an \email{...} command
28 \DeclareUrlCommand\email{\urlstyle{tt}}
29
30 %%% AMS math environments and symbols
31 \RequirePackage{amsmath}
32 \RequirePackage{amssymb}
33 \RequirePackage{amsthm}
34
35 % %\magnification\magstephalf
36 %%% Page geometry, using the `geometry' package
37 \RequirePackage[paperwidth=17cm,%
38                 paperheight=24cm,%
39                 footskip=0pt,%
40                 headsep=0.5cm,%
41                 headheight=0.5cm,%
42                 width=12.2cm,%
43                 height=18.5cm,%
44                 left=2cm,%
45                 top=2cm,%
46                 bottom=2.5cm]{geometry}
47
48 %%% Our default head/foot style
49
50 \renewcommand{\ps@plain}{%
51   \renewcommand{\@oddhead}{\hfill\@htitle\hfill\thepage}%
52   \renewcommand{\@evenhead}{\thepage\hfill\@hauthor\hfill}%
53   \renewcommand{\@oddfoot}{}%
54   \renewcommand{\@evenfoot}{}%
55 }
56 \pagestyle{plain}
57
58 % TODO these will be redefined in the article itself
59 \def\@htitle{some title}
60 \def\@hauthor{some author}
61
62 %%% Footnotes
63 \renewcommand\footnoterule{%
64   \hrule\@width.4\columnwidth
65   \kern2.6\p@}
66
67 %%% Section styles
68 \def\@seccntformat#1{\csname the#1\endcsname.\quad}
69 \renewcommand\section{\@startsection {section}{1}{\z@}%
70                                    {-24pt \@plus -6pt \@minus -3pt}%
71                                    {\medskipamount}%
72                                    {\normalfont\bfseries}}
73
74 %%% Theorem environments
75 \addto\captionsitalian{%
76   \def\theoremname{Teorema}%
77   \def\corollaryname{Corollario}%
78   \def\lemmaname{Lemma}%
79   \def\propositionname{Proposizione}%
80   \def\definitionname{Definizione}%
81   \def\examplename{Esempio}%
82   \def\remarkname{Osservazione}%
83   \def\notename{Nota}%
84 }
85 \addto\captionsenglish{%
86   \def\theoremname{Theorem}%
87   \def\corollaryname{Corollary}%
88   \def\lemmaname{Lemma}%
89   \def\propositionname{Proposition}%
90   \def\definitionname{Definition}%
91   \def\examplename{Example}%
92   \def\remarkname{Remark}%
93   \def\notename{Note}%
94 }
95 \addto\captionsfrench{%
96   \def\theoremname{Th\'eor\`eme}%
97   \def\corollaryname{Corollaire}%
98   \def\lemmaname{Lemma}%
99   \def\propositionname{Proposition}%
100   \def\definitionname{D\'efinition}%
101   \def\examplename{Exemple}%
102   \def\remarkname{Remarque}%
103   \def\notename{Note}%
104 }
105
106 \theoremstyle{plain}
107 \newtheorem{thm}{\theoremname}[section]
108 \newtheorem{cor}{\corollaryname}[section]
109 \newtheorem{lemma}{\lemmaname}[section]
110 \newtheorem{prop}{\propositionname}[section]
111
112 \theoremstyle{definition}
113 \newtheorem{dfn}{\definitionname}[section]
114 \newtheorem{exa}{\examplename}[section]
115 \newtheorem{rem}{\remarkname}[section]
116 \newtheorem{note}{\notename}[section]
117
118 %%%%% TODO
119 % TODO bibliography
120 % TODO font
121
122
123 %%% Commands that define the article information
124 % TODO \title
125 % TODO \author
126 % TODO \address
127 %% Mathematics Subject Classification
128 \def\MSC#1{\gdef\@MSC{#1}}
129 \def\@MSC{}
130 %% Keywords
131 \def\keywords#1{\gdef\@keywords{#1}}
132 \def\@keywords{}
133
134 %% Year/Volume/Number/First Page/Last Page
135 \edef\LM@Year{????}
136 \def\LM@Vol{???}
137 \def\LM@Num{??}
138 \def\LM@FirstPg{??}
139 \def\LM@LastPg{??}
140
141 %% Redefine \date to parse a string yyyy/mm/dd, which will be used
142 %% as submission date
143 \newcounter{LM@year}
144 \newcounter{LM@month}
145 \newcounter{LM@day}
146 \def\date#1{\LM@parsedate#1\LM@enddate}
147 \def\LM@parsedate#1/#2/#3\LM@enddate{%
148 \setcounter{LM@year}{#1}%
149 \setcounter{LM@month}{#2}%
150 \setcounter{LM@day}{#3}%
151 }
152
153 %% turn a number/counter into an italian month
154 \def\@itmonth#1{\ifcase#1\or gennaio\or febbraio\or marzo\or aprile\or
155 maggio\or giugno\or luglio\or agosto\or settembre\or ottobre\or novembre\or
156 dicembre\else\textbf{??}\fi}
157 \def\itmonth#1{\expandafter\@itmonth\csname c@#1\endcsname}
158
159 \renewcommand{\maketitle}{%
160   \begingroup
161     \renewcommand\thefootnote{}%
162     \def\@makefnmark{}%
163     \long\def\@makefntext##1{\parindent 1em\noindent##1}%
164     \newpage
165     \global\@topnum\z@   % Prevents figures from going at top of page.
166     \@maketitle
167     \thispagestyle{empty}\@thanks
168   \endgroup
169   \setcounter{footnote}{0}%
170   \global\let\thanks\relax
171   \global\let\maketitle\relax
172   \global\let\@maketitle\relax
173   \global\let\@thanks\@empty
174   \global\let\@author\@empty
175   \global\let\@date\@empty
176   \global\let\@title\@empty
177   \global\let\title\relax
178   \global\let\author\relax
179   \global\let\date\relax
180   \global\let\and\relax
181   \global\let\MSC\relax
182   \global\let\@MSC\relax
183   \global\let\keywords\relax
184   \global\let\@keywords\relax
185 }
186
187 %% insert the article information in the top right corner
188 \def\@articleinfo{%
189 \noindent\footnotesize LE MATEMATICHE\\
190 Vol.~\LM@Vol~(\LM@Year)~--~Fasc.~\LM@Num,~pp.~\LM@FirstPg--\LM@LastPg
191 }
192
193 %% Make the title page
194 \def\@maketitle{%
195   \newpage
196   \@articleinfo
197   %% Submission date (at the bottom)
198   \thanks{%
199     \hskip0.8cm Entrato in redazione \arabic{LM@day} \itmonth{LM@month} \arabic{LM@year}\\}%
200   %% MSC, if present
201   \ifx\@MSC\empty\else\thanks{%
202   \textit{Subject Classification:} \@MSC
203   }\fi%
204   %% Keywords, if present
205   \ifx\@keywords\empty\else\thanks{%
206   \textit{Keywords:} \@keywords
207   }\fi%
208   \vskip 4.5truecm%
209   \begin{center}%
210   \let \footnote \thanks
211     {\Large\bfseries \@title \par}%
212     \vskip 0.5truecm%
213     {\Large
214       \begin{tabular}[t]{c}%
215         \@author
216       \end{tabular}\par}%
217   \end{center}%
218   \par
219   \vskip 0.5truecm}
220
221 \renewenvironment{abstract}{%
222 \small\quotation
223 }{%
224 \endquotation
225 }
226
227 % In case the author forgets it:
228 \AtBeginDocument{\maketitle}
229