[Rd] Bug 18208 - tools:::latexToUtf8(tools::parseLatex("\\'i")) should generate í

Georgi Boshnakov georg|@bo@hn@kov @end|ng |rom m@nche@ter@@c@uk
Sat Oct 9 12:43:39 CEST 2021


Resending this as the original message went out as html and the special characters got garbled.

tools:::latexToUtf8() doesn't convert the LaTeX accented character "\\'i" to  í (see Bug #18208 https://bugs.r-project.org/show_bug.cgi?id=18208,  reported by Manuel López-Ibáñez for details and justification). For example:

> tools:::latexToUtf8(tools::parseLatex("\\'i"))
\'i 

It does the conversion if i is replaced by '\i':

> tools:::latexToUtf8(tools::parseLatex("file:\\'\\i"))
í 


I think that this can be fixed by adding a line to the definition of makeLatexTable() in R/src/library/tools/R/parseLatex.R, just before it returns: 

makeLatexTable <- function(utf8table)
{
    ...

    table[["file://textemdash"]] <- "\u2014"
    latexArgCount[["file://textemdash"]] <<- 0

    table$"\\'"$"i"  <- table$"\\'"$"\\i"    # Georgi

    table
}

I can submit a patch if I get access  to bugzilla.

After building R-devel svn 81022 from 2021-10-08 with the above change, we get what we want:

> tools:::latexToUtf8(tools::parseLatex("\\'i"))
í 
> tools:::latexToUtf8(tools::parseLatex("\\'\\i"))
í 

Georgi Boshnakov


More information about the R-devel mailing list