This pinp is not PNAS template started when the introduction to Rcpp by \cite{PeerJ:Rcpp} was converted into this updated Rcpp Introduction vignette. It is based on the pnas_article template of the wonderful rticles package by \cite{CRAN:rticles}. The conversion from markdown to latex is facilitated by rmarkdown \citep{CRAN:rmarkdown} and knitr \citep{CRAN:knitr}. The underlying LaTeX macros are from pnas.org.
The remainder of the document carries over from the corresponding pnas_article template document. but has been edited and updated to our use case. A few specific tips follow. In general, for fine-tuning some knowledge of LaTeX is helpful.
Per common academic best practice, you can include your department, institution, and complete address, with the ZIP/postal code, for each author. Use lower case letters to match authors with institutions, as shown in the example. Authors with an ORCID ID may supply this information at submission.
We support several options via the YAML header
date_subtitle
) suitable to give publication
info of the draft, e.g. journal name in a post-print;document_date
.Here we differ from PNAS and suggest natbib. References will appear in
author-year form. Use \citet{}
, \citep{}
, etc as usual.
We default to the jss.bst
style. To switch to a different bibliography
style, please use biblio-style: style
in the YAML header.
The PNAS sample included a fixed PNG image here, but this document prefers to show the results and embedding of R code.
library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point(size=3, aes(colour=factor(cyl))) + theme(legend.position="none")
Here we use a standard knitr bloc with explicit options for
fig.width
, fig.height
), both set to three inches;echo=TRUE
); andfig.cap
) as shown above.Markdown, Pandoc and LaTeX support .eps
and .pdf
files.
Figures and Tables should be labelled and referenced in the standard way
using the \label{}
and \ref{}
commands.
The R examples above show how to insert a column-wide
figure. To insert a figure wider than one column, please use the
\begin{figure*}...\end{figure*}
environment.
One (roundabout) way of doing this is to not actually plot a figure, but to save it in a file as the following segment shows:
library(ggplot2) p <- ggplot(data = midwest, mapping = aes(x = area, fill = state, color = state)) + geom_density(alpha = 0.3) ## save to file suppressMessages(ggsave("densities.pdf", p))
This file is then included via standard LaTeX commands.
\begin{figure} \begin{center} \includegraphics[width=0.66\textwidth, height=3.5in]{densities} \end{center} \caption{Wide ggplot2 figure}\label{fig} \end{figure}
We can also just show code.
xx <- faithful[,"eruptions"] fit <- density(xx) plot(fit)
This simply used a pandoc bloc started and ended by three backticks,
with r
as the language choice. Similarly, many other languages
can be typeset directly simply by relying on pandoc.
Authors may use 1- or 2-column equations in their article, according to their preference.
To allow an equation to span both columns, options are to use the
\begin{figure*}...\end{figure*}
environment mentioned above for
figures. The \begin{widetext}...\end{widetext}
environment as shown
in equation \ref{eqn:example} below is deprecated, but \LaTeX commands
\onecolumn
and \twocolumn
work fine.
Please note that this option may run into problems with floats and
footnotes, as mentioned in the cuted package
documentation. In the case of problems
with footnotes, it may be possible to correct the situation using
commands \footnotemark
and \footnotetext
.
\begin{equation} \begin{aligned} (x+y)^3&=(x+y)(x+y)^2\ &=(x+y)(x^2+2xy+y^2) \ &=x^3+3x^2y+3xy^3+x^3. \label{eqn:example} \end{aligned} \end{equation}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.