-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapc-mmr.sty
475 lines (387 loc) · 14.1 KB
/
apc-mmr.sty
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% =============================================================================
% For use with the memoir class.
% Loosely based on style files by Kieran Healy:
% https://github.com/kjhealy/latex-custom-kjh
% as well as on style files by Eivind Uggedal:
% https://bitbucket.org/uggedal/thesis
% =============================================================================
\ProvidesPackage{apc-mmr}
\usepackage{memhfixc}
% =============================================================================
% A few custom commands
% =============================================================================
\let\oldphi\phi
\renewcommand{\phi}{\varphi}
% Define timestamp using current time and date, except when using the VC bundle, in which case get revision info from Git repo.
% FIXME: Decide whether I want pagestyle `apc' to have last commit date (when available and using vc bundle) or date of compilation. Currently it is set so that it will look for Git info when available.
\newdateformat{dotdate}{%
\twodigit{\THEMONTH}.\twodigit{\THEDAY}.\THEYEAR}
\def\mysplit#1/#2/#3.{ %
\def\myyear{#1}\def\mymonth{#2}\def\myday{#3}%
}
\def\splitdate#1{\expandafter\mysplit#1.}
\@ifundefined{VCDateISO}{
\newcommand{\DateMod}{\dotdate\today}
}%
{
\splitdate{\VCDateTEX}
\newcommand{\DateMod}{\mymonth.\myday.\myyear}
}
\@ifundefined{VCTime}{
\newcommand{\TimeMod}{\xxivtime}
}
{
\newcommand{\TimeMod}{\VCTime}
}
\newcommand{\timestamp}{\DateMod\ at \TimeMod}
% Deprecated: I'm now using the fnpct package.
% \renewcommand*{\multfootsep}{\textsuperscript*{\normalfont,}}
%
% Redefine timestamp with specific date
\newcommand{\stamp}[1]{\renewcommand{\timestamp}{#1}}
%% Allows for using TiKZ to be inluded via the input
\newcommand{\tikzname}{
\pgfrealjobname{\jobname}
}
% Create a command to make a note at the top of the first page describing
% the publication status of the paper.
\newcommand{\bigvers}{}
\newcommand{\published}[1]{%
\gdef\puB{#1}
\renewcommand{\maketitlehooka}{%
\par\noindent\tiny\textsf\puB \par \noindent\textsf{\color{gray}\tiny\bigvers Last revision: \timestamp}}}
\newcommand{\puB}{}
% Define commands to provide date, identifying information, affiliation, etc.
\newcommand{\myaff}{}
\newcommand{\myem}{}
\newcommand{\vers}{}
\newcommand{\saywhen}{\shorttoday}
\newcommand{\myaffiliation}[1]{\renewcommand{\myaff}{#1}}
\newcommand{\myemail}[1]{\renewcommand{\myem}{#1}}
\newcommand{\when}[1]{\renewcommand{\saywhen}{#1}}
% Use the \date field to include email and affiliation.
\date{\emph{\myaff} \\ {\scriptsize\href{mailto:\myem}{\textsf\myem}}}
% Version number. Specified manually.
\newcommand{\version}[1]{\renewcommand{\vers}{, v{#1} \ }\renewcommand{\bigvers}{Version {#1}. }}
% =============================================================================
% Chapter styles
% =============================================================================
% Some global settings:
% Default droptitle length
\setlength{\droptitle}{-.5in}
% Turn Bibliography into a normal section.
% (I believe memoir turns it into a chapter by default?)
\AtBeginDocument{
\renewcommand{\bibsection}{%
\par\vskip 1em
\section*{\bibname}\par\vskip 1em
\prebibhook}
}
% Make style for Chapters and sections: article-1
\makechapterstyle{article-1}{
\renewcommand\thesection{\scshape\arabic{section}}
\setsecnumformat{\normalfont\scshape\MakeLowercase{\csname the##1\endcsname}\quad}
\setsecheadstyle{\normalsize\scshape\MakeLowercase}
\setsubsecheadstyle{\normalsize\itshape}
\setaftersubsubsecskip{-1em}
\setsubsubsecheadstyle{\small\itshape}
\renewcommand{\printchaptername}{}
\renewcommand{\chapternamenum}{}
\renewcommand{\chapnumfont}{\chaptitlefont}
\renewcommand{\printchapternum}{\chapnumfont \thechapter\space}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptername}{\secheadstyle}
\renewcommand{\cftchapterfont}{\normalfont}
\renewcommand{\cftchapterpagefont}{\normalfont\scshape}
\renewcommand{\cftchapterpresnum}{\scshape}
%\renewcommand{\cftchapterleader}{}
%\renewcommand{\cftchapterafterpnum}{\cftparfillskip}
\captiontitlefont{\small}
%\settocdepth{chapter}
\maxsecnumdepth{chapter}
\setsecnumdepth{subsection}
% reduce skip after section heading
\setaftersecskip{1.7ex}
% set name of bibliography to 'references'
\renewcommand{\bibname}{\normalsize\scshape\MakeLowercase References}
% Title flush left
\pretitle{\vskip 6em\flushleft\Large\scshape\MakeLowercase}
\posttitle{\par\vspace{0.65em}}
\preauthor{\flushleft\small}
\postauthor{\par\vspace*{0.6em}}
\predate{\flushleft\scriptsize}
\postdate{\par\vskip 2em}
% 'abstract' bigger skip from title
\renewcommand{\abstractname}{\normalfont\scriptsize}
\renewcommand{\abstracttextfont}{\normalfont\scriptsize}
%\abstractrunin
}
%
%
% Make style for Chapters and sections: article-2: Slightly larger section titles.
\makechapterstyle{article-2}{
\renewcommand\thesection{\arabic{section}}
\setsecnumformat{\normalfont\scshape\MakeLowercase{\csname the##1\endcsname}\quad}
\setsecheadstyle{\Large\scshape\MakeLowercase}
\setsubsecheadstyle{\normalsize\itshape}
\setaftersubsubsecskip{-1em}
\setsubsubsecheadstyle{\small\itshape}
\renewcommand{\printchaptername}{}
\renewcommand{\chapternamenum}{}
\renewcommand{\chapnumfont}{\chaptitlefont}
\renewcommand{\printchapternum}{\chapnumfont \thechapter\space}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptername}{\secheadstyle}
\renewcommand{\cftchapterfont}{\normalfont}
\renewcommand{\cftchapterpagefont}{\normalfont\scshape}
\renewcommand{\cftchapterpresnum}{\scshape}
%\renewcommand{\cftchapterleader}{}
%\renewcommand{\cftchapterafterpnum}{\cftparfillskip}
\captiontitlefont{\small}
%\settocdepth{chapter}
\maxsecnumdepth{chapter}
\setsecnumdepth{subsection}
% reduce skip after section heading
\setaftersecskip{1.7ex}
% set name of bibliography to 'references'
\renewcommand{\bibname}{\normalsize\scshape\MakeLowercase References}
% Title flush left
\pretitle{\vskip 6em\flushleft\Large\scshape\MakeLowercase}
\posttitle{\par\vspace{0.5em}}
\preauthor{\flushleft\small \lineskip 1em}
\postauthor{\par\vspace{0.2em}}
\predate{\flushleft\scriptsize\vspace{0.35em}}
\postdate{\par\vskip 2em}
% 'abstract' bigger skip from title
\renewcommand{\abstractname}{\normalfont\scriptsize}
\renewcommand{\abstracttextfont}{\normalfont\scriptsize}
%\abstractrunin
}
%
%
% =============================================================================
% Page styles (for headers and footers)
% =============================================================================
% Basic style. File info and compilation date in footer.
%
%
\makepagestyle{apc}
%\makeevenfoot{apc}{\thepage}{}{}
%\makeoddfoot{apc}{}{}{\thepage}
%\makeheadrule{apc}{\textwidth}{\normalrulethickness}
\newcommand{\@apcmarks}{%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\thechapter. \ %
\fi
\fi
##1}{}}
\def\sectionmark##1{%
\markright{##1}}
}
\makepsmarks{apc}{\@apcmarks}
\makepsmarks{apc}{}
\makeevenhead{apc}{}{}{\scshape\thepage}
\makeoddhead{apc}{}{}{\scshape\thepage}
\makeevenfoot{apc}{}{}{\vskip 3em\scriptsize{\color{gray}{\texttt{\jobname.tex\vers - \timestamp}}}}
\makeoddfoot{apc}{}{}{\vskip 3em\scriptsize{\color{gray}{\texttt{\jobname.tex\vers - \timestamp}}}}
% Git info in footnotes. Requires the vc package.
%
%
\makepagestyle{apcgit}
\newcommand{\@apcgitmarks}{%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\thechapter. \ %
\fi
\fi
##1}{}}
\def\sectionmark##1{%
\markright{##1}}
}
\makepsmarks{apcgit}{\@apcgitmarks}
\makeevenhead{apcgit}{}{}{\scshape\thepage}
\makeoddhead{apcgit}{}{}{\scshape\thepage}
\makeevenfoot{apcgit}{\vspace*{0in}\scriptsize{\color{gray}{\texttt{\VCRevision\ on \timestamp }}}}{}{\vspace*{0in}\scriptsize{\color{gray}{\texttt{\jobname.tex\vers}}}}
\makeoddfoot{apcgit}{\vspace*{0in}\scriptsize{\color{gray}{\texttt{\VCRevision\ on \timestamp }}}}{}{\vspace*{0in}\scriptsize{\color{gray}{\texttt{\jobname.tex\vers}}}}
%
% Clean footers.
%
\makepagestyle{apcfinal}
%\makeevenfoot{apc}{\thepage}{}{}
%\makeoddfoot{apc}{}{}{\thepage}
%\makeheadrule{apc}{\textwidth}{\normalrulethickness}
\newcommand{\@apcfinalmarks}{%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\thechapter. \ %
\fi
\fi
##1}{}}
\def\sectionmark##1{%
\markright{##1}}
}
\makepsmarks{apcfinal}{\@apcfinalmarks}
\makepsmarks{apcfinal}{}
\makeevenhead{apcfinal}{}{}{\scshape\thepage}
\makeoddhead{apcfinal}{}{}{\scshape\thepage}
\makeevenfoot{apcfinal}{}{}{}
\makeoddfoot{apcfinal}{}{}{}
%%
% =============================================================================
% Options
% =============================================================================
%% WIP: inserts line numbers for making feedback easier. Shows margin notes.
\DeclareOption{wip}{
% Style for margin notes, with counter.
\newcounter{margnote}
\renewcommand{\marg}[1]{\addtocounter{margnote}{1}{\color{BrickRed}$^\text{\raisebox{1pt}{\textsf{\alphalph{\value{margnote}}}}}$\marginpar{\baselineskip=0.8\baselineskip\color{BrickRed}$^\text{\fontspec[Scale=0.7]{Myriad Pro}\textsf{\alphalph{\value{margnote}}}}${\fontspec[Scale=0.7,Mapping=tex-text]{Myriad Pro} \ \scriptsize{#1}}\par}}}
\modulolinenumbers[5]
\let\oldmaketitle\maketitle
\renewcommand{\maketitle}{
\oldmaketitle
\linenumbers
}
}
% WIPMARG: leaves margin notes, no line numbers.
\DeclareOption{wipmarg}{
% Style for margin notes, with counter.
\newcounter{margnote}
\renewcommand{\marg}[1]{\addtocounter{margnote}{1}{\color{BrickRed}$^\text{\raisebox{1pt}{\textsf{\alphalph{\value{margnote}}}}}$\marginpar{\baselineskip=0.8\baselineskip\color{BrickRed}$^\text{\fontspec[Scale=0.7]{Myriad Pro}\textsf{\alphalph{\value{margnote}}}}${\fontspec[Scale=0.7,Mapping=tex-text]{Myriad Pro} \ \tiny{#1}}\par}}}
\let\oldmaketitle\maketitle
\renewcommand{\maketitle}{\oldmaketitle}
}
% CLEANWIP: Hide margin notes, leave line numbers. Good for circulating drafts.
\DeclareOption{cleanwip}{
\modulolinenumbers[5]
\let\oldmaketitle\maketitle
\renewcommand{\maketitle}{
\oldmaketitle
\linenumbers
}
}
% SYM: Calls MnSymbol option for Mathspec
%\DeclareOption{sym}{
% \AtEndOfPackage{\usepackage{MnSymbol}}
%}
% NOHEADER: remove header from first page (Ignores \published and \version commands.)
\DeclareOption{noheader}{
\AtEndOfPackage{\renewcommand{\version}[1]{}
\renewcommand{\published}[1]{}}
}
%% SIMPLEHEADER: Only include last modified information.
\DeclareOption{simpleheader}{
\AtEndOfPackage{\renewcommand{\published}[1]{%
\gdef\puB{#1}
\renewcommand{\maketitlehooka}{%
\par\noindent\scriptsize\puB \par\noindent{\texttt{\color{gray}\scriptsize Last revision: \timestamp}}}}
}
}
% NODOI: remove dois from references:
%\DeclareOption{nodoi}{
% \AtEndOfPackage{\renewcommand{\doi}[1]{}
% }
%}
% TITLEUP: Move title to top of the page. Useful when ignoring \published.
\DeclareOption{titleup}{
\AtEndOfPackage{
\setlength{\droptitle}{-1.5in}
}
}
% EXTTKZ: Allow to externalize tikz jobs.
% Based on the code here:
% http://kogs-www.informatik.uni-hamburg.de/~meine/tikz/process/
\DeclareOption{exttkz}{
% \usepackage{tkz-berge}
% \usepackage{tikz}
% \usetikzlibrary{shapes,arrows,positioning}
%\pgfrealjobname{\jobname}
%Use \finaltrue to cancel externalization feature. Not sure how this works.
\iffinal
\newcommand{\inputTikZ}[1]{%
\input{#1.tikz}%
}
\else
\newcommand{\inputTikZ}[1]{%
\beginpgfgraphicnamed{#1-external}%
\input{#1.tikz}%
\endpgfgraphicnamed%
}
\fi
}
% BRINGHURST: set typeblock on the basis of EoTS (loosely). Add metadata to pdf.
\DeclareOption{bringhurst}{
\settypeblocksize{*}{28pc}{1.62}
\setulmargins{*}{*}{1.2}
\setlrmargins{*}{*}{1}
\checkandfixthelayout
\makeatletter
\AtBeginDocument{
\hypersetup{
pdftitle = {\@title},
pdfauthor = {\@author}
}
}
\makeatother
}
% SUBMISSION: Prepare for blind review. Double spacing, narrow margins, remove author info both from pdf and from metadata.
\DeclareOption{submission}{
\settypeblocksize{*}{32pc}{1.5}
\setulmargins{*}{*}{1.3}
\setlrmargins{*}{*}{1}
\checkandfixthelayout
\ExecuteOptions{noheader,titleup}
\AtEndOfPackage{
\DoubleSpacing
}
\makeatletter
\AtBeginDocument{
\renewcommand{\myauth}{}
\renewcommand*{\@author}{}
\renewcommand{\myaff}{}
\renewcommand{\myem}{}
\hypersetup{
pdftitle = {\@title},
pdfauthor = {}
}
}
\makeatother
}
% HANDOUT: Narrow margins. Removes indentation from first line of paragraph, increases spaces between paragraphs.
% (Old option. Leaving mostly for backwards compatibility.)
\DeclareOption{handout}{
\setlrmarginsandblock{1in}{1in}{*}
\setulmarginsandblock{1in}{1.5in}{*}
\setheadfoot{\onelineskip}{.75in}
\setheaderspaces{\onelineskip}{*}{*}
\settrims{0pt}{0pt}
\setbinding{0pt}
\checkandfixthelayout
\setlength{\parindent}{0pt}
\abnormalparskip{0.5em}
\nonzeroparskip
}
% GITFN: Redefine \timestamp to include last revision date: requires the VC Bundle and a Git repository.
% Timestamp takes info from Git
% \DeclareOption{gitfn}{
% \renewcommand{\timestamp}{\printdate{\VCDateISO}\ at \VCTime}
% }
% Call BRINGHURST as default option.
\ExecuteOptions{bringhurst}
%==================================================================
\DeclareOption*{
\PackageWarning{apc-memoir}{Unknown option ‘\CurrentOption’}%
}
\ProcessOptions\relax
\endinput