---
# This template is largely functionally equivalent to that for elsevier
# The two fields that are not in the elsevier format are:
#      `corresponding_author` and `acknowledgements`
title: Template for Oxford University Press papers
date: "`r Sys.Date()`"
author:
  - name: Alice Anonymous
    email: alice@example.com
    corresponding_author: yes # Footnote using corresponding_author
    affiliation:
      - ABC
      - DEF
  - name: Bob Security
    email: bob@example.com
    affiliation: DEF
    footnote: 1 # Footnote using reference
  - name: Cat Memes
    email: cat@anotheru.edu
    affiliation: Another University
    footnote:
        - 1
        - 2
address:
  - code: ABC
    address: Address ABC
  - code: DEF
    address: Address DEF
  - code: Another University
    address: Address for Another University
footnote:
  - code: 1
    text: "Equal contribution"
  - code: 2
    text: "Current email address: \\href{mailto:cat@example.com}{cat@example.com}"
abstract: |
  This is the abstract.

  It consists of two paragraphs.
acknowledgements: |
  This is an acknowledgement.

  It consists of two paragraphs.
keywords:
  - key
  - dictionary
  - word
bibliography: mybibfile.bib
# Use a CSL when `citation_package = "default"`
#csl: https://www.zotero.org/styles/oxford-university-press-note

## Example of some pandoc's variable to use
#fontsize: 12pt
#spacing: halfline # could also be oneline
#classoptions:
#  - endnotes
#link-citations: yes
#urlcolor: orange
#linkcolor: green
#citecolor: red
#header-includes:
#  - \usepackage[nomarkers,tablesfirst]{endfloat} # For figures and tables at end
#  - \usepackage{lineno} # For line numbering
#  - \linenumbers # For line numbering

output: 
  rticles::oup_article:
    oup_version: 0 # 1 = 2020 CTAN OUP CLS package; 0 = 2009 OUP CLS package
    extra_dependencies: booktabs # for kable example
---

```{r setup, include = FALSE}
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
)
```

# Introduction

This template is based on the generic OUP template available [here](https://academic.oup.com/icesjms/pages/General_Instructions). 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`

```yaml
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")`

# Reference example

Here are two sample references: @Feynman1963118 [@Dirac1953888]. Bibliography will appear at the end of the document.

# Materials and methods

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 subsection

A numbered list:

1) First point
2) Second point
    - Subpoint
    
A bullet list:

* First point
* Second point

# Results

## Generate a figure.

```{r fig1, fig.cap="This is the first figure.",echo=TRUE}
plot(1:10, main = "Some data", xlab = "Distance (cm)", ylab = "Time (hours)")
```

You can reference this figure as follows: Fig. \ref{fig:fig1}.

```{r fig2, fig.cap="This is the second figure.",echo=TRUE}
plot(1:5, pch = 19, main = "Some data", xlab = "Distance (cm)", ylab = "Time (hours)")
```

Reference to second figure: Fig. \ref{fig:fig2}

## Generate a table using `xtable`

```{r tab1, results="asis", echo=TRUE}
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}.

## Generate a table using `kable`

```{r anothertable, echo=TRUE}
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}.

# Discussion

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.

# References
