summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cascadilla/cascadilla.cls
blob: 7f41bc39a6ae4701c3f63096e79b5d7008745497 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
%% cascadilla.cls
%% Copyright 2008-2012 Max Bane
%% Version 1.8.2
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Max Bane.
%
% This work consists of the files cascadilla.cls and example.tex.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This LaTeX class provides an extension of the "article" document class that
% can be used to typeset papers conforming to the stylesheet of the Cascadilla
% Proceedings Project (http://www.lingref.com/cpp/authors/style.html), which
% is used by a number of linguistics conference proceedings (e.g., WCCFL).
% Suggestions, questions, and bug reports should be directed to Max Bane at
% max.bane@gmail.com.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Changes:
% Version 1.8.2: Made footnote marks flush with left edge of body text.
% Version 1.8.1: Fixed centering of author line by simplifying \blankline
% command - thanks to Christopher Piñón.
% Version 1.8: Added author's signature statement at the top of the first page,
% and the "nosignature" option to suppress it.
% Version 1.7.1: Added commented example of listing multiple
% authors/institutions to example.tex.
% Version 1.7: Added "a4paper" option for typsetting on A4 paper, which is
% allowed by the Cascadilla stylesheet with particular margin settings.
% Version 1.6.1: Fixed compile bug caused by ill-formed date string in
% \ProvidesClass.
% Version 1.6: Redefined \thanks command once more, to conform with the new
% requirements for an "invisible asterisk".
% Version 1.5: Redefined \thanks command for use in titles.
% Version 1.4: Modified bibpunct to use cascadilla's (Cascadilla, 2006:13)
% style.
% Version 1.3: Put in some missing \selectfont's, adjusted \abovecaptionskip
% and \belowcaptionskip for use with \centering rather than the center
% environment.
% Version 1.2: Restored blank space between title and author
% Version 1.1: Made title matter optional, added notimes option, added
% additional blank line after title, section labels end with a space rather
% than a quad, made figure/table captions bold, added immediate subsection
% commands.
% Version 1.0: Initial release.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Identification

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cascadilla}[2012/01/17 v1.8.2 Class for Cascadilla Proceedings
Project articles, by Max Bane]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Class Options

\RequirePackage{ifthen}

\newboolean{hyphenate}
\newboolean{copyright}
\setboolean{copyright}{true}
\newboolean{nopagenums}
\setboolean{nopagenums}{true}
\newboolean{times}
\setboolean{times}{true}
\newboolean{a4paper}
\newboolean{signature}
\setboolean{signature}{true}

\DeclareOption{hyphenate}{\setboolean{hyphenate}{true}}
\DeclareOption{nocopyright}{\setboolean{copyright}{false}}
\DeclareOption{pagenums}{\setboolean{nopagenums}{false}}
\DeclareOption{notimes}{\setboolean{times}{false}}
\DeclareOption{a4paper}{\setboolean{a4paper}{true}}
\DeclareOption{nosignature}{\setboolean{signature}{false}}

\ProcessOptions \relax

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package Loading

% We're just an extension of the built-in article class.
% The Cascadilla stylesheet requires US Letter paper and 10pt body fontsize
% (which is happily LaTeX's default fontsize)
% Update (version 1.7): the Cascadilla stylesheet now admits A4 paper, with
% different margins; check for the "a4paper" option before loading the article
% class and setting the margins.
\ifthenelse{\boolean{a4paper}}{
    \LoadClass[a4paper]{article} 
    % Set up the margin widths/heights using the geometry package
    \RequirePackage[a4paper,left=3.15cm,right=3.15cm,top=2.54cm,bottom=4.29cm,foot=0.75in]{geometry}
}{
    \LoadClass[letterpaper]{article} 
    % Set up the margin widths/heights using the geometry package
    \RequirePackage[letterpaper,left=1.38in,right=1.38in,top=1.0in,bottom=1.0in,foot=0.75in]{geometry}
}


% Stylesheet requires Times Roman font
\ifthenelse{\boolean{times}}{
    \RequirePackage{times}
}{}

% Stylesheet requires the the first paragraphs of all sections be indented.
% The standardly available indentfirst package does that for us.
\RequirePackage{indentfirst}

% We'll need fancyhdr for typesetting the copyright notice required by the
% stylesheet
\RequirePackage{fancyhdr}

% We'll use titlesec to format section titles according to the stylesheet
\RequirePackage{titlesec}

% We use natbib for formatting the bibliography (plus a hacked .bst file)
\RequirePackage{natbib}

% Cascadilla prefers if table/figure captions are labeled bold
\RequirePackage[labelfont=bf]{caption}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main Definitions

\newcommand{\blankline}{\quad\\}

% Booleans for whether various strings have been set
\newboolean{haveAuthor}
\newboolean{haveTitle}
\newboolean{haveInstitution}

\newboolean{afterPar}

% Commands for setting author, title, completed date, institution and copyright year
\renewcommand{\author}[1]{\gdef\@cascauthor{#1}\gdef\@author{#1}\setboolean{haveAuthor}{true}}
\renewcommand{\title}[1]{\gdef\@casctitle{#1}\gdef\@title{#1}\setboolean{haveTitle}{true}}
\newcommand{\completed}[1]{\gdef\@cascdate{#1}}
\newcommand{\institution}[1]{\gdef\@institution{#1}\setboolean{haveInstitution}{true}}
\newcommand{\copyrightyear}[1]{\gdef\@copyrightyear{#1}}
%\renewcommand{\thanks}[1]{\def\thefootnote{\fnsymbol{footnote}}\footnote[1]{#1}}
\renewcommand{\thanks}[1]{\def\thefootnote{\fnsymbol{footnote}}\footnotetext[1]{#1}}

%% Redefine \maketitle to conform to cascadilla stylesheet
\renewcommand{\maketitle}{%
    \begin{center}
        \ifthenelse{\boolean{signature}}{
            \normalsize
            \selectfont
            This printout has been approved by me, the author. Any mistakes in
this printout will not be fixed by the publisher. Here is my signature and the
date:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad}\\
            \blankline
        }{\blankline\blankline\blankline}
        \ifthenelse{\boolean{haveTitle}}{
            \fontsize{18}{18}
            \selectfont
            \textbf{\@title}\\
            %\blankline
            \vspace{18pt}
            \normalsize
        }{}
    
        \ifthenelse{\boolean{haveAuthor}}{
            \ifthenelse{\boolean{haveTitle}}{\blankline}{}
            \fontsize{14pt}{14pt}
            \selectfont
            \textbf{\@author}
            \normalsize
            \selectfont
        }{}
    
        \ifthenelse{\boolean{haveInstitution}}{
            \normalsize
            \selectfont
            \textbf{\@institution}
        }{}
        
        \blankline
    \end{center}
}

% The stylesheet (apparently) demands justified text *without* any
% hyphenation (i.e., only word and letter spacing), even though this is
% really ugly and violates every typographic convention, and ends up 
% looking like a cheap MS Word document. The following parameter settings
% discourage TeX's layout algorithm from breaking lines with syllabic hyphens.
% Can be suppressed by the "hyphenate" class option.
\ifthenelse{\boolean{hyphenate}}{}{
    \hyphenpenalty=5000
    \tolerance=1000
}

% Paragraph indents should be one quarter inch
\parindent=0.25in

% Footnotes should be set in 9pt, which is \small
\let\footnotesize\small

% Adjust footnotes so that numbers appear flush with margin.
% Implementation inspired by answers at:
% http://tex.stackexchange.com/questions/40976/align-footnote-mark-with-text-margin
\renewcommand{\@makefntext}[1]{%
  \settowidth{\@tempdima}{\@thefnmark} \parindent \dimexpr\@tempdima+.75em\relax%
  \noindent\makebox[1em][l]{\textsuperscript{\@thefnmark}}#1
}

% Disable page numbers. Suppressed by "pagenums" class option.
\ifthenelse{\boolean{nopagenums}}{
    \pagestyle{empty}
    \setlength{\footskip}{0in}
}{}

% Reduce the spacing around captions in tables and figures
\setlength{\abovecaptionskip}{12pt}
\setlength{\belowcaptionskip}{-5pt}

% The following bit of code increases the size of the bottom margin on the
% first page only, to make room for the copyright statement
\ifthenelse{\boolean{copyright}}{
    \setlength{\textheight}{8.75in}
    \AtBeginDocument{\setlength{\textheight}{9in}}
}{}

% The first page of the article gets a copyright statement, as specified in
% the cascadilla stylesheet
% Suppressed by the "nocopyright" class option.
\newcommand\CascadillaCopyright {
    \fancypagestyle{plain}{
    \fancyhf{}
    \fancyfoot[L]{\ifthenelse{\boolean{nopagenums}}{\vspace{0.1in}}{\vspace{-0.65in}}\small\copyright{}\ \@copyrightyear\ \@cascauthor\\Cascadilla Proceedings
    Project\\Completed \@cascdate}
    \renewcommand{\headrulewidth}{0pt}
    }
}
\ifthenelse{\boolean{copyright}}{
    \AtBeginDocument{\CascadillaCopyright{}}
    \AtBeginDocument{\thispagestyle{plain}}
}{
    \ifthenelse{\boolean{nopagenums}}{
        \AtBeginDocument{\thispagestyle{empty}}
    }{}
}

% Tell natbib to indent hanging lines by a quarter inch
\setlength{\bibhang}{0.25in}

% Format section headings according to the cascadilla stylesheet
\titlelabel{\thetitle.\ }
\titleformat*{\section}{\fontsize{12pt}{0}\bf}
\titleformat*{\subsection}{\fontsize{11pt}{0}\itshape}
\titleformat*{\subsubsection}{\fontsize{11pt}{0}\itshape}
\titlespacing{\section}{0pt}{11pt}{10pt}
\titlespacing{\subsection}{0pt}{11pt}{10pt}
\titlespacing{\subsubsection}{0pt}{11pt}{10pt}

% Commands for immediate subsections, which require different spacing than
% normal headings
\newcommand{\immedsubsection}[1]{\vspace{-9pt}\subsection{#1}}
\newcommand{\immedsubsubsection}[1]{\vspace{-9pt}\subsubsection{#1}}

% Provide a command for the bibliography
\newcommand{\cascadillabibliography}[1]{\small\renewcommand{\baselinestretch}{2}\bibliographystyle{cascadilla}\bibliography{#1}}

% Set up citation punctuation for, e.g., (Shosted, 2006:13).
\AtBeginDocument{
    \bibpunct[:]{(}{)}{;}{a}{,}{,}
}