Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TRB Article Template #427

Merged
merged 52 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f887a26
Add trb export function
gregmacfarlane Jul 23, 2021
87e91a6
Start TRB template
gregmacfarlane Jul 23, 2021
ab9815c
Left-justify title
gregmacfarlane Jul 23, 2021
af22c70
Add pagewise line numbers
gregmacfarlane Jul 23, 2021
6be81df
Clean up new page
gregmacfarlane Jul 23, 2021
03c2b17
Change main font to Times New Roman
gregmacfarlane Jul 23, 2021
706fdaf
Fix unsorted nat bib template with parenthetical references.
gregmacfarlane Jul 23, 2021
0242d51
Move preprint information to first page.
gregmacfarlane Jul 23, 2021
5dd9ccd
Define correct provider file.
gregmacfarlane Jul 23, 2021
0ed6993
Replace elsarticle with trbarticle template completely
gregmacfarlane Jul 23, 2021
c0b2093
Start template
gregmacfarlane Jul 23, 2021
26261bc
Format authors
gregmacfarlane Jul 23, 2021
bcc1761
Make title case for title (not all-caps)
gregmacfarlane Jul 23, 2021
862fc2a
Fix word count, show example table and figure
gregmacfarlane Jul 23, 2021
590e262
Add TRB to REAME and news
gregmacfarlane Jul 23, 2021
9a48657
Add TRB to tests
gregmacfarlane Jul 23, 2021
45609b9
Add to authors
gregmacfarlane Jul 23, 2021
e14b430
Use base plot and knitr::kable()
gregmacfarlane Jul 26, 2021
5f44456
Add some notes
gregmacfarlane Jul 27, 2021
4eef8ae
Remove citation re-definition
gregmacfarlane Jul 27, 2021
5942021
Update NEWS.md
gregmacfarlane Oct 1, 2021
0e09c6d
Update README.md
gregmacfarlane Oct 1, 2021
ba912f7
Added link to Ross Wang's original repo
gregmacfarlane Oct 1, 2021
58f4f9d
Change name of trbarticle to trbunofficial
gregmacfarlane Oct 1, 2021
1735270
Update inst/rmarkdown/templates/trb/template.yaml
gregmacfarlane Oct 1, 2021
460f14c
Merge remote-tracking branch 'origin/master'
gregmacfarlane Oct 1, 2021
5fe094f
Change line numbering to class option
gregmacfarlane Oct 1, 2021
d5f5b53
Set natbib with default call to trb_article()
gregmacfarlane Oct 1, 2021
bfa9446
Fix dummy email
gregmacfarlane Oct 1, 2021
c6af40b
Make word count conditional
gregmacfarlane Oct 1, 2021
255a4b5
Add pandoc lists, highlights, and header insertions
gregmacfarlane Oct 1, 2021
a30d6e1
Update inst/rmarkdown/templates/trb/resources/template.tex
gregmacfarlane Oct 1, 2021
64f3e11
Merge remote-tracking branch 'origin/master'
gregmacfarlane Oct 1, 2021
66c95f9
enable multiple bib files
gregmacfarlane Oct 1, 2021
7dfcefd
Expose listing
gregmacfarlane Oct 8, 2021
7e96ef8
Change sections to use more standard markdown format
gregmacfarlane Oct 8, 2021
35461a5
Switch location of header
gregmacfarlane Oct 8, 2021
00ba650
Merge remote-tracking branch 'origin/master'
gregmacfarlane Oct 8, 2021
d561c1d
Simplify url handling
gregmacfarlane Oct 8, 2021
14ceb92
Handle words per table with default value.
gregmacfarlane Oct 8, 2021
ca391b6
Revisions to text of template, simplifying and clarifying
gregmacfarlane Oct 8, 2021
502c8cc
Merge branch 'master' into master
cderv Nov 25, 2021
42f37da
Add TRB back to README.Rmd
cderv Nov 25, 2021
fda31d8
Missing comma in DESCRIPTION
cderv Nov 25, 2021
b80d85d
Conditionnaly include author.note
cderv Nov 25, 2021
88607c3
Put include before in the place inside \begin{document}
cderv Nov 25, 2021
d272608
Add Pandoc CSL support in template to avoid issue in the future
cderv Nov 25, 2021
c152b64
Support `hyperrefoptions` Pandoc variable
cderv Nov 25, 2021
0410b67
Remove unused option
cderv Nov 25, 2021
20c99c7
Add space in template
cderv Nov 25, 2021
69904c3
Update roxygen and document
cderv Nov 25, 2021
199b1b0
Bump version
cderv Nov 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rticles
Type: Package
Title: Article Formats for R Markdown
Version: 0.21.2
Version: 0.21.3
Authors@R: c(
person("JJ", "Allaire", role = "aut", email = "jj@rstudio.com"),
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
Expand Down Expand Up @@ -46,6 +46,7 @@ Authors@R: c(
person('Jay', 'Hesselberth', role = c('aut', 'ctb'), email = 'jay.hesselberth@gmail.com', comment = c(ORCID = '0000-0002-6299-179X')),
person("Alfredo", "Hernández", role = c("ctb"), email = "aldomann.designs@gmail.com", comment = c(ORCID = "0000-0002-2660-4545")),
person("Stefano", "Coretta", role = c("ctb"), email = "stefano.coretta@gmail.com", comment = c(ORCID = "0000-0001-9627-5532", github = "stefanocoretta")),
person("Greg", "Macfarlane", role = c("ctb"), email = "gregmacfarlane@gmail.com", comment = c(github = "gregmacfarlane")),
person("Matthias", "Templ", role = c("ctb"), email = "matthias.templ@gmail.com", comment = c(ORCID = "0000-0002-8638-5276", github = "matthias-da")),
person("Alvaro", "Uzaheta", role = c("ctb"), email = "alvaro.uzaheta@gess.ethz.ch", comment = c(github = "auzaheta")),
person("JooYoung", "Seo", role=c("ctb"), email="jseo1005@illinois.edu", comment = c(ORCID = "0000-0002-4064-6012"))
Expand All @@ -57,7 +58,7 @@ Imports: utils, rmarkdown (>= 2.5), knitr (>= 1.30), yaml, tinytex (>= 0.30), xf
SystemRequirements: GNU make
URL: https://github.com/rstudio/rticles
BugReports: https://github.com/rstudio/rticles/issues
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Suggests: testit, bookdown, xtable
Encoding: UTF-8
Config/Needs/website: magick, pdftools, gifski, rstudio/quillt
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export(sage_article)
export(sim_article)
export(springer_article)
export(tf_article)
export(trb_article)
importFrom(rmarkdown,includes_to_pandoc_args)
importFrom(rmarkdown,knitr_options)
importFrom(rmarkdown,output_format)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
- Update Copernicus Publications template to version 6.4 from 2021-08-16 (thanks, @RLumSK, #446).

- `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).


- Add `trb_article()` for annual meeting submissions to the Transportation Research Board Annual Meeting (thanks, @gregmacfarlane, #427).

# rticles 0.21

## NEW FEATURES
Expand Down
12 changes: 12 additions & 0 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,15 @@ tf_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
"tf", keep_tex = keep_tex, citation_package = citation_package, ...
)
}

#' @section \code{trb_article}: Format for creating submissions to the Transportation
#' Research Board Annual Meeting. Adapted from
#' \samp{https://www.overleaf.com/latex/templates/transportation-research-board-trb-latex-template/jkfndnnkkksw},
#' which in turn is hosted at \samp{https://github.com/chiehrosswang/TRB_LaTeX_tex}
#' @export
#' @rdname article
trb_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
pdf_document_format(
"trb", keep_tex = keep_tex, citation_package = citation_package, ...
)
}
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Currently included templates and their contributors are the following:
| [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()`|
| [Taylor & Francis](https://www.tandfonline.com/)| [\@dleutnant](https://github.com/dleutnant)| [\#218](https://github.com/rstudio/rticles/pull/218) | `tf_article()` |
| [The R Journal](https://journal.r-project.org/) ||| `rjournal_article()` |
| [TRB](https://trb.secure-platform.com/a/page/TRBPaperReview) | [@gregmacfarlane](https://github.com/gregmacfarlane) | [#427](https://github.com/rstudio/rticles/pull/427) | `trb_article()` |

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

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Currently included templates and their contributors are the following:
| [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()` |
| [Taylor & Francis](https://www.tandfonline.com/) | [@dleutnant](https://github.com/dleutnant) | [#218](https://github.com/rstudio/rticles/pull/218) | `tf_article()` |
| [The R Journal](https://journal.r-project.org/) | | | `rjournal_article()` |
| [TRB](https://trb.secure-platform.com/a/page/TRBPaperReview) | [@gregmacfarlane](https://github.com/gregmacfarlane) | [#427](https://github.com/rstudio/rticles/pull/427) | `trb_article()` |

You can also get the list of available journal names with
`rticles::journals()`.
Expand Down
126 changes: 126 additions & 0 deletions inst/rmarkdown/templates/trb/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
% Repository: https://github.com/chiehrosswang/TRB_LaTeX_tex
%
% Transportation Research Board conference paper template
% version 4.0 Lite (updates made to be compatible in Overleaf and ShareLaTeX)
%
%
% When numbered option is activated, lines are numbered.
\documentclass[$for(classoption)$$classoption$$sep$,$endfor$]{trbunofficial}
\usepackage{graphicx}
\usepackage{booktabs}

\newread\somefile
\usepackage{xparse}
$if(natbib)$
\usepackage{natbib}
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$unsrtnat$endif$}
\setcitestyle{round}
$endif$
% \usepackage[colorlinks=true,linkcolor=blue,citecolor=blue]{hyperref}
% For TRB version hide links
\usepackage[hidelinks$for(hyperrefoptions)$,$hyperrefoptions$$endfor$]{hyperref}

% Put here what will go to headers as author
\AuthorHeaders{$runningheader$}
gregmacfarlane marked this conversation as resolved.
Show resolved Hide resolved
\title{$title$}

% TODO: add macros for easier formatting of \author.
\author{%
$for(author)$
\textbf{$author.name$}\\$if(author.note)$\textit{$author.note$}\\$endif$
$author.position$\\
$author.affiliation$\\
$author.email$\\
gregmacfarlane marked this conversation as resolved.
Show resolved Hide resolved
\hfill\break
$endfor$
}

% Required by Pandoc
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

% If necessary modify the number of words per table or figure default is set to
% 250 words per table (default defined in cls)
$if(wordspertable)$\WordsPerTable{$wordspertable$}$endif$

% If words are counted manually, put that number here. This does not include
% figures and tables. This can also be used to avoid problems with texcount
% program i.e. if one does not have it installed.
$if(wordcount)$\TotalWords{$wordcount$}$endif$

$if(highlighting-macros)$
% For Pandoc highlighting
$highlighting-macros$
$endif$

$if(csl-refs)$
% Pandoc citation processing
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
% for Pandoc 2.8 to 2.10.1
\newenvironment{cslreferences}%
{$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
{\par}
% For Pandoc 2.11+
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
% set entry spacing
\ifnum #2 > 0
\setlength{\parskip}{#2\baselineskip}
\fi
}%
{}
\usepackage{calc} % for calculating minipage widths
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

$for(header-includes)$
% Pandoc feature
$header-includes$
$endfor$

cderv marked this conversation as resolved.
Show resolved Hide resolved
\begin{document}
\maketitle

$for(include-before)$
$include-before$
$endfor$

\section{Abstract}
$abstract$
\hfill\break%
\hfill\break%
\noindent\textit{Keywords}: $if(keywords)$ $for(keywords)$$keywords$, $endfor$ $endif$
\newpage

$body$

\newpage
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}

$endif$
$endif$

$for(include-after)$
$include-after$

$endfor$
\end{document}
20 changes: 20 additions & 0 deletions inst/rmarkdown/templates/trb/skeleton/mybibfile.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@article{Dirac1953888,
title = "The lorentz transformation and absolute time",
journal = "Physica ",
volume = "19",
number = "1-–12",
pages = "888--896",
year = "1953",
doi = "10.1016/S0031-8914(53)80099-6",
author = "P.A.M. Dirac"
}

@article{Feynman1963118,
title = "The theory of a general quantum system interacting with a linear dissipative system",
journal = "Annals of Physics ",
volume = "24",
pages = "118--173",
year = "1963",
doi = "10.1016/0003-4916(63)90068-X",
author = "R.P Feynman and F.L {Vernon Jr.}"
}
147 changes: 147 additions & 0 deletions inst/rmarkdown/templates/trb/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
title: An Rticles Template for the Transport Research Board Annual Meeting
runningheader: "Anonymous, Security, and Zoolander"
author:
- name: Alice Anonymous
note: Corresponding Author
position: Graduate Student
email: alice@example.com
affiliation: Some Institute of Technology
- name: Bob Security
position: Assistant Professor
email: bob@example.com
affiliation: State University
- name: Derek Zoolander
position: Professor
email: derek@example.com
affiliation: Some Institute of Technology
abstract: |
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.

keywords: ["Transportation", "Travel Behavior"]
bibliography: mybibfile.bib
biblio-style: unsrtnat
classoption:
- numbered # When numbered option is activated, lines are numbered.
output: rticles::trb_article
wordcount: 684
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = FALSE)
```


# Transportation Research Board Annual Meetings

TRB has greatly simplified the submissions to its system, meaning that this
template is no longer strictly required. However, there is a typical format
that most people still use by default, and this template implements that change.


# Features

The template has a number of features that enable quick and painless manuscript authoring.

## Mathematics

Standard pandoc / \LaTeX math environments are available. For example, the
probability of an individual choosing alternative $i$ in a multinomial logit
model is
\begin{equation}
P_i = \frac{exp(V_i)}{\sum_{i, j \in J}exp(V_j)} \label{eq:mnl}
\end{equation}
Equations with a `\label{eq:label}` can be referred to later in the text with
`\ref{eq:label}`, such as Equation \ref{eq:mnl}.

## Title Page

The template will automatically create a title page with the authors in the
listed order. Near the bottom of the title page, TRB requires a count of the manuscript's
words and tables. The YAML header information contains a `wordcount` key where
this can be encoded. The number of tables is counted automatically on build;
a default 250 words per table can be overriden with the `wordspertable` YAML
key.

The LaTeX template available from <https://github.com/chiehrosswang/TRB_LaTeX_tex>
contain automatic word counters that have not been implemented in this `rticles`
template. Authors can use the R Studio word count add-in available from
<https://github.com/benmarwick/wordcountaddin>.

## Page Layout

The document has 1 inch margins as required, with the author's names in the left
heading and the page number in the right. The running header information is set
with the `runningheader` YAML key. Paragraphs leading sections and subsections
are not indented, while all subsequent paragraphs in that section are. Section
heading types are defined as outlined by the old TRB Author's Guide.

The document is single-spaced in 12 point Times font. Times New Roman is a
proprietary font and is therefore not available by installation in open-source
software. While the differences between Times variants are negligible, Times New
Roman itself can be used in Mac OSX by compiling under `xelatex`.

## Figure and Table references

The document can use standard pandoc referencing tools for in-text
citations to figures and tables. If an R code chunk outputs a figure, the figure
number can be referred to with `\@ref(fig:chunkname)` where `chunkname` is the
name of the chunk that prints the figure. For example, Figure \@ref(fig:figure-example)
shows a default figure made by the R chunk below.

```{r figure-example, fig.cap="Generic plot.", echo = TRUE}
# Generate some sample data, then compute mean and standard deviation
# in each group
Speed <- cars$speed
Distance <- cars$dist
plot(Speed, Distance,
panel.first = lines(stats::lowess(Speed, Distance), lty = "dashed"),
pch = 0, cex = 1.2, col = "blue")
```

The template setup chunk sets `echo = FALSE` for the entire document, as printing
code listings would not usually be appropriate or needed for a TRB article. But
the option is there!

The same referencing logic works for tables, with the `tab:` prefix on the
chunk name instead of `fig:` used for figures. Table \@ref(tab:table-example)
has a basic table. We recommend the `kableExtra` package for formatting
publication-ready tables with greater control than the default `knitr::kable()`
function.

```{r table-example}
knitr::kable(mtcars[1:5, 1:6], format = "latex", table.envir = "table",
booktabs = TRUE, caption = "Example Table")
```


## Bibliography styles

TRB still wants numbered, unsorted citations beginning on a new page. The
template is configured to use `natbib` with the `unsrtnat` citation style, with
some additional logic to use parentheses instead of brackets. The YAML key
`bibliostyle` will allow the authors to select a different citation format, but
this is not recommended at the moment. Citations use the pandoc logic. Including
the reference in brackets `[@reference]` will print only the numeric reference;
e.g. [@Feynman1963118; @Dirac1953888]. Including the reference without brackets
`@reference` will print the authors and then the numeric reference; e.g.
@Feynman1963118.

# Author Contribution Statement

The authors confirm contribution to the paper as follows: study conception and
design: A. Anonymous, D. Zoolander; data collection: B. Security; analysis and
interpretation of results: A. Anonymous, B. Security; draft manuscript
preparation: A. Anonymous. All authors reviewed the results and approved
the final version of the manuscript.

# Acknowledgements

David Pritchard posted the original versions of this template in 2009 and
updated it in 2011, soon after TRB began allowing PDF submissions. Gregory
Macfarlane and Ross Wang made adjustments to the template, and Ross Wang now
maintains the \LaTeX template at
<https://github.com/chiehrosswang/TRB_LaTeX_tex>. Gregory Macfarlane created the `rticles` template in 2021.


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add more example of content like equation and custom blocks using Markdown syntax.
This would allow to add the missing section from the template
What do you think ?

Suggested change
# Equations
Intelligent driver model equations from wikipedia (<https://en.wikipedia.org/wiki/Intelligent_driver_model>) moved to the left using \verb1amsmath1 package with \verb1fleqn1 options.
\begin{linenomath}
\begin{flalign}
&\dot{x}_\alpha = \frac{\mathrm{d}x_\alpha}{\mathrm{d}t} = v_\alpha \\
&\dot{v}_\alpha = \frac{\mathrm{d}v_\alpha}{\mathrm{d}t} = a\,\left( 1 - \left(\frac{v_\alpha}{v_0}\right)^\delta - \left(\frac{s^*(v_\alpha,\Delta v_\alpha)}{s_\alpha}\right)^2 \right)
\end{flalign}
\end{linenomath}
[Custom blocks](https://bookdown.org/yihui/rmarkdown-cookbook/custom-blocks.html) can also be used to create LaTeX environment but keep a markdown syntax within it.
:::: {.linenomath latex=true}
$$
s^*(v_\alpha,\Delta v_\alpha) = s_0 + v_\alpha\,T + \frac{v_\alpha\,\Delta v_\alpha}{2\,\sqrt{a\,b}}
$$
:::
# Conclusion
This conclude the presentation of this template
# Acknowledgements
Thanks to Gregory Macfarlane who created this **rticles** template in 2021.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding math is a good idea. I've added the template authors contribute statement and moved the history stuff to acknowledgements.

# References {#references }