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