Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up| #' @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) | |
| } |