More detailed comments et al.
[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
34 % %\magnification\magstephalf
35 %%% Page geometry, using the `geometry' package
36 \RequirePackage[paperwidth=17cm,%
37                 paperheight=24cm,%
38                 footskip=0pt,%
39                 headsep=0.5cm,%
40                 headheight=0.5cm,%
41                 width=12.2cm,%
42                 height=18.5cm,%
43                 left=2cm,%
44                 top=2cm,%
45                 bottom=2.5cm]{geometry}
46
47 %%% Our default head/foot style
48
49 \renewcommand{\ps@plain}{%
50   \renewcommand{\@oddhead}{\hfill\@htitle\hfill\thepage}%
51   \renewcommand{\@evenhead}{\thepage\hfill\@hauthor\hfill}%
52   \renewcommand{\@oddfoot}{}%
53   \renewcommand{\@evenfoot}{}%
54 }
55 \pagestyle{plain}
56
57 % TODO these will be redefined in the article itself
58 \def\@htitle{some title}
59 \def\@hauthor{some author}
60
61 %%%%% TODO
62 % TODO section titles
63 % TODO bibliography
64 % TODO font
65
66
67 %%% Commands that define the article information
68 % TODO \title
69 % TODO \author
70 % TODO \address
71 %% Mathematics Subject Classification
72 \def\MSC#1{\gdef\@MSC{#1}}
73 \def\@MSC{}
74 %% Keywords
75 \def\keywords#1{\gdef\@keywords{#1}}
76 \def\@keywords{}
77
78 %% Year/Volume/Number/First Page/Last Page
79 \edef\LM@Year{????}
80 \def\LM@Vol{???}
81 \def\LM@Num{??}
82 \def\LM@FirstPg{??}
83 \def\LM@LastPg{??}
84
85 %% Redefine \date to parse a string yyyy/mm/dd, which will be used
86 %% as submission date
87 \newcounter{LM@year}
88 \newcounter{LM@month}
89 \newcounter{LM@day}
90 \def\date#1{\LM@parsedate#1\LM@enddate}
91 \def\LM@parsedate#1/#2/#3\LM@enddate{%
92 \setcounter{LM@year}{#1}%
93 \setcounter{LM@month}{#2}%
94 \setcounter{LM@day}{#3}%
95 }
96
97 %% turn a number/counter into an italian month
98 \def\@itmonth#1{\ifcase#1\or gennaio\or febbraio\or marzo\or aprile\or
99 maggio\or giugno\or luglio\or agosto\or settembre\or ottobre\or novembre\or
100 dicembre\else\textbf{??}\fi}
101 \def\itmonth#1{\expandafter\@itmonth\csname c@#1\endcsname}
102
103 \renewcommand{\maketitle}{%
104   \begingroup
105     \renewcommand\thefootnote{}%
106     \def\@makefnmark{}%
107     \long\def\@makefntext##1{\parindent 1em\noindent##1}%
108     \newpage
109     \global\@topnum\z@   % Prevents figures from going at top of page.
110     \@maketitle
111     \thispagestyle{empty}\@thanks
112   \endgroup
113   \setcounter{footnote}{0}%
114   \global\let\thanks\relax
115   \global\let\maketitle\relax
116   \global\let\@maketitle\relax
117   \global\let\@thanks\@empty
118   \global\let\@author\@empty
119   \global\let\@date\@empty
120   \global\let\@title\@empty
121   \global\let\title\relax
122   \global\let\author\relax
123   \global\let\date\relax
124   \global\let\and\relax
125   \global\let\MSC\relax
126   \global\let\@MSC\relax
127   \global\let\keywords\relax
128   \global\let\@keywords\relax
129 }
130
131 %% insert the article information in the top right corner
132 \def\@articleinfo{%
133 \noindent\footnotesize LE MATEMATICHE\\
134 Vol.~\LM@Vol~(\LM@Year)~--~Fasc.~\LM@Num,~pp.~\LM@FirstPg--\LM@LastPg
135 }
136
137 %% Make the title page
138 \def\@maketitle{%
139   \newpage
140   \@articleinfo
141   %% Submission date (at the bottom)
142   \thanks{%
143     \hskip0.8cm Entrato in redazione \arabic{LM@day} \itmonth{LM@month} \arabic{LM@year}\\}%
144   %% MSC, if present
145   \ifx\@MSC\empty\else\thanks{%
146   \textit{Subject Classification:} \@MSC
147   }%
148   %% Keywords, if present
149   \ifx\@keywords\empty\else\thanks{%
150   \textit{Keywords:} \@keywords
151   }%
152   \vskip 4.5truecm%
153   \begin{center}%
154   \let \footnote \thanks
155     {\Large\bfseries \@title \par}%
156     \vskip 0.5truecm%
157     {\Large
158       \begin{tabular}[t]{c}%
159         \@author
160       \end{tabular}\par}%
161   \end{center}%
162   \par
163   \vskip 0.5truecm}
164
165 \renewenvironment{abstract}{%
166 \small\quotation
167 }{%
168 \endquotation
169 }
170
171 % In case the author forgets it:
172 \AtBeginDocument{\maketitle}
173