EVOLUTION-MANAGER
Edit File: encoded.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Translate non-ASCII Text to LaTeX Escapes</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for encoded_text_to_latex {tools}"><tr><td>encoded_text_to_latex {tools}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Translate non-ASCII Text to LaTeX Escapes</h2> <h3>Description</h3> <p>Translate non-ASCII characters in text to LaTeX escape sequences. </p> <h3>Usage</h3> <pre> encoded_text_to_latex(x, encoding = c("latin1", "latin2", "latin9", "UTF-8", "utf8")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a character vector.</p> </td></tr> <tr valign="top"><td><code>encoding</code></td> <td> <p>the encoding to be assumed. <code>"latin9"</code> is officially ISO-8859-15 or Latin-9, but known as latin9 to LaTeX's <code>inputenc</code> package.</p> </td></tr> </table> <h3>Details</h3> <p>Non-ASCII characters in <code>x</code> are replaced by an appropriate LaTeX escape sequence, or <span class="samp">?</span> if there is no appropriate sequence. </p> <p>Even if there is an appropriate sequence, it may not be supported by the font in use. Hyphen is mapped to <span class="samp">\-</span>. </p> <h3>Value</h3> <p>A character vector of the same length as <code>x</code>. </p> <h3>See Also</h3> <p><code><a href="../../base/html/iconv.html">iconv</a></code> </p> <h3>Examples</h3> <pre> x <- "fa\xE7ile" encoded_text_to_latex(x, "latin1") ## Not run: ## create a tex file to show the upper half of 8-bit charsets x <- rawToChar(as.raw(160:255), multiple = TRUE) (x <- matrix(x, ncol = 16, byrow = TRUE)) xx <- x xx[] <- encoded_text_to_latex(x, "latin1") # or latin2 or latin9 xx <- apply(xx, 1, paste, collapse = "&") con <- file("test-encoding.tex", "w") header <- c( "\\documentclass{article}", "\\usepackage[T1]{fontenc}", "\\usepackage{Rd}", "\\begin{document}", "\\HeaderA{test}{}{test}", "\\begin{Details}\relax", "\\Tabular{cccccccccccccccc}{") trailer <- c("}", "\\end{Details}", "\\end{document}") writeLines(header, con) writeLines(paste0(xx, "\\"), con) writeLines(trailer, con) close(con) ## and some UTF_8 chars x <- intToUtf8(as.integer( c(160:383,0x0192,0x02C6,0x02C7,0x02CA,0x02D8, 0x02D9, 0x02DD, 0x200C, 0x2018, 0x2019, 0x201C, 0x201D, 0x2020, 0x2022, 0x2026, 0x20AC)), multiple = TRUE) x <- matrix(x, ncol = 16, byrow = TRUE) xx <- x xx[] <- encoded_text_to_latex(x, "UTF-8") xx <- apply(xx, 1, paste, collapse = "&") con <- file("test-utf8.tex", "w") writeLines(header, con) writeLines(paste(xx, "\\", sep = ""), con) writeLines(trailer, con) close(con) ## End(Not run)</pre> <hr /><div style="text-align: center;">[Package <em>tools</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>