WrapRmd
WrapRmd copied to clipboard
problems with wrapping lines containing latex code
Before
Works as expected
After
But the extra \
introduced by WrapRmd
creates problems for rendering the equations:
WrapRmd runs the markdown through common mark which escapes the \’s. I would appreciate any input from people who want to help develop a way of unescaping the backslashes or finding a way to keep common mark from escaping them in the first place.
I think the approach of using a regex for LaTeX similar to what was done for cross-references in this PR would work.
re_latex <- "((?!=[$])\\$[^$]*\\$)"
stringr::str_extract("$\alpha + \beta$ is 3", re_latex)
#> [1] "$\alpha + \beta$"
Created on 2021-04-08 by the reprex package (v2.0.0)
Please insert customary joke about solving a problem with regex 😀