[Rd] tools:::cleanupLaTex fails to drop braces in names containing consecutive accented characters

Georgi Boshnakov georg|@bo@hn@kov @end|ng |rom m@nche@ter@@c@uk
Fri Apr 8 22:58:57 CEST 2022

tools:::cleanupLaTex() fails to drop braces in names containing consecutive accented characters. 
For example, Ibáñez ends up rendered as Ibá{ñ}ez. This is a problem for high level functions, e.g. cite(). For example, after importing the following into a bibentry object, say `tmp`:

  author =       { Juan Esteban Diaz and Manuel L{\'o}pez-Ib{\'a}{\~n}ez },
  title =        {Incorporating Decision-Maker's Preferences into the Automatic
                  Configuration of Bi-Objective Optimisation Algorithms},
  journal =      {European Journal of Operational Research},
  year =         2021,
  volume =       289,
  number =       3,
  pages =        {1209--1222},
  doi =          {10.1016/j.ejor.2020.07.059},

> cite("DiaLop2020ejor", tmp, textual = TRUE)
## Diaz and López-Ibá{ñ}ez (2021)

Here is an example showing that it is not related to a specific accented character:

> e1 <- "Manuel L{\\'o}pez-Ib{\\'a}{\\~n}ez"
> e2 <- "Manuel L{\\'o}pez-Ib{\\~n}{\\'a}ez"
> tools:::cleanupLatex(e1)
## [1] "Manuel López-Ibá{ñ}ez"
> tools:::cleanupLatex(e2)
[1] "Manuel López-Ibñ{á}ez"

This may be a problem in certain circumstances. I narrowed this down to `deparseLatex()` but it is not clear to me if a change may be need there or in parseLatex() which creates the object processed by deparseLatex. I have given more specific details of mu understanding of the problem in my comment at
https://github.com/GeoBosh/Rdpack/issues/25#issuecomment-1093336599 regarding a bug report for Rdpack.

Georgi Boshnakov

More information about the R-devel mailing list