File: toLatex-tools.R

package info (click to toggle)
r-cran-memisc 0.99.31.8.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,136 kB
  • sloc: ansic: 5,117; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
LaTeXcape <- function(x){
    x <- gsub("$","\\$",x,fixed=TRUE)
    x <- gsub("_","\\_",x,fixed=TRUE)
    x <- gsub("^","\\^",x,fixed=TRUE)
}

checkLaTeXcape <- function(x,where){
    do.warn <- any(grepl("$",x,fixed=TRUE))
    do.warn <- do.warn || any(grepl("_",x,fixed=TRUE))
    do.warn <- do.warn || any(grepl("^",x,fixed=TRUE))
    if(do.warn)
        warning("Unescaped TeX special in ",where)
}