R/rmd_equations.R

Defines functions rmd_equation_block2 rmd_equation_block rmd_equation_inline

Documented in rmd_equation_block rmd_equation_block2 rmd_equation_inline

# Equations -------------------------------------------------------------------
#' Format as LaTeX equation
#'
#' Select a piece of text with a cursor and call these functions as an add-in
#' to enclose the text with special symbols. Text between \code{$.$} is
#' interpreted as an inline equation and between \code{$$.$$} or \code{\[.\]}
#' as a block equation in R Markdown.
#'
#' @export
#' @name rmd_equations
#' @family R Markdown formatting add-ins
rmd_equation_inline <- function() {
    rs_enclose_selection_with(symbol = "$")
}

#' @rdname rmd_equations
#' @export
#' @family 'Enclose selected symbols' add-ins
rmd_equation_block <- function() {
    rs_enclose_selection_with(symbol = "$$")
}

#' @rdname rmd_equations
#' @export
#' @family 'Enclose selected symbols' add-ins
rmd_equation_block2 <- function() {
    rs_enclose_selection_with(symbol_before = "\\[", symbol_after = "\\]")
}

Try the spAddins package in your browser

Any scripts or data that you put into this service are public.

spAddins documentation built on Dec. 15, 2017, 1:03 a.m.