R/aligned.R

Defines functions aligned

Documented in aligned

#' Insert latex aligned structure.
#'
#' Call this function as an addin to insert aligned structure at the cursor position.
#'
#' @export
aligned <- function() {
  rstudioapi::insertText("$$\n\\begin{aligned}\n\n\\end{aligned}\n$$")
  row <- as.numeric(
    rstudioapi::getSourceEditorContext()$selection[][[1]]$range$start[1]
  )
  rstudioapi::setCursorPosition(position = c(row - 2, 1))
}
GarrettMooney/moonmisc documentation built on Oct. 19, 2019, 7:51 p.m.