-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.tex
433 lines (379 loc) · 13.5 KB
/
template.tex
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
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
%
\documentclass[
Afour,
times,
sageh]{sagej}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math} % this also loads fontspec
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\ifPDFTeX\else
% xetex/luatex font selection
\fi
\usepackage[T1]{fontenc}
\usepackage{helvet}
\renewcommand\familydefault{\sfdefault}
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Make \paragraph and \subparagraph free-standing
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\usepackage{siunitx}
\newcolumntype{d}{S[
input-open-uncertainty=,
input-close-uncertainty=,
parse-numbers = false,
table-align-text-pre=false,
table-align-text-post=false
]}
\makeatletter
\makeatother
\makeatletter
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\AtBeginDocument{%
\ifdefined\contentsname
\renewcommand*\contentsname{Table of contents}
\else
\newcommand\contentsname{Table of contents}
\fi
\ifdefined\listfigurename
\renewcommand*\listfigurename{List of Figures}
\else
\newcommand\listfigurename{List of Figures}
\fi
\ifdefined\listtablename
\renewcommand*\listtablename{List of Tables}
\else
\newcommand\listtablename{List of Tables}
\fi
\ifdefined\figurename
\renewcommand*\figurename{Figure}
\else
\newcommand\figurename{Figure}
\fi
\ifdefined\tablename
\renewcommand*\tablename{Table}
\else
\newcommand\tablename{Table}
\fi
}
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{ruled}
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\@ifpackageloaded{subcaption}{}{\usepackage{subcaption}}
\makeatother
\makeatletter
\@ifpackageloaded{tcolorbox}{}{\usepackage[skins,breakable]{tcolorbox}}
\makeatother
\makeatletter
\@ifundefined{shadecolor}{\definecolor{shadecolor}{rgb}{.97, .97, .97}}
\makeatother
\makeatletter
\makeatother
\makeatletter
\makeatother
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\usepackage[]{natbib}
\bibliographystyle{SageH}
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
pdftitle={A Quarto extension for Sage journals},
pdfauthor={Chris Hanretty; Mustrum Ridcully},
pdfkeywords={template, demo},
colorlinks=true,
linkcolor={blue},
filecolor={Maroon},
citecolor={Blue},
urlcolor={Blue},
pdfcreator={LaTeX via pandoc}}
\usepackage{float}
\makeatletter
\let\oldlt\longtable
\let\endoldlt\endlongtable
\def\longtable{\@ifnextchar[\longtable@i \longtable@ii}
\def\longtable@i[#1]{\begin{figure}[H]
\onecolumn
\begin{minipage}{\columwidth}
\oldlt[#1]
}
\def\longtable@ii{\begin{figure}[H]
\onecolumn
\begin{minipage}{\columwidth}
\oldlt
}
\def\endlongtable{\endoldlt
\end{minipage}
\twocolumn
\end{figure}}
\makeatother
\title{A Quarto extension for Sage journals}
\author{Chris Hanretty\affilnum{1} and Mustrum Ridcully\affilnum{2}}
\affiliation{
\affilnum{1} Royal Holloway, University of London, Department of
Politics, International Relations and Philosophy \\
\affilnum{2} Unseen University, Arch-Chancellory \\
}
\corrauth{Dept. of Politics, International Relations and Philosophy,
Royal Holloway, University of London. McCrea 1-08, Egham TW20 0EX,
United Kingdom.}
\email{[email protected]}
\begin{abstract}
This document is a template for the sagej extension. It also documents
the extension itself, and discusses common usage options.
\end{abstract}
\keywords{template, demo}
\def\journalname{My SAGE Journal}
\begin{document}
\maketitle
\maketitle
\begin{abstract}
This document is a template for the sagej extension. It also documents
the extension itself, and discusses common usage options.
\end{abstract}
\ifdefined\Shaded\renewenvironment{Shaded}{\begin{tcolorbox}[breakable, frame hidden, borderline west={3pt}{0pt}{shadecolor}, sharp corners, interior hidden, boxrule=0pt, enhanced]}{\end{tcolorbox}}\fi
\hypertarget{sec-intro}{%
\section{Introduction}\label{sec-intro}}
SAGE Publishing publishes more than 1,000 journals. The company has
developed a \LaTeX{} template for its journals. This template can be
found at
\href{https://uk.sagepub.com/sites/default/files/sage_latex_template_4.zip}{the
official site} or via
\href{https://www.overleaf.com/latex/templates/tagged/sage}{Overleaf}.
Although the provision of a \LaTeX{} template can reduce the time spent
preparing a manuscript, this template needs to be reworked in order to
work with other document production systems which sit on top of \LaTeX{}
and make \LaTeX{} more user-friendly. Quarto is one such system. This
document describes a SAGE template for Quarto which builds upon the
existing \LaTeX{} template.
I have produced this template for my own use, and I cannot make any
guarantees about its reliability or suitability for your needs. I have
tested it for a submission I am preparing, but have not tested it beyond
that. I note some limitations below, some of which relate to the
underlying LaTeX template, and some of which are specific to the
interaction of Quarto and LaTeX.
\hypertarget{what-you-need-to-know}{%
\section{What you need to know}\label{what-you-need-to-know}}
When creating a document you will typically want to list a title and one
or more authors. Although the specification of author details in Quarto
can be complicated, this template does not use all of that complexity,
and uses only the \texttt{affiliations} and \texttt{email} fields.
``Corresponding authors'', for whom a full contact details are printed,
have an additional \texttt{note} attribute.
Other common fields (\texttt{abstract}, \texttt{thanks},
\texttt{keywords} and \texttt{bibliography}) are also supported. Thanks
appear at the end of the document.
\hypertarget{class-options}{%
\subsection{Class options}\label{class-options}}
The default class options will work for many journals. However, some
journals may require further customization. The SAGE journal class
allows for several different options relating to paper size and
formatting style. The options for page size are:
\begin{itemize}
\tightlist
\item
\texttt{shortAfour} {[}210 x 280mm, 10pt, two-column{]}
\item
\texttt{Afour} {[}210 x 297mm, 10pt, , two-column{]}
\item
\texttt{MCfour} {[}189 x 246mm, 10pt, , two-column{]}
\item
\texttt{PCfour} {[}170 x 242mm, 10pt, , two-column{]}
\item
\texttt{Royal} {[}156 x 234mm, 10pt, single-column{]}
\item
\texttt{Crown} {[}7.25 x 9.5in, 10pt, single-column{]}
\item
\texttt{Review} {[}156 x 234mm, 12pt, single-column{]}
\end{itemize}
The options for bibliography are:
\begin{itemize}
\tightlist
\item
\texttt{sageh} (SAGE Harvard style (author-year))
\item
\texttt{sagev} (SAGE Vancour style (superscript numbers))
\item
\texttt{sageapa} (APA style (author-year))
\end{itemize}
The default options are \texttt{Afour} and \texttt{sageh}. The document
class options shown in the template also specify \texttt{times}, which
sets the main font to Times New Roman and the section font to Helvetica.
Note that the double column option layout can be very cramped, and so
authors who use tables or figures may wish to take particular care in
formatting these. At the moment the default \texttt{longtable}
environment (used by Quarto to set most tables) is turned into a figure,
following a trick used for the Elsevier journals template.\footnote{See
\url{https://github.com/quarto-journals/elsevier}} This can lead to
sections of content disappeared as they are obscured by the figure
environment. This is a particular risk where tables appear on the first
page.
\hypertarget{details-of-implementation}{%
\subsection{Details of implementation}\label{details-of-implementation}}
The template follows some of the restrictions which apply to the
existing Sage template. The \LaTeX{} engine is set to pdflatex rather
than the more modern xelatex, and so some font features may not be
available. Similarly, \texttt{natbib} and bibliography style files
(\texttt{.bst}) are used to process references rather than more modern
systems which use CSL. References are otherwise unaffected
\citep{CameronTrivedi2013, hanretty2022party}.
Some features of the \LaTeX{} template -- author biographies,
declarations of competing interests, and funding declarations -- are not
supported.
\hypertarget{example-table}{%
\subsection{Example table}\label{example-table}}
Often authors want to use Quarto because it allows for literate
programming, and articles which change when the analysis changes. Here's
an example table put together with the modelsummary package
\citep{msummary}.
\hypertarget{tbl-modelsummary}{}
\begin{table}
\caption{\label{tbl-modelsummary}Modelsummary output }\tabularnewline
\centering
\begin{tabular}[t]{lcc}
\toprule
& OLS & Poisson\\
\midrule
(Intercept) & \num{7948.667} & \num{8.241}\\
& (\num{2078.276}) & (\num{0.006})\\
Literacy & \num{-39.121} & \num{0.003}\\
& (\num{37.052}) & (\num{0.000})\\
Clergy & \num{15.257} & \\
& (\num{25.735}) & \\
Commerce & & \num{0.011}\\
& & (\num{0.000})\\
\midrule
Num.Obs. & \num{86} & \num{86}\\
R2 & \num{0.020} & \\
R2 Adj. & \num{-0.003} & \\
AIC & \num{1740.8} & \num{274160.8}\\
BIC & \num{1750.6} & \num{274168.2}\\
Log.Lik. & \num{-866.392} & \num{-137077.401}\\
F & \num{0.866} & \num{18294.559}\\
RMSE & \num{5740.99} & \num{5491.61}\\
\bottomrule
\end{tabular}
\end{table}
Table support in two column layouts is extremely brittle, and you may
find that portions of content disappear when you are trying to fit
multiple tables in a single page.
\hypertarget{example-figure}{%
\subsection{Example figure}\label{example-figure}}
I also include an example figure, Figure~\ref{fig-literacy}. This figure
comes in one column output. This is achieved by setting the
\texttt{fig.env} option in the relevant R chunk. If you have a beautiful
gem of a figure which looks good in two-column mode, you need only
delete this line in the source code.
\begin{figure*}
{\centering \includegraphics{template_files/figure-pdf/fig-literacy-1.pdf}
}
\caption{\label{fig-literacy}Example figure using the same data}
\end{figure*}
\hypertarget{to-do}{%
\section{TO-DO}\label{to-do}}
\begin{itemize}
\tightlist
\item
Handle running headers
\item
Handle blinding (comment out for the moment)
\item
Handle other sections (funding, etc.,)
\end{itemize}
\hypertarget{copyright-statement}{%
\section{Copyright statement}\label{copyright-statement}}
The original \LaTeX{} class file is \copyright 2016 SAGE Publications
Ltd, 1 Oliver's Yard, 55 City Road, London, EC1Y 1SP, UK. All rights
reserved. Class files and bibiliographic style files are included for
this non-commercial use. This template may not be used on a commercial
basis.
\renewcommand\refname{References}
\bibliography{bibliography.bib}
\begin{acks}
This document based on the sagej.cls documentation prepared by
Alistair Smith and Hendrik Wittkopf.
\end{acks}
\end{document}