Package 'BiocStyle'

Title: Standard styles for vignettes and other Bioconductor documents
Description: Provides standard formatting styles for Bioconductor PDF and HTML documents. Package vignettes illustrate use and functionality.
Authors: Andrzej Oleś [aut] , Mike Smith [ctb] , Martin Morgan [ctb], Wolfgang Huber [ctb], Bioconductor Package Maintainer [cre]
Maintainer: Bioconductor Package Maintainer <[email protected]>
License: Artistic-2.0
Version: 2.35.0
Built: 2024-12-19 02:52:32 UTC
Source: https://github.com/bioc/BiocStyle

Help Index


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:


Specify Rmarkdown document metadata

Description

Helper functions for including metadata in the document header.

Usage

pkg_ver(pkg)

doc_date()

Arguments

pkg

character(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(s)

Andrzej Oleś <[email protected]>, 2014-2015

Examples

## current date
doc_date()

## package name with version
pkg_ver("BiocStyle")

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

toc

logical(1), TRUE to include a table of contents in the output

number_sections

logical(1), TRUE to number section headings

fig_width

numeric(1), default width (in inches) for figures

fig_height

numeric(1), default width (in inches) for figures

self_contained

numeric(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).

css

character, one or more css files to include

pandoc_args

character, additional command line options to pass to pandoc

...

Additional arguments passed to html_document

titlecaps

logical(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 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

Author(s)

Andrzej Oleś <[email protected]>, 2014-2017

See Also

pdf_document, md_document

Examples

## Not run: 

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

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

## End(Not run)

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

...

Additional arguments, passed to options.

width

integer(1), maximum number of columns on a line used in printing. See options.

titlecaps

logical(1), emphasize the first sentence of float captions

short.fignames

logical(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.path

character(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.unsrturl

logical(1), indicating that the ‘unsrturl’ style will be used (\bibliographystyle command not required).

relative.path

logical(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(s)

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 = NULL)

Biocbook(pkg, label = NULL)

Biocannopkg(pkg)

Biocexptpkg(pkg)

CRANpkg(pkg)

Rpackage(pkg)

Githubpkg(repo, pkg)

Arguments

pkg

character(1), package name

vignette

character(1), basename of vignette link, including html or pdf extension, e.g., "work-0-intro.html".

label

character(1) label used to identify the package or vignette. If NULL, defaults to pkg.

repo

Repository 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 Biocbook for Bioconductor webbooks. This will create a link to the index page of the book rather than to the landing page of the package used for the book's deployment.

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(s)

Andrzej Oleś <[email protected]>, 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

css.files

character vector containing the location of additional .css files.

self.contained

logical(1), should the content of the CSS stylesheet files be included into the html file or should they be saved as separate files.

links.target

logical(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(s)

Andrzej Oleś <[email protected]>, 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

toc

TRUE 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

Author(s)

Andrzej Oleś <[email protected]>, 2015-2016

See Also

html_document, pdf_document

Examples

## Not run: 

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

## End(Not run)

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(s)

Andrzej Oleś <[email protected]>, 2016

Examples

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

## End(Not run)

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

toc

logical(1), TRUE to include a table of contents in the output

number_sections

logical(1), TRUE to number section headings

fig_width

numeric(1), default width (in inches) for figures

fig_height

numeric(1), default width (in inches) for figures

includes

Named list of additional content to include within the document (typically created using the includes function).

...

Additional arguments passed to pdf_document.

titlecaps

logical(1), TRUE to use the emphasize the first sentence in figure and table captions as title

toc_newpage

logical(1), TRUE to start the table of contents on a new page.

use_unsrturl

logical(1), indicating that the ‘unsrturl’ style will be used (\bibliographystyle command not required).

relative_path

logical(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.

Author(s)

Andrzej Oleś <[email protected]>, 2014-2017

See Also

html_document, md_document

Examples

## Not run: 

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

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

## End(Not run)

Create 'Rmd' vignette templates for HTML or PDF output

Description

Create 'Rmd' vignette templates for HTML or PDF output

Usage

use_vignette_html(destination = tempfile(fileext = ".Rmd"))

use_vignette_pdf(destination = tempfile(fileext = ".Rmd"))

Arguments

destination

character(1) file path to destination. The directory of the destination must already exist, and the file must not. The default creates a file in the temporary directory, and so is removed when the R session ends.

Examples

use_vignette_html()