I'm using a .Rnw --> Sweave --> pdflatex workflow on Windows 10, with emacs
26.3 and ESS (not sure which version.)

I have this code:

n.tests.7 <- 3 ## for example
trailing.7.pos.percent <- 12  ## for example
trailing.7.message <-
    ifelse( n.tests.7 > 0,
            paste("In the past seven days,", n.tests.7, "test results have
been reported, of which", trailing.7.pos.percent, "\\% were positive"),
            paste("No test results have been reported from these labs in
the past seven days.") )

Desired outcome in the resulting .tex file is "In the past seven days, 3
test results have been reported, of which 12\% were positive."

But I get "In the past seven days, 3 test results have been reported, of
which 12\\% were positive." Which, when compiled in pdflatex,
unsurprisingly cuts off the sentence at 12

Replacing, in the .Rnw code, the \\% with \% , yields an R error message:

Error: '\%' is an unrecognized escape in character string starting ""\%"

Grateful for any help.

--Chris Ryan

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to