## load libraries library(officer) library(officedown) library(flextable) library(ragg) ## this sets our default code chunk options knitr::opts_chunk$set(dev = "ragg_png", echo = FALSE, ## figure chunk options fig.cap = TRUE, fig.width = 6)
Texas Water Resources Institute
Texas A&M Agrilife
College Station, TX
TR-ABCD
This project was funded through a grant from a generous agency.
Insert other funding or partnership acknowledgments here.
## leave in, starts new word document section ## after table of abbreviations block_section(prop_section(type = "nextPage"))
::: {custom-style="Unnumbered Heading 1"}
Table of Contents
:::
::: {custom-style="Unnumbered Heading 1"}
Table of Figures
:::
::: {custom-style="Unnumbered Heading 1"}
Table of Tables
:::
::: {custom-style="Unnumbered Heading 1"}
Abbreviations
:::
## leave in, ends word document section ## after table of abbreviations block_section(prop_section(type = "nextPage"))
First, second, and third level headings are defined by #
, ##
, and ###
respectively.
This is an example of an unformatted table and how we cross-reference that table (Table \@ref(tab:mtcars)).
dat <- mtcars head(dat, n = 10)
The flextable
package provides additional formatting flexibility when exporting to Word (Table \@ref(tab:mtcarsflex)).
ft <- flextable(head(dat, n = 10)) ft
We can embed and cross-reference plots (Figure \@ref(fig:pressure)).
plot(pressure)
## leave in, end word document section ## after table of abbreviations block_section(prop_section(type = "nextPage"))
x <- seq(1,30, by = .1) plot(x, sin(x), type = "l", main = "", xlab = "", ylab = "", col = "#CC4300")
Wrap variables or math in a single $
to show math inline. For example, $\varepsilon \sim \mathrm{N}(0,1)$. Standalone equations are wrapped with $$
.
$$ \left(\prod_{i=1}^{n}y_i\right)^{\frac{1}{n}} = \exp\left[\frac{1}{n}\sum_{i=1}^n\log{y_i}\right], \quad \textrm{when} \quad y_1, y_2, ..., y_n > 0 $$
If the equations need to be numbered and cross-referenced the format as:
\begin{equation} \left(\prod_{i=1}^{n}y_i\right)^{\frac{1}{n}} = \exp\left[\frac{1}{n}\sum_{i=1}^n\log{y_i}\right], \quad \textrm{when} \quad y_1, y_2, ..., y_n > 0 (\#eq:gmean) \end{equation}
Which renders as (Equation \@ref(eq:gmean):
\begin{equation} \left(\prod_{i=1}^{n}y_i\right)^{\frac{1}{n}} = \exp\left[\frac{1}{n}\sum_{i=1}^n\log{y_i}\right], \quad \textrm{when} \quad y_1, y_2, ..., y_n > 0 (#eq:gmean) \end{equation}
In-text references and bibliography generation are handled automatically. It relies on creating a bibtex .bib
file with your references. Software such as Zotero, Mendely, and even Google Scholar can generate the bibtex entries for you. The entries are stored in the bibliography.bib
file inside the same directory as this .Rmd
file. To make a in text citation, use the following syntax, [@helsel_statistical_2002]
to generate the reference at the end of this sentence [@helsel_statistical_2002]. Use a semicolon to include multiple references [@helsel_statistical_2002; @hirsch2010weighted]
[@helsel_statistical_2002; @hirsch2010weighted]. Or we might use @helsel_statistical_2002
without brackets to indicate @helsel_statistical_2002 provide a fundamental overview of water quality statistics. The bibliography will populate automatically.
This template uses Minion Pro for body fonts and Open Sans for headings following TWRI brand guidance and AgriLife brand guidance. I can't bundle Minion Pro in this package because of licensing, but you can download and install both fonts from AgriLife (https://agrilife.tamu.edu/wp-content/uploads/2021/03/AgriFonts.zip). I recommend downloading and installing the fonts before knitting your documents. Note that Minion Pro won't "embed" in Word documents because it is an OTF style font and currently Word only embeds TTF fonts. That means collaborators without the font installed on their system will see a different serif font on their system in Word. Once exported to pdf, both OTF and TTF fonts should be embedded correctly.
## leave in, ends word document section ## after table of abbreviations block_section(prop_section(type = "nextPage"))
You can add more info, tables, and figures here.
## leave in, ends word document section ## after table of abbreviations block_section(prop_section(type = "nextPage"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.