Skip to content

Commit 21f550e

Browse files
Flesh out template
1 parent 0d8b7d3 commit 21f550e

File tree

8 files changed

+193
-29
lines changed

8 files changed

+193
-29
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.DS_Store
2+
.Rproj.user

.quartoignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Add files / folder that are useful to your repo
22
# but should not be in the downloaded bundle after `quarto use template`
3-
style-guide
3+
style-guide
4+
quarto-arxiv.Rproj

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# ArXiv Template
22

3-
This is a Quarto template that assists you in creating PDF outputs which closely match those published on arXiv. If you are intending to publish your article on arXiv, it is highly recommended you upload your TeX files (and supporting files, including generated `.bbl` and figure files) directly. However, this template supports rendering PDFs which resemble arXiv preprints for upload to other repositories either before or instead of submission to arXiv itself.
3+
This is a Quarto template that assists you in creating PDF outputs which closely match the arXiv template for the rticles package. If you are intending to publish your article on arXiv, it is highly recommended you upload your TeX files (and supporting files, including generated `.bbl` and figure files) directly. However, this template supports rendering decent looking PDFs for upload to other repositories either before or instead of submission to arXiv itself.
44

5-
There are currently a few differences between the PDFs generated by this template and those generated by arXiv:
5+
There are currently a few differences between the PDFs generated by this template and those generated by the arXiv rticles template:
66

77
1. The fonts and spacings are not a perfect match. PRs to fix this are more than welcome.
8-
2. ORCiD IDs will be rendered as clickable logos next to author names.
9-
3. Emails will be displayed as hyperlinks, not in monospaced fonts.
8+
2. References and links are not currently hyperlinked. PRs to fix this also more than welcome.
9+
3. ORCiD IDs will be rendered as clickable logos next to author names. This is an intentional change.
10+
4. Emails will be displayed as hyperlinks, and not in monospaced font. This is also intentional.
1011

1112
Any other differences are unintentional bugs -- please open an issue about anything you encounter!
1213

1314
## Creating a New Article
1415

15-
You can use this as a template to create a preprint for ArXiv. To do this, use the following command:
16+
You can use this as a template to create a new article. To do this, use the following command:
1617

1718
```bash
1819
quarto use template mikemahoney218/quarto-arxiv
@@ -45,4 +46,4 @@ format:
4546
keep-tex: true
4647
```
4748
48-
You can view a preview of the rendered template at <https://mikemahoney218.github.io/quarto-arxiv/template.pdf>.
49+
You can view a preview of the rendered template at <https://mikemahoney218.github.io/quarto-arxiv/template.pdf> (PDF output) and <https://mikemahoney218.github.io/quarto-arxiv/template> (HTML output).

_extensions/arxiv/_extension.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
title: ArXiV Template
22
author: Mike Mahoney
3-
version: 0.1.2
3+
version: 0.1.3
44
contributes:
55
formats:
66
common:
77
# define below YAML configuration common to all formats
88
# filters:
9-
# You can include here Lua filters from your extension format
9+
# You can include here Lua filters from your extension format
1010
shortcodes:
1111
# You can include here Lua filters defining shortcodes from your extension
1212
- shortcodes.lua
@@ -20,7 +20,6 @@ contributes:
2020
# Content to add in header that your format is using
2121
header-includes: |
2222
\usepackage{arxiv}
23-
\usepackage{hyperref}
2423
\usepackage{orcidlink}
2524
\usepackage{amsmath}
2625
\usepackage[T1]{fontenc}

bibliography.bib

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
@book{CameronTrivedi2013,
2-
author = {A. Colin Cameron and Pravin K. Trivedi},
3-
title = {Regression Analysis of Count Data},
4-
year = {2013},
5-
edition = {2nd},
6-
publisher = {Cambridge University Press},
7-
address = {Cambridge}
8-
}
1+
@Book{wickham2015,
2+
author = {Wickham, Hadley},
3+
title = {R Packages},
4+
year = {2015},
5+
isbn = {1491910593, 9781491910597},
6+
edition = {1st},
7+
publisher = {O'Reilly Media, Inc.},
8+
}
9+
@article{knuth1984,
10+
title={Literate programming},
11+
author={Knuth, Donald E.},
12+
journal={The Computer Journal},
13+
volume={27},
14+
number={2},
15+
pages={97--111},
16+
year={1984},
17+
publisher={British Computer Society}
18+
}

quarto-arxiv.Rproj

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
AutoAppendNewline: Yes
16+
StripTrailingWhitespace: Yes

sunflower.png

203 KB
Loading

template.qmd

+147-11
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,21 @@ bibliography: bibliography.bib
3434

3535
# Introduction {#sec-intro}
3636

37-
This is an example of how to use this template to render articles in the standard arXiv format.
37+
This is an example of how to use this template to render journal articles. This template is inspired by the arXiv rticles template for rmarkdown, repurposed for the Quarto publishing system.
3838

39-
This quarto extension format supports PDF and HTML outputs. `quarto-journals` is aiming at porting existing {{< latex >}} template from journals to be used with quarto. PDF format is what require the most work to fit the journals guideline, but Quarto offer a nice rendering for HTML output too. This template only uses basic HTML format without any customization for now.
39+
This quarto extension format supports PDF and HTML outputs. This template is primarily focused on generating acceptable {{< latex >}} outputs from Quarto, but renders an acceptable HTML output using the standard Quarto options.
4040

41-
# Demo of some features found in this demo journal template
41+
# Quarto
4242

43-
## Shortcode demo {#sec-shortcode}
43+
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
4444

45-
PDF are rendered using {{< latex >}} but it is best if one can use a Markdown syntax for cross format support.
45+
# Running Code
4646

47-
## Code chunk {#sec-chunks}
47+
When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
48+
49+
```{r}
50+
1 + 1
51+
```
4852

4953
This format hide chunks by default:
5054

@@ -60,22 +64,154 @@ But you can set `echo` option to `true` locally in the chunk:
6064

6165
```{r}
6266
#| echo: true
67+
#| label: tbl-glm
6368
#| tbl-cap: "A table."
6469
6570
# install.packages("broom")
6671
# install.packages("kableExtra")
6772
m_pois <- glm(Days ~ (Eth + Sex + Age + Lrn)^2, data = quine, family = poisson)
68-
kableExtra::kbl(broom::tidy(m_pois))
73+
kableExtra::kable_styling(
74+
kableExtra::kbl(broom::tidy(m_pois))
75+
)
76+
```
77+
78+
79+
# Markdown Basics
80+
81+
This section of the template is adapted from [Quarto's documentation on Markdown basics](https://quarto.org/docs/authoring/markdown-basics.html).
82+
83+
## Text Formatting
84+
85+
+-----------------------------------+-------------------------------+
86+
| Markdown Syntax | Output |
87+
+===================================+===============================+
88+
| *italics* and **bold** | *italics* and **bold** |
89+
+-----------------------------------+-------------------------------+
90+
| superscript^2^ / subscript~2~ | superscript^2^ / subscript~2~ |
91+
+-----------------------------------+-------------------------------+
92+
| ~~strikethrough~~ | ~~strikethrough~~ |
93+
+-----------------------------------+-------------------------------+
94+
| `verbatim code` | `verbatim code` |
95+
+-----------------------------------+-------------------------------+
96+
97+
## Headings {#headings}
98+
99+
+---------------------+-----------------------------------+
100+
| Markdown Syntax | Output |
101+
+=====================+===================================+
102+
| # Header 1 | # Header 1 {.heading-output} |
103+
+---------------------+-----------------------------------+
104+
| ## Header 2 | ## Header 2 {.heading-output} |
105+
+---------------------+-----------------------------------+
106+
| ### Header 3 | ### Header 3 {.heading-output} |
107+
+---------------------+-----------------------------------+
108+
109+
## Equations
110+
111+
Use `$` delimiters for inline math and `$$` delimiters for display math. For example:
112+
113+
+-------------------------------+-------------------------+
114+
| Markdown Syntax | Output |
115+
+===============================+=========================+
116+
| inline math: $E = mc^{2}$ | inline math: $E=mc^{2}$ |
117+
+-------------------------------+-------------------------+
118+
| display math: | display math:\ |
119+
| | $$E = mc^{2}$$ |
120+
| $$E = mc^{2}$$ | |
121+
+-------------------------------+-------------------------+
122+
123+
If assigned an ID, display math equations will be automatically numbered:
124+
125+
$$
126+
\frac{\partial \mathrm C}{ \partial \mathrm t } + \frac{1}{2}\sigma^{2} \mathrm S^{2}
127+
\frac{\partial^{2} \mathrm C}{\partial \mathrm C^2}
128+
+ \mathrm r \mathrm S \frac{\partial \mathrm C}{\partial \mathrm S}\ =
129+
\mathrm r \mathrm C
130+
$$ {#eq-black-scholes}
131+
132+
## Other Blocks
133+
134+
+-----------------------------+--------------------------+
135+
| Markdown Syntax | Output |
136+
+=============================+==========================+
137+
| > Blockquote | > Blockquote |
138+
+-----------------------------+--------------------------+
139+
| | Line Block | | Line Block |
140+
| | Spaces and newlines | | Spaces and newlines |
141+
| | are preserved | | are preserved |
142+
+-----------------------------+--------------------------+
143+
144+
## Cross-references {#sec-crf}
145+
146+
![A sunflower](sunflower.png){#fig-sunflower}
147+
148+
+---------------------------------------+---------------------------------+
149+
| Markdown Format | Output |
150+
+=======================================+=================================+
151+
| @fig-sunflower is pretty. | @fig-sunflower is pretty. |
152+
+---------------------------------------+---------------------------------+
153+
| @tbl-glm was created from code. | @tbl-glm was created from code. |
154+
+---------------------------------------+---------------------------------+
155+
| @sec-crf is this section. | @sec-crf is this section. |
156+
+---------------------------------------+---------------------------------+
157+
| @eq-black-scholes is above. | @eq-black-scholes is above. |
158+
+---------------------------------------+---------------------------------+
159+
160+
See the [Quarto documentation on cross-references for more](https://quarto.org/docs/authoring/cross-references.html).
161+
162+
163+
# Citations
164+
165+
This section of the template is adapted from the [Quarto citation documentation](https://quarto.org/docs/authoring/footnotes-and-citations.html).
166+
167+
Quarto supports bibliography files in a wide variety of formats including BibTeX and CSL. Add a bibliography to your document using the `bibliography` YAML metadata field. For example:
168+
169+
``` yaml
170+
---
171+
title: "My Document"
172+
bibliography: references.bib
173+
---
69174
```
70175
71-
## Using references
176+
See the [Pandoc Citations](https://pandoc.org/MANUAL.html#citations) documentation for additional information on bibliography formats.
72177
73-
I did not read this book [@CameronTrivedi2013] but it must be interesting.
178+
## Citation Syntax {#sec-citations}
179+
180+
Quarto uses the standard Pandoc markdown representation for citations. Here are some examples:
181+
182+
+-------------------------------------------+---------------------------------------------------------------------+
183+
| Markdown Format | Output |
184+
+===========================================+=====================================================================+
185+
| Blah Blah [see @knuth1984, pp. 33-35; | Blah Blah [see @knuth1984, pp. 33-35; also @wickham2015, chap. 1] |
186+
| also @wickham2015, chap. 1] | |
187+
+-------------------------------------------+---------------------------------------------------------------------+
188+
| Blah Blah [@knuth1984, pp. 33-35, | Blah Blah [@knuth1984, pp. 33-35, 38-39 and passim] |
189+
| 38-39 and passim] | |
190+
+-------------------------------------------+---------------------------------------------------------------------+
191+
| Blah Blah [@wickham2015; @knuth1984]. | Blah Blah [@wickham2015; @knuth1984]. |
192+
+-------------------------------------------+---------------------------------------------------------------------+
193+
| Wickham says blah [-@wickham2015] | Wickham says blah [-@wickham2015] |
194+
+-------------------------------------------+---------------------------------------------------------------------+
195+
| @knuth1984 says blah. | @knuth1984 says blah. |
196+
+-------------------------------------------+---------------------------------------------------------------------+
197+
| @knuth1984 [p. 33] says blah. | @knuth1984 [p. 33] says blah. |
198+
+-----------------------------------+-----------------------------------------------------------------------------+
199+
200+
See the [Pandoc Citations](https://pandoc.org/MANUAL.html#citations) documentation for additional information on citation syntax.
201+
202+
To provide a custom citation stylesheet, provide a path to a CSL file using the `csl` metadata field in your document, for example:
203+
204+
``` yaml
205+
---
206+
title: "My Document"
207+
bibliography: references.bib
208+
csl: nature.csl
209+
---
210+
```
74211
75212
{{< pagebreak >}}
76213
77214
# References {.unnumbered}
78215
79-
:::{#refs}
80-
216+
::: {#refs}
81217
:::

0 commit comments

Comments
 (0)