Re: [R] Sweave special token \\ from R to latex

From: Markus Jäntti <markus.jantti_at_iki.fi>
Date: Fri 04 Aug 2006 - 23:07:32 EST

Jan Wijffels wrote:
> Dear helpeRs,
>
> I would like to specify a newline command in R and pass it to latex
> via Sweave such that it corresponds to latex' \\ command. But that
> doesn't seem to be possible. If I Sweave the \n character, it just
> makes a new line in latex but not the \\ command.
>
> Is there a way such that the following code would result in latex in
> blablabla \\ blablabla on different line
>
>
> <<echo=FALSE>>=
> string <- "blablabla \\ blablabla on different line"
> @
> \Sexpr{string}
>

For reasons that I am unable to account for, you get the desired string in your .tex file if you do

<<echo=FALSE>>=

    string <- "blablabla \\\\\\\\ blablabla on different line"

@

\Sexpr{print(string)}

resulting in the .tex file as

blablabla \\ blablabla on different line

It would seem that using <<echo=FALSE,results=tex>> would be a good solution.

Markus

>
>
>
> Thanks for the help,
> Jan
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> 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.
>

-- 
Markus Jantti
Abo Akademi University
markus.jantti@iki.fi
http://www.iki.fi/~mjantti
###########################################

This message has been scanned by F-Secure Anti-Virus for Mic...{{dropped}}

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.
Received on Fri Aug 04 23:13:06 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 05 Aug 2006 - 00:18:14 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.