---
title: A demonstration of the \LaTeX class file for Statistics in Medicine with Rmarkdown
runningtitle: How to use
author:
- name: A. Uthor*
  num: a,b
- name: O. Tro
  num: b
- name: O. Vriga
  num: c
address:
- num: a
  org: Department of Incredible Research, University A, City A, Country A
- num: b
  org: Department of Applied Things, University B, City B, Country B
- num: c
  org: Very Important Stuff Committee, Institute C, City C, Country C
corres: "*Corresponding author name, This is sample corresponding address. \\email{authorone@gmail.com}"
presentaddress: This is sample for present address text this is sample for present address text
authormark: Uthor \emph{et al}.
articletype: Research article
abbreviations:
  - ANA, anti-nuclear antibodies
  - APC, antigen-presenting cells
  - IRF, interferon regulatory factor.
abstract: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut elit odio. Donec fermentum tellus neque, vitae fringilla orci pretium vitae. Fusce maximus finibus facilisis. Donec ut ullamcorper turpis. Donec ut porta ipsum. Nullam cursus mauris a sapien ornare pulvinar. Aenean malesuada molestie erat quis mattis. Praesent scelerisque posuere faucibus. Praesent nunc nulla, ullamcorper ut ullamcorper sed, molestie ut est. Donec consequat libero nisi, non semper velit vulputate et. Quisque eleifend tincidunt ligula, bibendum finibus massa cursus eget. Curabitur aliquet vehicula quam non pulvinar. Aliquam facilisis tortor nec purus finibus, sit amet elementum eros sodales. Ut porta porttitor vestibulum. Integer molestie, leo ut maximus aliquam, velit dui iaculis nibh, eget hendrerit purus risus sit amet dolor. Sed sed tincidunt ex. Curabitur imperdiet egestas tellus in iaculis. Maecenas ante neque, pretium vel nisl at, lobortis lacinia neque. In gravida elit vel volutpat imperdiet. Sed ut nulla arcu. Proin blandit interdum ex sit amet laoreet. Phasellus efficitur, sem hendrerit mattis dapibus, nunc tellus ornare nisi, nec eleifend enim nibh ac ipsum. Aenean tincidunt nisl sit amet facilisis faucibus. Donec odio erat, bibendum eu imperdiet sed, gravida luctus turpis."
keywords: Class file; \LaTeX; Statist. Med.; Rmarkdown;
bibliography: bibfile.bib
output: rticles::sim_article
---

# The Article Header Information

YAML header:

```
output:
  rticles::sim_article:
    keep_tex: TRUE
```

Configure the YAML header including the following elements:

* `title`: Title

* `author`: List of author(s) containing `name` and `num`

* `address`: List containing `num` and `org` for defining `author` affiliations

* `presentaddress`: Not sure what they mean with this

* `corres`: Author and address for correspondence

* `authormark`: Short author list for header

* `received`, `revised`, `accepted`: dates of submission, revision, and acceptance of the manuscript

* `abstract`: Limited to 250 words

* `keywords`: Up to 6 keywords

* `bibliography`: BibTeX `.bib` file

* `classoption`: options of the `WileyNJD-v2` class

* `longtable`: set to `true` to include the `longtable` package, used by default from `pandoc` to convert markdown to \LaTeX code

## Remarks

1. In `authormark` use _et al._ if there are three or more authors.

2. Note the use of `num` to link names and addresses.

3. For submitting a double-spaced manuscript, add `doublespace` as an option to a `classoption` line in the YAML header: `classoption: doublespace`.

4. Keywords are separated by semicolons.

# The Body of the Article

## Mathematics

Use mathematics in Rmarkdown as usual.

## Figures and Tables

Figures are supported from R code:

```{r plot-ref, fig.cap = "Fancy Caption\\label{fig:plot}"}
x = rnorm(10)
y = rnorm(10)
plot(x, y)
```

...and can be referenced (Figure \ref{fig:plot}) by including the `\\label{}` tag in the `fig.cap` attribute of the R chunk: `fig.cap = "Fancy Caption\\label{fig:plot}"`. It is a quirky hack at the moment, see [here](https://github.com/yihui/knitr/issues/323).

Analogously, use Rmarkdown to produce tables as usual:

```{r, results = "asis"}
if (!require("xtable")) install.packages("xtable")
xt <- xtable(head(cars), caption = "A table", label = "tab:table")
print(xt, comment = FALSE)
```

Referenced via \ref{tab:table}. You can also use the YAML option `header-includes` to includes custom \LaTeX packages for tables (keep in mind that `pandoc` uses `longtables` by default, and it is hardcoded; some things may require including the package `longtable`). E.g., using `ctable`:
```
header-includes:
- \usepackage{ctable}
```
Then, just write straight-up \LaTeX code and reference is as usual (`\ref{tab:ctable}`):
```
\ctable[cap = {Short caption},
        caption = {A long, long, long, long, long caption for this table.},
        label={tab:ctable},]
        {cc}
        {
        \tnote[$\ast$]{Footnote 1}
        \tnote[$\dagger$]{Other footnote}
        \tnote[b]{Mistakes are possible.}
        }{
        \FL
        COL 1\tmark[a] & COL 2\tmark[$\ast$]
        \ML
        6.92\tmark[$\dagger$] & 0.09781 \\
        6.93\tmark[$\dagger$] & 0.09901 \\
        97 & 2000
        \LL
}
```

It is also possible to set the `YAML` option `longtable: true` and use markdown tables (or the `knitr::kable` function): `knitr::kable(head(cars))` produces the same table as the `xtable` example presented before.

## Cross-referencing

The use of the Rmarkdown equivalent of the \LaTeX cross-reference system
for figures, tables, equations, etc., is encouraged (using `[@<name>]`, equivalent of `\ref{<name>}` and `\label{<name>}`). That works well for citations in Rmarkdown, not so well for figures and tables. In that case, it is possible to revert to standard \LaTeX syntax.

## Double Spacing

If you need to double space your document for submission please use the `doublespace` option in the header.

# Bibliography

Link a `.bib` document via the YAML header, and bibliography will be printed at the very end (as usual). The default bibliography style is provided by Wiley as in `WileyNJD-AMA.bst`, do not delete that file.

Use the Rmarkdown equivalent of the \LaTeX citation system using `[@<name>]`. Example: [@Taylor1937], [@Knupp1999; @Kamm2000].

To include all citation from the `.bib` file, add `\nocite{*}` before the end of the document.

# Further information

All \LaTeX enviroments supported by the main template are supported here as well; see the `.tex` sample file [here](http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)1097-0258/homepage/la_tex_class_file.htm) for more details and example.
