From georg|@bo@hn@kov @end|ng |rom m@nche@ter@@c@uk  Sat Oct  9 10:33:16 2021
From: georg|@bo@hn@kov @end|ng |rom m@nche@ter@@c@uk (Georgi Boshnakov)
Date: Sat, 9 Oct 2021 08:33:16 +0000
Subject: [Rd] =?utf-8?q?Bug_18208_-_tools=3A=3A=3AlatexToUtf8=28tools=3A?=
 =?utf-8?b?OnBhcnNlTGF0ZXgoIlxcJ2kiKSkgc2hvdWxkIGdlbmVyYXRlIMOt?=
In-Reply-To: <CAOsPdQKA=JTEYBrZv9m_AmJ5o+MrrvJ=13j8hETU+M_FMyYhxw@mail.gmail.com>
References: <CAOsPdQKA=JTEYBrZv9m_AmJ5o+MrrvJ=13j8hETU+M_FMyYhxw@mail.gmail.com>
Message-ID: <LOYP265MB2015180ED8689A4175D97255AEB39@LOYP265MB2015.GBRP265.PROD.OUTLOOK.COM>

tools:::latexToUtf8() doesn't convert the LaTeX accented character "\\'i<file://'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<file://'i>"))
\'i

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

> tools:::latexToUtf8(tools::parseLatex("\\'\\i<file://'//i>"))
?

Both are acceptable in LaTeX.

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[["\\textemdash<file://textemdash>"]] <- "\u2014"
    latexArgCount[["\\textemdash<file://textemdash>"]] <<- 0

    table$"\\'"$"i"  <- table$"\\'"$"\\i<file://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<file://'i>"))
?
> tools:::latexToUtf8(tools::parseLatex("\\'\\i<file://'//i>"))
?
Georgi Boshnakov





	[[alternative HTML version deleted]]



[Rd] =?utf-8?q?Bug_18208_-_tools=3A=3A=3AlatexToUtf8=28tools=3A?= =?utf-8?b?OnBhcnNlTGF0ZXgoIlxcJ2kiKSkgc2hvdWxkIGdlbmVyYXRlIMOt?=
Georgi Boshnakov