Skip to content

Commit

Permalink
Change visc_clearpage and visc_ref to insert_break and insert_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
monicagerber committed Jun 8, 2020
1 parent 137b169 commit 208ff17
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
export(check_pandoc_version)
export(create_visc_project)
export(get_output_type)
export(insert_break)
export(insert_ref)
export(install_load_cran_packages)
export(set_kable_warnings)
export(set_pandoc_markup)
export(use_visc_docs)
export(use_visc_gitignore)
export(use_visc_pr_template)
export(use_visc_readme)
export(visc_clearpage)
export(visc_pdf_document)
export(visc_ref)
export(visc_word_document)
10 changes: 5 additions & 5 deletions R/report_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ check_pandoc_version <- function() {
#'
#' @examples
#'
#' \dontrun{visc_ref("tab:my-results")}
#' \dontrun{visc_ref("fig:box-plots")}
visc_ref <- function(ref) {
#' \dontrun{insert_ref("tab:my-results")}
#' \dontrun{insert_ref("fig:box-plots")}
insert_ref <- function(ref) {
ifelse(knitr::opts_knit$get('rmarkdown.pandoc.to') == 'latex',
paste0('\\ref{', ref, '}'),
paste0('\\@ref(', ref, ')'))
Expand All @@ -58,8 +58,8 @@ visc_ref <- function(ref) {
#' @export
#'
#' @examples
#' \dontrun{visc_clearpage()}
visc_clearpage <- function() {
#' \dontrun{visc_break()}
insert_break <- function() {
ifelse(knitr::opts_knit$get('rmarkdown.pandoc.to') == 'latex',
'\\clearpage',
'#####')
Expand Down
12 changes: 6 additions & 6 deletions inst/rmarkdown/templates/visc_report/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ICS_adata <- exampleData_ICS %>%
filter(Population == 'IFNg' & Group != 3)
```

`r visc_clearpage()`
`r insert_break()`

# Summary of Main Results

Expand Down Expand Up @@ -225,9 +225,9 @@ Consider breaking up the results section by objective or by statistical endpoint

## Section 2

Make sure to include p-values and references to relevant tables and figures. See Figure `r visc_ref("fig:example-plot")` and Table `r visc_ref("tab:example-tab")`.
Make sure to include p-values and references to relevant tables and figures. See Figure `r insert_ref("fig:example-plot")` and Table `r insert_ref("tab:example-tab")`.

`r visc_clearpage()`
`r insert_break()`

# Figures and Tables

Expand Down Expand Up @@ -267,7 +267,7 @@ ICS_adata %>%
facet_grid(Stim ~ Visit)
```

`r visc_clearpage()`
`r insert_break()`

```{r example-tab, results="asis", warning=kable_warnings}
Expand All @@ -291,7 +291,7 @@ magnitude_tab %>%
footnote("BAMA Magnitude with testing", threeparttable = TRUE)
```

`r visc_clearpage()`
`r insert_break()`

```{r Software-Session-Information, results="asis", message=FALSE, warning=kable_warnings}
# load in rmarkdown to capture verison number
Expand Down Expand Up @@ -319,6 +319,6 @@ kable(
kable_styling(font_size = 10)
```

`r visc_clearpage()`
`r insert_break()`

# References
8 changes: 4 additions & 4 deletions man/visc_clearpage.Rd → man/insert_break.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/visc_ref.Rd → man/insert_ref.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vignettes/using_pdf_and_word_template.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ There are some new functions and coding conventions that help with knitting the
## Page breaks
* For page breaks use the `visc_clearpage()` function. You can use this as a simple inline code: `` `r knitr::inline_expr("visc_clearpage()")` ``.
* For page breaks use the `insert_break()` function. You can use this as a simple inline code: `` `r knitr::inline_expr("insert_break()")` ``.
+ `\clearpage` (from previous template) will not work on Word output.
## Referencing
`
**Figure and table references**
* For figure and table references use `visc_ref()` function.
+ For example: `` `r knitr::inline_expr("visc_ref('fig:response-rate-plot')")` ``.
* For figure and table references use `insert_ref()` function.
+ For example: `` `r knitr::inline_expr("insert_ref('fig:response-rate-plot')")` ``.
* Make sure chunk names only use dashes or referring will not work (no spaces or underscores).
* Do not use figure or table labels in chunk headings or kable code (e.g., don't use `fig.cap = "My Figure Caption \\label{my_figure_label}"`. Rmarkdown will automatically assign the chunk name as the figure/table reference label.
Expand Down

0 comments on commit 208ff17

Please sign in to comment.