You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
If you want to replace text that includes an underscore (e.g. "test_x") using text_replace or text_transform, the required pattern is different for HTML output and LaTeX output. For HTML output, you can use the underscore directly, while for latex you must double escape it (e.g. test\\\\_x). See the reproducible example below which will produce different results when rendered to HTML rather than PDF.
I experimented with several other special characters (*, :, -, and .). All of these characters worked fine in both formats without double-escaping, so this appears to be a specific problem with underscores.
Reproducible example
Post a minimal reproducible example so the maintainer can troubleshoot the problems you identify. A reproducible example is:
Runnable: post enough R code and data so any onlooker can create the error on their own computer.
Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
Prework
Description
If you want to replace text that includes an underscore (e.g. "test_x") using
text_replace
ortext_transform
, the required pattern is different for HTML output and LaTeX output. For HTML output, you can use the underscore directly, while for latex you must double escape it (e.g.test\\\\_x
). See the reproducible example below which will produce different results when rendered to HTML rather than PDF.I experimented with several other special characters (
*
,:
,-
, and.
). All of these characters worked fine in both formats without double-escaping, so this appears to be a specific problem with underscores.Reproducible example
Expected result
The result should be the same in HTML and PDF. Preferably, you would be able to run the pattern without double-escaping.
Session info
End the reproducible example with a call to
sessionInfo()
in the same session (e.g.reprex(session_info = TRUE)
) and include the output.The text was updated successfully, but these errors were encountered: