knitr::opts_chunk$set( echo = FALSE, # By default, hide code; set to TRUE to see code fig.pos = 'p', # Places figures on pages separate from text out.width = '100%', dpi = 300, # Figure resolution and size fig.env = "figure" # Latex figure environment )
This template is based on the generic OUP template available here. The original OUP sample tex document, providing more details on prefered formatting for LaTeX documents, is included with the template in the file ouparticle_sample.tex
.
OUP template version
This demo file will use the old template ouparticle.cls
output: rticles::oup_article: oup_version: 0
Set oup_version: 1
to use the new template from oup-authoring-template
CTAN package. There is another Rmd template for this as example: Create it from RStudio IDE or using rmarkdown::draft("MyArticle.Rmd", template = "oup_v0", package = "rticles")
Here are two sample references: @Feynman1963118 [@Dirac1953888]. Bibliography will appear at the end of the document.
An equation with a label for cross-referencing:
\begin{equation}\label{eq:eq1} \int^{r_2}_0 F(r,\varphi){\rm d}r\,{\rm d}\varphi = [\sigma r_2/(2\mu_0)] \int^{\infty}_0\exp(-\lambda|z_j-z_i|)\lambda^{-1}J_1 (\lambda r_2)J_0 (\lambda r_i\,\lambda {\rm d}\lambda) \end{equation}
This equation can be referenced as follows: Eq. \ref{eq:eq1}
A numbered list:
1) First point 2) Second point - Subpoint
A bullet list:
plot(1:10, main = "Some data", xlab = "Distance (cm)", ylab = "Time (hours)")
You can reference this figure as follows: Fig. \ref{fig:fig1}.
plot(1:5, pch = 19, main = "Some data", xlab = "Distance (cm)", ylab = "Time (hours)")
Reference to second figure: Fig. \ref{fig:fig2}
xtable
df <- data.frame(ID = 1:3, code = letters[1:3]) # Creates tables that follow OUP guidelines using xtable library(xtable) print(xtable(df, caption = "This is the table caption", label = "tab:tab1"), comment = FALSE )
You can reference this table as follows: Table \ref{tab:tab1}.
kable
df <- data.frame(ID = 1:3, code = letters[1:3]) # kable can alse be used for creating tables knitr::kable(df, caption = "This is the table caption", format = "latex", booktabs = TRUE, label = "tab2" )
You can reference this table as follows: Table \ref{tab:tab2}.
You can cross-reference sections and subsections as follows: Section \ref{materials-and-methods} and Section \ref{a-subsection}.
Note: the last section in the document will be used as the section title for the bibliography.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.