-
Notifications
You must be signed in to change notification settings - Fork 84
/
RJournal_nogeom.sty
335 lines (289 loc) · 11.3 KB
/
RJournal_nogeom.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
% Package `RJournal' to use with LaTeX2e
% Copyright (C) 2010 by the R Foundation
% Copyright (C) 2013 by the R Journal
%
% Originally written by Kurt Hornik and Friedrich Leisch with subsequent
% edits by the editorial board
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{RJournal_nogeom}[2013/08/27 v0.13 RJournal_geom package]
\RequirePackage{tikz}
% Overall page layout, fonts etc -----------------------------------------------
% Issues of of \emph{The R Journal} are created from the standard \LaTeX{}
% document class \pkg{report}.
%\RequirePackage{geometry}
%\geometry{a4paper,
% textwidth=14cm, top=1cm, bottom=1cm,
% includehead,includefoot,centering,
% footskip=1.5cm}
%\raggedbottom
%
%\RequirePackage{fancyhdr}
%\fancyhead{}
%\fancyheadoffset{2cm}
%\fancyhead[L]{\textsc{\RJ@sectionhead}}
%\fancyhead[R]{\thepage}
%\fancyfoot{}
%\fancyfoot[L]{The R Journal Vol. \RJ@volume/\RJ@number, \RJ@month}
%\fancyfoot[R]{ISSN 2073-4859}
%\pagestyle{fancy}
% We use the following fonts (all with T1 encoding):
%
% rm & palatino
% tt & inconsolata
% sf & helvetica
% math & palatino
\RequirePackage{microtype}
\RequirePackage[scaled=0.92]{helvet}
\RequirePackage{palatino,mathpazo}
\RequirePackage[scaled=1.02]{inconsolata}
\RequirePackage[T1]{fontenc}
%\RequirePackage[hyphens]{url}
\RequirePackage[pdfa]{hyperref}
% Dark blue colour for all links
\RequirePackage{color}
\definecolor{link}{rgb}{0.45,0.51,0.67}
\hypersetup{
unicode,
colorlinks=true,%
citecolor=link,%
filecolor=link,%
linkcolor=link,%
urlcolor=link
}
% Give the text a little room to breath
\setlength{\parskip}{3pt}
\RequirePackage{setspace}
\setstretch{1.05}
% Issue and article metadata ---------------------------------------------------
% Basic front matter information about the issue: volume, number, and
% date.
%\newcommand{\volume}[1]{\def\RJ@volume{#1}}
%\newcommand{\volnumber}[1]{\def\RJ@number{#1}}
%\renewcommand{\month}[1]{\def\RJ@month{#1}}
%\renewcommand{\year}[1]{\def\RJ@year{#1}}
% Individual articles correspond to
% chapters, and are contained in |article| environments. This makes it
% easy to have figures counted within articles and hence hyperlinked
% correctly.
% An article has an author, a title, and optionally a subtitle. We use
% the obvious commands for specifying these. Articles will be put in certain
% journal sections, named by \sectionhead.
%\newcommand {\sectionhead} [1]{\def\RJ@sectionhead{#1}}
%\renewcommand{\author} [1]{\def\RJ@author{#1}}
%\renewcommand{\title} [1]{\def\RJ@title{#1}}
%\newcommand {\subtitle} [1]{\def\RJ@subtitle{#1}}
% Control appearance of titles: make slightly smaller than usual, and
% suppress section numbering. See http://tex.stackexchange.com/questions/69749
% for why we don't use \setcounter{secnumdepth}{-1}
%\usepackage[medium]{titlesec}
%\usepackage{titletoc}
%\titleformat{\section} {\normalfont\large\bfseries}{}{0em}{}
%\titleformat{\subsection}{\normalfont\normalsize\bfseries}{}{0em}{}
%\titlecontents{chapter} [0em]{}{}{}{\titlerule*[1em]{.}\contentspage}
% Article layout ---------------------------------------------------------------
% Environment |article| clears the article header information at its beginning.
% We use |\FloatBarrier| from the placeins package to keep floats within
% the article.
%\RequirePackage{placeins}
%\newenvironment{article}{\author{}\title{}\subtitle{}\FloatBarrier}{\FloatBarrier}
%
%% Refereed articles should have an abstract, so we redefine |\abstract| to
%% give the desired style
%
%\renewcommand{\abstract}[1]{%
%\setstretch{1}%
%\noindent%
%\small%
%\textbf{Abstract} #1
%}
% The real work is done by a redefined version of |\maketitle|. Note
% that even though we do not want chapters (articles) numbered, we
% need to increment the chapter counter, so that figures get correct
% labelling.
%
%\renewcommand{\maketitle}{%
%\noindent
% \chapter{\RJ@title}\refstepcounter{chapter}
% \ifx\empty\RJ@subtitle
% \else
% \noindent\textbf{\RJ@subtitle}
% \par\nobreak\addvspace{\baselineskip}
% \fi
% \ifx\empty\RJ@author
% \else
% \noindent\textit{\RJ@author}
% \par\nobreak\addvspace{\baselineskip}
% \fi
% \@afterindentfalse\@nobreaktrue\@afterheading
%}
% Now for some ugly redefinitions. We do not want articles to start a
% new page. (Actually, we do, but this is handled via explicit
% \newpage
%
% The name@of@eq is a hack to get hyperlinks to equations to work
% within each article, even though there may be multiple eq.(1)
% \begin{macrocode}
%\renewcommand\chapter{\secdef\RJ@chapter\@schapter}
%\providecommand{\nohyphens}{%
% \hyphenpenalty=10000\exhyphenpenalty=10000\relax}
%\newcommand{\RJ@chapter}{%
% \edef\name@of@eq{equation.\@arabic{\c@chapter}}%
% \renewcommand{\@seccntformat}[1]{}%
% \@startsection{chapter}{0}{0mm}{%
% -2\baselineskip \@plus -\baselineskip \@minus -.2ex}{\p@}{%
% \phantomsection\normalfont\huge\bfseries\raggedright}}
% Book reviews should appear as sections in the text and in the pdf bookmarks,
% however we wish them to appear as chapters in the TOC. Thus we define an
% alternative to |\maketitle| for reviews.
%\newcommand{\review}[1]{
% \pdfbookmark[1]{#1}{#1}
% \section*{#1}
% \addtocontents{toc}{\protect\contentsline{chapter}{#1}{\thepage}{#1.1}}
%}
% We want bibliographies as starred sections within articles.
%
%\RequirePackage[sectionbib,round]{natbib}
%\bibliographystyle{abbrvnat}
% Equations, figures and tables are counted within articles, but we do
% not show the article number. For equations it becomes a bit messy to avoid
% having hyperref getting it wrong.
% \numberwithin{equation}{chapter}
%\renewcommand{\theequation}{\@arabic\c@equation}
%\renewcommand{\thefigure}{\@arabic\c@figure}
%\renewcommand{\thetable}{\@arabic\c@table}
% Issue layout -----------------------------------------------------------------
% Need to provide our own version of |\tableofcontents|. We use the
% tikz package to get the rounded rectangle. Notice that |\section*|
% is really the same as |\chapter*|.
%\renewcommand{\contentsname}{Contents}
%\renewcommand\tableofcontents{%
% \vspace{1cm}
% \section*{\contentsname}
% { \@starttoc{toc} }
%}
%
%\renewcommand{\titlepage}{%
% \thispagestyle{empty}
% \hypersetup{
% pdftitle={The R Journal Volume \RJ@volume/\RJ@number, \RJ@month \RJ@year},%
% pdfauthor={R Foundation for Statistical Computing},%
% }
% \noindent
% \begin{center}
% \fontsize{50pt}{50pt}\selectfont
% The \raisebox{-8pt}{\includegraphics[height=77pt]{Rlogo-4}}\hspace{10pt}
% Journal
%
% \end{center}
% {\large \hfill Volume \RJ@volume/\RJ@number, \RJ@month{} \RJ@year \quad}
%
% \rule{\textwidth}{1pt}
% \begin{center}
% {\Large A peer-reviewed, open-access publication of the \\
% R Foundation for Statistical Computing}
% \end{center}
%
% % And finally, put in the TOC box. Note the way |tocdepth| is adjusted
% % before and after producing the TOC: thus, we can ensure that only
% % articles show up in the printed TOC, but that in the PDF version,
% % bookmarks are created for sections and subsections as well (provided
% % that the non-starred forms are used).
% \setcounter{tocdepth}{0}
% \tableofcontents
% \setcounter{tocdepth}{2}
% \clearpage
%}
% Text formatting --------------------------------------------------------------
\newcommand{\R}{R}
\newcommand{\address}[1]{\addvspace{\baselineskip}\noindent\emph{#1}}
\newcommand{\email}[1]{\href{mailto:#1}{\normalfont\texttt{#1}}}
% Simple font selection is not good enough. For example, |\texttt{--}|
% gives `\texttt{--}', i.e., an endash in typewriter font. Hence, we
% need to turn off ligatures, which currently only happens for commands
% |\code| and |\samp| and the ones derived from them. Hyphenation is
% another issue; it should really be turned off inside |\samp|. And
% most importantly, \LaTeX{} special characters are a nightmare. E.g.,
% one needs |\~{}| to produce a tilde in a file name marked by |\file|.
% Perhaps a few years ago, most users would have agreed that this may be
% unfortunate but should not be changed to ensure consistency. But with
% the advent of the WWW and the need for getting `|~|' and `|#|' into
% URLs, commands which only treat the escape and grouping characters
% specially have gained acceptance
\DeclareRobustCommand\code{\bgroup\@noligs\@codex}
\def\@codex#1{\texorpdfstring%
{{\normalfont\ttfamily\hyphenchar\font=-1 #1}}%
{#1}\egroup}
\newcommand{\kbd}[1]{{\normalfont\texttt{#1}}}
\newcommand{\key}[1]{{\normalfont\texttt{\uppercase{#1}}}}
\DeclareRobustCommand\samp{`\bgroup\@noligs\@sampx}
\def\@sampx#1{{\normalfont\texttt{#1}}\egroup'}
\newcommand{\var}[1]{{\normalfont\textsl{#1}}}
\let\env=\code
\newcommand{\file}[1]{{`\normalfont\textsf{#1}'}}
\let\command=\code
\let\option=\samp
\newcommand{\dfn}[1]{{\normalfont\textsl{#1}}}
% \acronym is effectively disabled since not used consistently
\newcommand{\acronym}[1]{#1}
\newcommand{\strong}[1]{\texorpdfstring%
{{\normalfont\fontseries{b}\selectfont #1}}%
{#1}}
\let\pkg=\strong
\newcommand{\CRANpkg}[1]{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}%
\let\cpkg=\CRANpkg
\newcommand{\ctv}[1]{\href{http://CRAN.R-project.org/view=#1}{\emph{#1}}}
\newcommand{\BIOpkg}[1]{\href{http://www.bioconductor.org/packages/release/bioc/html/#1.html}{\pkg{#1}}}
% Example environments ---------------------------------------------------------
\RequirePackage{fancyvrb}
\RequirePackage{alltt}
\DefineVerbatimEnvironment{example}{Verbatim}{}
\renewenvironment{example*}{\begin{alltt}}{\end{alltt}}
% Support for output from Sweave, and generic session style code
% These used to have fontshape=sl for Sinput/Scode/Sin, but pslatex
% won't use a condensed font in that case.
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{Sin}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{Sout}{Verbatim}{fontsize=\small}
\newenvironment{Schunk}{}{}
% Mathematics ------------------------------------------------------------------
% The implementation of |\operatorname| is similar to the mechanism
% \LaTeXe{} uses for functions like sin and cos, and simpler than the
% one of \AmSLaTeX{}. We use |\providecommand| for the definition in
% order to keep the one of the \pkg{amstex} if this package has
% already been loaded.
% \begin{macrocode}
\providecommand{\operatorname}[1]{%
\mathop{\operator@font#1}\nolimits}
\RequirePackage{amsfonts}
\renewcommand{\P}{%
\mathop{\operator@font I\hspace{-1.5pt}P\hspace{.13pt}}}
\newcommand{\E}{%
\mathop{\operator@font I\hspace{-1.5pt}E\hspace{.13pt}}}
\newcommand{\VAR}{\operatorname{var}}
\newcommand{\COV}{\operatorname{cov}}
\newcommand{\COR}{\operatorname{cor}}
% Figures ----------------------------------------------------------------------
\RequirePackage[font=small,labelfont=bf]{caption}
% Wide environments for figures and tables -------------------------------------
\RequirePackage{environ}
% An easy way to make a figure span the full width of the page
\NewEnviron{widefigure}[1][]{
\begin{figure}[#1]
\advance\leftskip-2cm
\begin{minipage}{\dimexpr\textwidth+4cm\relax}%
\captionsetup{margin=2cm}
\BODY
\end{minipage}%
\end{figure}
}
\NewEnviron{widetable}[1][]{
\begin{table}[#1]
\advance\leftskip-2cm
\begin{minipage}{\dimexpr\textwidth+4cm\relax}%
\captionsetup{margin=2cm}
\BODY
\end{minipage}%
\end{table}
}