]> code.communitydata.science - cdsc_tex.git/blob - paper_template/cdsc-memoir.sty
Merge branch 'master' of code.communitydata.cc:cdsc_tex
[cdsc_tex.git] / paper_template / cdsc-memoir.sty
1 % Some article styles and page layout tweaks for the LaTeX Memoir
2 % class.
3 %
4 % Copyright 2009-2018 Benjamin Mako Hill <mako@atdot.cc>
5 % Copyright 2008-2009 Kieran Healy <kjhealy@soc.duke.edu>
6
7 % Distributed as free software under the GNU GPL v3
8
9 % This file was originally based on one by Kieran Healy
10 % available here: http://github.com/kjhealy/latex-custom-kjh/
11
12 %%% Custom styles for headers and footers
13 %%% Basic 
14
15 \makepagestyle{cdsc-page}
16 %\makeevenfoot{cdsc-page}{\thepage}{}{}
17 %\makeoddfoot{cdsc-page}{}{}{\thepage}
18 %\makeheadrule{cdsc-page}{\textwidth}{\normalrulethickness}
19 \newcommand{\@cdscmarks}{%
20   \let\@mkboth\markboth
21   \def\chaptermark##1{%
22     \markboth{%
23       \ifnum \c@secnumdepth >\m@ne
24         \if@mainmatter
25           \thechapter. \ %
26         \fi
27       \fi
28       ##1}{}}
29   \def\sectionmark##1{%
30     \markright{##1}}
31 }
32 \makepsmarks{cdsc-page}{\@cdscmarks}
33 \makepsmarks{cdsc-page}{}
34 \makeevenhead{cdsc-page}{}{}{\scshape\thepage}
35 \makeoddhead{cdsc-page}{}{}{\scshape\thepage}
36
37 %%% version control info in footers; requires vc package 
38 % Make the style for vc-git revision control headers and footers
39 \makepagestyle{cdsc-page-git}
40 \newcommand{\@gitmarks}{%
41   \let\@mkboth\markboth
42   \def\chaptermark##1{%
43     \markboth{%
44       \ifnum \c@secnumdepth >\m@ne
45         \if@mainmatter
46           \thechapter. \ %
47         \fi
48       \fi
49       ##1}{}}
50   \def\sectionmark##1{%
51     \markright{##1}}
52 }
53 \makepsmarks{cdsc-page-git}{\@gitmarks}
54 \makeevenhead{cdsc-page-git}{}{}{\scshape\thepage}
55 \makeoddhead{cdsc-page-git}{}{}{\scshape\thepage}
56 \makeevenfoot{cdsc-page-git}{}{\texttt{\footnotesize{\textcolor{BrickRed}{git revision \VCRevision\ on \VCDateTEX}}}}{}
57 \makeoddfoot{cdsc-page-git}{}{\texttt{\footnotesize \textcolor{BrickRed}{git revision \VCRevision\ on \VCDateTEX}}}{}
58
59 %%% print a datestamp from ShareLaTeX
60 \makepagestyle{cdsc-page-overleaf}
61 \newcommand{\@slmarks}{%
62   \let\@mkboth\markboth
63   \def\chaptermark##1{%
64     \markboth{%
65       \ifnum \c@secnumdepth >\m@ne
66         \if@mainmatter
67           \thechapter. \ %
68         \fi
69       \fi
70       ##1}{}}
71   \def\sectionmark##1{%
72     \markright{##1}}
73 }
74 \makepsmarks{cdsc-page-overleaf}{\@slmarks}
75 \makeevenhead{cdsc-page-overleaf}{}{}{\scshape\thepage}
76 \makeoddhead{cdsc-page-overleaf}{}{}{\scshape\thepage}
77 \makeevenfoot{cdsc-page-overleaf}{}{\texttt{\footnotesize{\textcolor{BrickRed}{Buildstamp/Version:~\pdfdate}}}}{}
78 \makeoddfoot{cdsc-page-overleaf}{}{\texttt{\footnotesize{\textcolor{BrickRed}{Buildstamp/Version:~\pdfdate}}}}{}
79
80 %% Create a command to make a note at the top of the first page describing the
81 %% publication status of the paper. 
82 \newcommand{\published}[1]{% 
83    \gdef\puB{#1}} 
84    \newcommand{\puB}{} 
85    \renewcommand{\maketitlehooka}{% 
86        \par\noindent\footnotesize \puB} 
87
88 \makepagestyle{cdsc-page-memo}
89 \makeevenhead{cdsc-page-memo}{}{}{}
90 \makeoddhead{cdsc-page-memo}{}{}{} 
91 \makeevenfoot{cdsc-page-memo}{}{\scshape \thepage/\pageref{LastPage}}{}
92 \makeoddfoot{cdsc-page-memo}{}{\scshape \thepage/\pageref{LastPage}}{}
93
94 \usepackage{lastpage}
95 \usepackage{datetime}
96
97 % blank footnote
98 % Use \symbolfootnote[0]{Footnote text} for a blank footnote. 
99 % Useful for initial acknowledgment note.
100 \long\def\symbolfootnote[#1]#2{\begingroup%
101 \def\thefootnote{\fnsymbol{footnote}}\footnote[#1]{#2}\endgroup}
102
103 % put a period after the section numbers
104 \setsecnumformat{\csname the#1\endcsname.\enspace}
105
106 % set fonts to garamond and helvetica
107 \renewcommand{\rmdefault}{ugm}
108 \renewcommand{\sfdefault}{phv}
109
110 % material shared between the two modes
111
112 \setsubsecheadstyle{\normalsize\itshape} 
113 \setaftersubsubsecskip{-1em}
114 \setsubsubsecheadstyle{\small\bfseries}
115 \renewcommand{\printchaptername}{} 
116 \renewcommand{\chapternamenum}{} 
117 \renewcommand{\chapnumfont}{\chaptitlefont} 
118 \renewcommand{\printchapternum}{\chapnumfont \thechapter\space} 
119 \renewcommand{\afterchapternum}{} 
120 \renewcommand{\printchaptername}{\secheadstyle}
121 \renewcommand{\cftchapterfont}{\normalfont} 
122 \renewcommand{\cftchapterpagefont}{\normalfont\scshape} 
123 \renewcommand{\cftchapterpresnum}{\scshape} 
124 \captiontitlefont{\small}
125
126 % turn off chapter numbering
127 \counterwithout{section}{chapter}
128 \counterwithout{figure}{chapter}
129 \counterwithout{table}{chapter}
130  
131 % supress chapter numbers 
132 \maxsecnumdepth{chapter} 
133 \setsecnumdepth{chapter}
134
135 % for numbered sections and subsections:
136 % (a) comment out the above stanza; (b) uncomment the one below
137 % \maxsecnumdepth{subsection} 
138 % \setsecnumdepth{subsection}
139
140 % set name of bibliography to 'references'
141 \renewcommand{\bibname}{References}
142
143 % >> cdsc-article <<
144 \makechapterstyle{cdsc-article}{
145
146   % section heading sytle
147   \setsecheadstyle{\large\scshape} 
148  
149  % reduce skip after section heading
150   \setaftersecskip{1.7ex}
151  
152   % Title flush left
153   \pretitle{\flushleft\LARGE \itshape}
154   \posttitle{\par\vskip 0.5em}
155   \preauthor{\flushleft  \large \lineskip 1em}
156   \postauthor{\par\lineskip 1em}
157   \predate{\flushleft\footnotesize\vspace{0.65em}}
158   \postdate{\par\vskip 1em}
159  
160   % 'abstract' title, bigger skip from title
161   \renewcommand{\abstractname}{Abstract:}
162   \renewcommand{\abstractnamefont}{\normalfont\small\bfseries}
163   \renewcommand{\abstracttextfont}{\normalfont\small}
164   \setlength{\absparindent}{0em}
165   \setlength{\abstitleskip}{-1.5em}
166   \abstractrunin
167
168   % this is the default page style for chapters
169   \pagestyle{cdsc-page}
170
171 }
172
173 % >> cdsc-memo <<
174 \makechapterstyle{cdsc-memo}{
175
176   % section heading sytle
177   \setsecheadstyle{\large\sffamily\bfseries\MakeUppercase} 
178
179   % reduce skip after section heading
180   \setaftersecskip{1pt}
181   \setbeforesecskip{-1em}
182  
183   % 'abstract' title, bigger skip from title
184   % \renewcommand{\maketitle}{\{\preauthor \theauthor\} \hfill \thetitle}
185   \renewcommand{\maketitle}{
186     {\Large\sffamily\bfseries\MakeUppercase\thetitle} \hfill
187     {\Large\sffamily\MakeUppercase\theauthor}
188     \vskip 0.7em}
189   \renewcommand{\abstractname}{\normalfont\scriptsize\noindent}
190   \renewcommand{\abstracttextfont}{\normalfont\scriptsize}
191   \abstractrunin
192
193   % set name of bibliography to 'references'
194   \renewcommand{\bibname}{References}
195   
196   \parindent 0pt
197
198   % this is the default page style for chapters
199   \pagestyle{cdsc-page-memo}
200
201 }
202
203 \endinput
204

Community Data Science Collective || Want to submit a patch?