Bug 15779 - Sweave's \Sexpr misses expressions with backslashes
Summary: Sweave's \Sexpr misses expressions with backslashes
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R 3.1.0
Hardware: Other Other
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-04-25 12:01 UTC by Duncan Murdoch
Modified: 2014-04-26 14:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Murdoch 2014-04-25 12:01:33 UTC
The regexp code that looks for \Sexpr in Sweave documents incorrectly sees a backslash as a terminator of the regular expression, so it fails to recognize expressions containing them.  For example, the .Rnw file

\documentclass{article}
\usepackage{Sweave}
\begin{document}

This has a backslash:  \Sexpr{"\\LaTeX"}.

\end{document}


passes through Sweave() unchanged, rather than being processed to embed the \LaTeX macro in the text.
Comment 1 Duncan Murdoch 2014-04-26 14:01:12 UTC
I have fixed this in R-devel and soon will in R-patched.  At the same time, I've improved the error messages:  earlier this fix caused the build of the Sweave.Rnw vignette to fail, but the failure message didn't make it clear that it was a bug in that vignette that was being revealed.  (That bug has also been fixed.)