Skip to content

Commit ac55e55

Browse files
Add TRB Article Template (#427)
Co-authored-by: Christophe Dervieux <cderv@rstudio.com>
1 parent 2975396 commit ac55e55

File tree

13 files changed

+517
-3
lines changed

13 files changed

+517
-3
lines changed

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: rticles
22
Type: Package
33
Title: Article Formats for R Markdown
4-
Version: 0.21.2
4+
Version: 0.21.3
55
Authors@R: c(
66
person("JJ", "Allaire", role = "aut", email = "jj@rstudio.com"),
77
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
@@ -46,6 +46,7 @@ Authors@R: c(
4646
person('Jay', 'Hesselberth', role = c('aut', 'ctb'), email = 'jay.hesselberth@gmail.com', comment = c(ORCID = '0000-0002-6299-179X')),
4747
person("Alfredo", "Hernández", role = c("ctb"), email = "aldomann.designs@gmail.com", comment = c(ORCID = "0000-0002-2660-4545")),
4848
person("Stefano", "Coretta", role = c("ctb"), email = "stefano.coretta@gmail.com", comment = c(ORCID = "0000-0001-9627-5532", github = "stefanocoretta")),
49+
person("Greg", "Macfarlane", role = c("ctb"), email = "gregmacfarlane@gmail.com", comment = c(github = "gregmacfarlane")),
4950
person("Matthias", "Templ", role = c("ctb"), email = "matthias.templ@gmail.com", comment = c(ORCID = "0000-0002-8638-5276", github = "matthias-da")),
5051
person("Alvaro", "Uzaheta", role = c("ctb"), email = "alvaro.uzaheta@gess.ethz.ch", comment = c(github = "auzaheta")),
5152
person("JooYoung", "Seo", role=c("ctb"), email="jseo1005@illinois.edu", comment = c(ORCID = "0000-0002-4064-6012"))
@@ -57,7 +58,7 @@ Imports: utils, rmarkdown (>= 2.5), knitr (>= 1.30), yaml, tinytex (>= 0.30), xf
5758
SystemRequirements: GNU make
5859
URL: https://github.com/rstudio/rticles
5960
BugReports: https://github.com/rstudio/rticles/issues
60-
RoxygenNote: 7.1.1
61+
RoxygenNote: 7.1.2
6162
Suggests: testit, bookdown, xtable
6263
Encoding: UTF-8
6364
Config/Needs/website: magick, pdftools, gifski, rstudio/quillt

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export(sage_article)
4040
export(sim_article)
4141
export(springer_article)
4242
export(tf_article)
43+
export(trb_article)
4344
importFrom(rmarkdown,includes_to_pandoc_args)
4445
importFrom(rmarkdown,knitr_options)
4546
importFrom(rmarkdown,output_format)

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
- Update Copernicus Publications template to version 6.4 from 2021-08-16 (thanks, @RLumSK, #446).
44

55
- `sage_article()` now correctly set cite style in template to use comma to match the Sage Havard style per Journal's guideline (thanks, @MalteHueckstaedt, #447).
6-
6+
7+
- Add `trb_article()` for annual meeting submissions to the Transportation Research Board Annual Meeting (thanks, @gregmacfarlane, #427).
8+
79
# rticles 0.21
810

911
## NEW FEATURES

R/article.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,15 @@ tf_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
440440
"tf", keep_tex = keep_tex, citation_package = citation_package, ...
441441
)
442442
}
443+
444+
#' @section \code{trb_article}: Format for creating submissions to the Transportation
445+
#' Research Board Annual Meeting. Adapted from
446+
#' \samp{https://www.overleaf.com/latex/templates/transportation-research-board-trb-latex-template/jkfndnnkkksw},
447+
#' which in turn is hosted at \samp{https://github.com/chiehrosswang/TRB_LaTeX_tex}
448+
#' @export
449+
#' @rdname article
450+
trb_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
451+
pdf_document_format(
452+
"trb", keep_tex = keep_tex, citation_package = citation_package, ...
453+
)
454+
}

README.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Currently included templates and their contributors are the following:
8080
| [SIM: Statistics in Medicine](https://onlinelibrary.wiley.com/journal/10970258) | [\@ellessenne](https://github.com/ellessenne)| [\#231](https://github.com/rstudio/rticles/pull/231) | `sim_article()`|
8181
| [Taylor & Francis](https://www.tandfonline.com/)| [\@dleutnant](https://github.com/dleutnant)| [\#218](https://github.com/rstudio/rticles/pull/218) | `tf_article()` |
8282
| [The R Journal](https://journal.r-project.org/) ||| `rjournal_article()` |
83+
| [TRB](https://trb.secure-platform.com/a/page/TRBPaperReview) | [@gregmacfarlane](https://github.com/gregmacfarlane) | [#427](https://github.com/rstudio/rticles/pull/427) | `trb_article()` |
8384

8485
You can also get the list of available journal names with `rticles::journals()`.
8586

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Currently included templates and their contributors are the following:
106106
| [SIM: Statistics in Medicine](https://onlinelibrary.wiley.com/journal/10970258) | [@ellessenne](https://github.com/ellessenne) | [#231](https://github.com/rstudio/rticles/pull/231) | `sim_article()` |
107107
| [Taylor & Francis](https://www.tandfonline.com/) | [@dleutnant](https://github.com/dleutnant) | [#218](https://github.com/rstudio/rticles/pull/218) | `tf_article()` |
108108
| [The R Journal](https://journal.r-project.org/) | | | `rjournal_article()` |
109+
| [TRB](https://trb.secure-platform.com/a/page/TRBPaperReview) | [@gregmacfarlane](https://github.com/gregmacfarlane) | [#427](https://github.com/rstudio/rticles/pull/427) | `trb_article()` |
109110

110111
You can also get the list of available journal names with
111112
`rticles::journals()`.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
% Repository: https://github.com/chiehrosswang/TRB_LaTeX_tex
2+
%
3+
% Transportation Research Board conference paper template
4+
% version 4.0 Lite (updates made to be compatible in Overleaf and ShareLaTeX)
5+
%
6+
%
7+
% When numbered option is activated, lines are numbered.
8+
\documentclass[$for(classoption)$$classoption$$sep$,$endfor$]{trbunofficial}
9+
\usepackage{graphicx}
10+
\usepackage{booktabs}
11+
12+
\newread\somefile
13+
\usepackage{xparse}
14+
$if(natbib)$
15+
\usepackage{natbib}
16+
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$unsrtnat$endif$}
17+
\setcitestyle{round}
18+
$endif$
19+
% \usepackage[colorlinks=true,linkcolor=blue,citecolor=blue]{hyperref}
20+
% For TRB version hide links
21+
\usepackage[hidelinks$for(hyperrefoptions)$,$hyperrefoptions$$endfor$]{hyperref}
22+
23+
% Put here what will go to headers as author
24+
\AuthorHeaders{$runningheader$}
25+
\title{$title$}
26+
27+
% TODO: add macros for easier formatting of \author.
28+
\author{%
29+
$for(author)$
30+
\textbf{$author.name$}\\$if(author.note)$\textit{$author.note$}\\$endif$
31+
$author.position$\\
32+
$author.affiliation$\\
33+
$author.email$\\
34+
\hfill\break
35+
$endfor$
36+
}
37+
38+
% Required by Pandoc
39+
\providecommand{\tightlist}{%
40+
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
41+
42+
% If necessary modify the number of words per table or figure default is set to
43+
% 250 words per table (default defined in cls)
44+
$if(wordspertable)$\WordsPerTable{$wordspertable$}$endif$
45+
46+
% If words are counted manually, put that number here. This does not include
47+
% figures and tables. This can also be used to avoid problems with texcount
48+
% program i.e. if one does not have it installed.
49+
$if(wordcount)$\TotalWords{$wordcount$}$endif$
50+
51+
$if(highlighting-macros)$
52+
% For Pandoc highlighting
53+
$highlighting-macros$
54+
$endif$
55+
56+
$if(csl-refs)$
57+
% Pandoc citation processing
58+
\newlength{\csllabelwidth}
59+
\setlength{\csllabelwidth}{3em}
60+
\newlength{\cslhangindent}
61+
\setlength{\cslhangindent}{1.5em}
62+
% for Pandoc 2.8 to 2.10.1
63+
\newenvironment{cslreferences}%
64+
{$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
65+
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
66+
{\par}
67+
% For Pandoc 2.11+
68+
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
69+
{% don't indent paragraphs
70+
\setlength{\parindent}{0pt}
71+
% turn on hanging indent if param 1 is 1
72+
\ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
73+
% set entry spacing
74+
\ifnum #2 > 0
75+
\setlength{\parskip}{#2\baselineskip}
76+
\fi
77+
}%
78+
{}
79+
\usepackage{calc} % for calculating minipage widths
80+
\newcommand{\CSLBlock}[1]{#1\hfill\break}
81+
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
82+
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
83+
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
84+
$endif$
85+
86+
$for(header-includes)$
87+
% Pandoc feature
88+
$header-includes$
89+
$endfor$
90+
91+
\begin{document}
92+
\maketitle
93+
94+
$for(include-before)$
95+
$include-before$
96+
$endfor$
97+
98+
\section{Abstract}
99+
$abstract$
100+
\hfill\break%
101+
\hfill\break%
102+
\noindent\textit{Keywords}: $if(keywords)$ $for(keywords)$$keywords$, $endfor$ $endif$
103+
\newpage
104+
105+
$body$
106+
107+
\newpage
108+
$if(natbib)$
109+
$if(bibliography)$
110+
$if(biblio-title)$
111+
$if(book-class)$
112+
\renewcommand\bibname{$biblio-title$}
113+
$else$
114+
\renewcommand\refname{$biblio-title$}
115+
$endif$
116+
$endif$
117+
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
118+
119+
$endif$
120+
$endif$
121+
122+
$for(include-after)$
123+
$include-after$
124+
125+
$endfor$
126+
\end{document}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@article{Dirac1953888,
2+
title = "The lorentz transformation and absolute time",
3+
journal = "Physica ",
4+
volume = "19",
5+
number = "1-–12",
6+
pages = "888--896",
7+
year = "1953",
8+
doi = "10.1016/S0031-8914(53)80099-6",
9+
author = "P.A.M. Dirac"
10+
}
11+
12+
@article{Feynman1963118,
13+
title = "The theory of a general quantum system interacting with a linear dissipative system",
14+
journal = "Annals of Physics ",
15+
volume = "24",
16+
pages = "118--173",
17+
year = "1963",
18+
doi = "10.1016/0003-4916(63)90068-X",
19+
author = "R.P Feynman and F.L {Vernon Jr.}"
20+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
title: An Rticles Template for the Transport Research Board Annual Meeting
3+
runningheader: "Anonymous, Security, and Zoolander"
4+
author:
5+
- name: Alice Anonymous
6+
note: Corresponding Author
7+
position: Graduate Student
8+
email: alice@example.com
9+
affiliation: Some Institute of Technology
10+
- name: Bob Security
11+
position: Assistant Professor
12+
email: bob@example.com
13+
affiliation: State University
14+
- name: Derek Zoolander
15+
position: Professor
16+
email: derek@example.com
17+
affiliation: Some Institute of Technology
18+
abstract: |
19+
The Transportation Research Board (TRB) has unique and seemingly arbitrary requirements for manuscripts submitted for review. These requirements make it difficult to write the manuscripts quickly, and no existing \LaTeX\ style comes close to fooling the guidelines. This represents an initial effort at creating a template to meet the requirements of TRB authors using \LaTeX, R, Sweave, and/or other literate programming software.
20+
21+
keywords: ["Transportation", "Travel Behavior"]
22+
bibliography: mybibfile.bib
23+
biblio-style: unsrtnat
24+
classoption:
25+
- numbered # When numbered option is activated, lines are numbered.
26+
output: rticles::trb_article
27+
wordcount: 684
28+
---
29+
30+
```{r setup, include = FALSE}
31+
knitr::opts_chunk$set(echo = FALSE)
32+
```
33+
34+
35+
# Transportation Research Board Annual Meetings
36+
37+
TRB has greatly simplified the submissions to its system, meaning that this
38+
template is no longer strictly required. However, there is a typical format
39+
that most people still use by default, and this template implements that change.
40+
41+
42+
# Features
43+
44+
The template has a number of features that enable quick and painless manuscript authoring.
45+
46+
## Mathematics
47+
48+
Standard pandoc / \LaTeX math environments are available. For example, the
49+
probability of an individual choosing alternative $i$ in a multinomial logit
50+
model is
51+
\begin{equation}
52+
P_i = \frac{exp(V_i)}{\sum_{i, j \in J}exp(V_j)} \label{eq:mnl}
53+
\end{equation}
54+
Equations with a `\label{eq:label}` can be referred to later in the text with
55+
`\ref{eq:label}`, such as Equation \ref{eq:mnl}.
56+
57+
## Title Page
58+
59+
The template will automatically create a title page with the authors in the
60+
listed order. Near the bottom of the title page, TRB requires a count of the manuscript's
61+
words and tables. The YAML header information contains a `wordcount` key where
62+
this can be encoded. The number of tables is counted automatically on build;
63+
a default 250 words per table can be overriden with the `wordspertable` YAML
64+
key.
65+
66+
The LaTeX template available from <https://github.com/chiehrosswang/TRB_LaTeX_tex>
67+
contain automatic word counters that have not been implemented in this `rticles`
68+
template. Authors can use the R Studio word count add-in available from
69+
<https://github.com/benmarwick/wordcountaddin>.
70+
71+
## Page Layout
72+
73+
The document has 1 inch margins as required, with the author's names in the left
74+
heading and the page number in the right. The running header information is set
75+
with the `runningheader` YAML key. Paragraphs leading sections and subsections
76+
are not indented, while all subsequent paragraphs in that section are. Section
77+
heading types are defined as outlined by the old TRB Author's Guide.
78+
79+
The document is single-spaced in 12 point Times font. Times New Roman is a
80+
proprietary font and is therefore not available by installation in open-source
81+
software. While the differences between Times variants are negligible, Times New
82+
Roman itself can be used in Mac OSX by compiling under `xelatex`.
83+
84+
## Figure and Table references
85+
86+
The document can use standard pandoc referencing tools for in-text
87+
citations to figures and tables. If an R code chunk outputs a figure, the figure
88+
number can be referred to with `\@ref(fig:chunkname)` where `chunkname` is the
89+
name of the chunk that prints the figure. For example, Figure \@ref(fig:figure-example)
90+
shows a default figure made by the R chunk below.
91+
92+
```{r figure-example, fig.cap="Generic plot.", echo = TRUE}
93+
# Generate some sample data, then compute mean and standard deviation
94+
# in each group
95+
Speed <- cars$speed
96+
Distance <- cars$dist
97+
plot(Speed, Distance,
98+
panel.first = lines(stats::lowess(Speed, Distance), lty = "dashed"),
99+
pch = 0, cex = 1.2, col = "blue")
100+
```
101+
102+
The template setup chunk sets `echo = FALSE` for the entire document, as printing
103+
code listings would not usually be appropriate or needed for a TRB article. But
104+
the option is there!
105+
106+
The same referencing logic works for tables, with the `tab:` prefix on the
107+
chunk name instead of `fig:` used for figures. Table \@ref(tab:table-example)
108+
has a basic table. We recommend the `kableExtra` package for formatting
109+
publication-ready tables with greater control than the default `knitr::kable()`
110+
function.
111+
112+
```{r table-example}
113+
knitr::kable(mtcars[1:5, 1:6], format = "latex", table.envir = "table",
114+
booktabs = TRUE, caption = "Example Table")
115+
```
116+
117+
118+
## Bibliography styles
119+
120+
TRB still wants numbered, unsorted citations beginning on a new page. The
121+
template is configured to use `natbib` with the `unsrtnat` citation style, with
122+
some additional logic to use parentheses instead of brackets. The YAML key
123+
`bibliostyle` will allow the authors to select a different citation format, but
124+
this is not recommended at the moment. Citations use the pandoc logic. Including
125+
the reference in brackets `[@reference]` will print only the numeric reference;
126+
e.g. [@Feynman1963118; @Dirac1953888]. Including the reference without brackets
127+
`@reference` will print the authors and then the numeric reference; e.g.
128+
@Feynman1963118.
129+
130+
# Author Contribution Statement
131+
132+
The authors confirm contribution to the paper as follows: study conception and
133+
design: A. Anonymous, D. Zoolander; data collection: B. Security; analysis and
134+
interpretation of results: A. Anonymous, B. Security; draft manuscript
135+
preparation: A. Anonymous. All authors reviewed the results and approved
136+
the final version of the manuscript.
137+
138+
# Acknowledgements
139+
140+
David Pritchard posted the original versions of this template in 2009 and
141+
updated it in 2011, soon after TRB began allowing PDF submissions. Gregory
142+
Macfarlane and Ross Wang made adjustments to the template, and Ross Wang now
143+
maintains the \LaTeX template at
144+
<https://github.com/chiehrosswang/TRB_LaTeX_tex>. Gregory Macfarlane created the `rticles` template in 2021.
145+
146+
147+
# References {#references }

0 commit comments

Comments
 (0)