bioconductor v3.9.0 BiocStyle

Provides standard formatting styles for Bioconductor PDF

Link to this section Summary

Functions

Defunct functions in package BiocStyle

Specify Rmarkdown document metadata

Use Bioconductor style to format R Markdown HTML output

Use Bioconductor style to format LaTeX vignettes

Link to packages on Bioconductor, CRAN and GitHub

Use Bioconductor CSS style to format HTML vignettes

Convert to a BiocStyle markdown document

Output format of an R Markdown document

Use Bioconductor style to format R Markdown PDF output

Link to this section Functions

Link to this function

BiocStyle_defunct()

Defunct functions in package BiocStyle

Description

These functions are defunct and no longer available.

Details

The following functions are no longer available; use the replacement indicated below:

  • latex_old, latex2:

  • pdf_document_old, pdf_document2:

  • html_document_old, html_document2:

Specify Rmarkdown document metadata

Description

Helper functions for including metadata in the document header.

Usage

pkg_ver(pkg)
doc_date()

Arguments

ArgumentDescription
pkgcharacter(1), package name

Details

Use doc_date to include document compilation date in the document metadata field 'date', and pkg_ver for package version specification in the 'package' field.

Value

Markdown-formatted character string.

Author

Andrzej Oleś andrzej.oles@embl.de, 2014-2015

Examples

## current date
doc_date()

## package name with version
pkg_ver("BiocStyle")
Link to this function

html_document()

Use Bioconductor style to format R Markdown HTML output

Description

Format for converting from R Markdown to an Bioconductor HTML document.

Usage

html_document(toc = TRUE, number_sections = TRUE, fig_width = NA,
  fig_height = NA, self_contained = TRUE, css = NULL,
  pandoc_args = NULL, ..., titlecaps = TRUE)

Arguments

ArgumentDescription
toclogical(1), TRUE to include a table of contents in the output
number_sectionslogical(1), TRUE to number section headings
fig_widthnumeric(1), default width (in inches) for figures
fig_heightnumeric(1), default width (in inches) for figures
self_containednumeric(1), TRUE to produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Note that even for self contained documents MathJax is still loaded externally (this is necessary because of it's size).
csscharacter, one or more css files to include
pandoc_argscharacter, additional command line options to pass to pandoc
list()Additional arguments passed to html_document
titlecapslogical(1), TRUE to use the emphasize the first sentence in figure and table captions as title

Details

BiocStyle::html_document format extends the html_document format. See the c("online ", "documentation") and the package vignette "Authoring R Markdown Vignettes" for additional details on using the format,

Value

R Markdown output format to pass to render

Seealso

pdf_document , md_document

Author

Andrzej Oleś andrzej.oles@embl.de, 2014-2017

Examples

# simple invocation
render("input.Rmd", BiocStyle::html_document())

# specify options
render("input.Rmd", BiocStyle::html_document(toc = FALSE))

Use Bioconductor style to format LaTeX vignettes

Description

This function inserts code into a document preamble to provide a consistent style to Bioconductor vignettes.

Usage

latex(..., width, titlecaps = TRUE, short.fignames = FALSE, fig.path,
  use.unsrturl = TRUE, relative.path = FALSE)

Arguments

ArgumentDescription
list()Additional arguments, passed to options .
widthinteger(1), maximum number of columns on a line used in printing. See options .
titlecapslogical(1), emphasize the first sentence of float captions
short.fignameslogical(1), indicates whether incfig figures should be inserted and referred to using short names equal to corresponding code chunk labels without any additional prefix.
fig.pathcharacter(1), custom prefix to be used for figure file names when used with knitr ; has no effect when compiled with Sweave . For details see opts_chunk .
use.unsrturllogical(1), indicating that the unsrturl style will be used ( ibliographystyle command not required).
relative.pathlogical(1), copy supporting LaTeX files and use relative paths rather than absolute paths to system files.

Details

Use is described in the Bioconductor LaTeX Style 2.0 vignette.

By default the 'unsrturl' bibliography style is used, which automatically creates links to URL, DOIs, etc. Use a different bibliographystyle with use.unsrturl=FALSE and standard LaTeX commands for styling bibliographies.

Value

The return value is a character string directing LaTex to use the Bioconductor style file.

A side effect is setting any options specified as arguments.

Author

Andrzej Oleś, Martin Morgan, Wolfgang Huber

Examples

## location of the .sty file
BiocStyle:::bioconductor.sty

Link to packages on Bioconductor, CRAN and GitHub

Description

Functions for adding links to Bioconductor, CRAN and GitHub packages into R Markdown documents.

Usage

Biocpkg(pkg, vignette = NULL, label = pkg)
Biocannopkg(pkg)
Biocexptpkg(pkg)
CRANpkg(pkg)
Rpackage(pkg)
Githubpkg(repo, pkg)

Arguments

ArgumentDescription
pkgcharacter(1), package name
vignettecharacter(1), basename of vignette link, including html or pdf extension, e.g., "work-0-intro.html".
labelcharacter(1) label used to identify the package or vignette.
repoRepository address in the format username/repo[/subdir]

Details

Use Biocpkg for Bioconductor software, annotation, experiment data, and workflow packages. When vignette=NULL , the function automatically includes a link to the package landing page, the version of which depends on the current Bioconductor version (i.e. if run in a devel environment, it will point towards the devel landing page; otherwise it will point to the release landing page).

Use CRANpkg for R packages available on CRAN. The function automatically includes a link to the master CRAN landing page.

Use Githubpkg for R packages available on GitHub. The repo should include the repository address in the format username/repo[/subdir]. If package is missing, the package name is assumed to be equal the repository name and is extracted from repo .

For R packages which are not available on Bioconductor, CRAN or GitHub, use Rpackage .

Value

Markdown-formatted character vector containing a hyperlinked package name. If vignette != NULL , the address of the specified vignette is returned.

Author

Andrzej Oleś andrzej.oles@embl.de, 2014-2015

Examples

## link to a Bioconductor software package
Biocpkg("IRanges")

## link to a Bioconductor annotation package
Biocpkg("org.Mm.eg.db")

## link to a Bioconductor experiment data package
Biocpkg("affydata")

## link to a Bioconductor workflow
Biocpkg("simpleSingleCell")
Biocpkg(
"simpleSingleCell",
vignette = "work-0-intro.html",
label = "Episode 1: analyzing scRNA-seq data with R/Bioconductor"
)

## link to a CRAN package
CRANpkg("data.table")

## link to an R package on GitHub
Githubpkg("rstudio/rmarkdown")

Use Bioconductor CSS style to format HTML vignettes

Description

This function sets the Bioconductor style sheet to provide a consistent style across Bioconductor HTML vignettes.

Usage

markdown(css.files, self.contained = TRUE, links.target = TRUE)

Arguments

ArgumentDescription
css.filescharacter vector containing the location of additional .css files.
self.containedlogical(1), should the content of the CSS stylesheet files be included into the html file or should they be saved as separate files.
links.targetlogical(1), should external links open in new browser tab/window.

Details

Use is described in the Bioconductor CSS Style vignette.

Value

No value is returned. The function is called for its side effect of setting the markdown and/or knitr specific options controlling the inclusion of the Bioconductor CSS style file in the HTML output.

Author

Andrzej Oleś andrzej.oles@embl.de, 2014-2015

Examples

## location of the .css file
BiocStyle:::bioconductor.css

Convert to a BiocStyle markdown document

Description

Enable BiocStyle macros and author affiliations in markdown documents.

Usage

md_document(toc = TRUE, ...)

Arguments

ArgumentDescription
tocTRUE to include a table of contents in the output
...Additional function arguments to pass to the base R Markdown md_document output formatter

Details

The BiocStyle::md_document format extends the base md_document format by means of specifing complex author affiliations. It also loads the BiocStyle package namespace to enable the use of helper functions, such as Biocpkg .

Value

R Markdown output format to pass to render

Seealso

html_document , pdf_document

Author

Andrzej Oleś andrzej.oles@embl.de, 2015-2016

Examples

rmarkdown::render("input.Rmd", BiocStyle::md_document())

Output format of an R Markdown document

Description

Helper function to determine the document's current pandoc output format.

Usage

output()

Details

The function is useful for defining different behavior depending on the output format, e.g. figure settings.

Value

A character string specifying the pandoc output format.

Author

Andrzej Oleś andrzej.oles@embl.de, 2016

Examples

## Switch between SVG and PDF figures depending on document output format
knitr::opts_chunk$set(
dev = switch(output(), html = "svg", latex = "pdf")
)

Use Bioconductor style to format R Markdown PDF output

Description

This function sets the Bioconductor style in PDF documents rendered using R Markdown v2.

Usage

pdf_document(toc = TRUE, number_sections = TRUE, fig_width = NA,
  fig_height = NA, includes = NULL, ..., titlecaps = TRUE,
  toc_newpage = FALSE, use_unsrturl = TRUE, relative_path = FALSE)

Arguments

ArgumentDescription
toclogical(1), TRUE to include a table of contents in the output
number_sectionslogical(1), TRUE to number section headings
fig_widthnumeric(1), default width (in inches) for figures
fig_heightnumeric(1), default width (in inches) for figures
includesNamed list of additional content to include within the document (typically created using the includes function).
list()Additional arguments passed to pdf_document .
titlecapslogical(1), TRUE to use the emphasize the first sentence in figure and table captions as title
toc_newpagelogical(1), TRUE to start the table of contents on a new page.
use_unsrturllogical(1), indicating that the unsrturl style will be used ( ibliographystyle command not required).
relative_pathlogical(1), copy supporting LaTeX files and use relative paths rather than absolute paths to system files.

Value

R Markdown output format to pass to render .

Seealso

html_document , md_document

Author

Andrzej Oleś andrzej.oles@embl.de, 2014-2017

Examples

# simple invocation
render("input.Rmd", BiocStyle::pdf_document())

# specify an option for latex engine
render("input.Rmd", BiocStyle::pdf_document(toc = FALSE))