Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (16 sloc) 502 Bytes
#' @importFrom rstudioapi getActiveDocumentContext
tex_addin <- function() {
# Get the document context.
context <- rstudioapi::getActiveDocumentContext()
# Set the default data to use based on the selection.
obj <- context$selection[[1]]$text
if (nchar(obj) == 0) {
stop('Please highlight a tex before selecting this addin.')
}
if(grepl('xtable',obj)){
eval(parse(text=paste0('obj=',obj)))
}else{
obj=gsub('\\\\\\\\','\\\\',obj)
}
tex_preview(obj = obj)
}
You can’t perform that action at this time.