From murdoch.duncan at gmail.com  Thu Nov  3 17:28:56 2011
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Thu, 03 Nov 2011 12:28:56 -0400
Subject: [Rd] R CMD check and error in an \Sexpr in an Rd file
In-Reply-To: <4EB2A9F6.2060501@cbio.uct.ac.za>
References: <4EB281F4.3060109@cbio.uct.ac.za>, <4EB286E0.7070504@gmail.com>
	<438D2EC9EAFE5946B2D5864670EA468E08896B@MBXP01.ds.man.ac.uk>
	<4EB2A381.60403@cbio.uct.ac.za> <4EB2A514.30208@gmail.com>
	<4EB2A9F6.2060501@cbio.uct.ac.za>
Message-ID: <4EB2C148.5030107@gmail.com>

On 03/11/2011 10:49 AM, Renaud Gaujoux wrote:
> On 03/11/2011 16:28, Duncan Murdoch wrote:
> >  On 03/11/2011 10:21 AM, Renaud Gaujoux wrote:
> >>  Thank you Georgi.
> >>  With the fix \long the output is indeed consistent with the
> >>  documentation.
> >>  I think my use of cat() worked by luck as its output should not have
> >>  been rendered.
> >>
> >>  Would a 'results=tex' (html, text) be possible? or 'results=source' that
> >>  could be combined with \if{format}{text}?
> >>  This would allow to generate custom Latex, or HTML code, but it might
> >>  also be is hazardous...
> >
> >  Yes, that's possible.  See the manual, especially the section "2.12
> >  conditional text".
> >
> >  Duncan Murdoch
>
> Conditional text is possible, but latex or html code seem to be
> preprocessed and escaped, or maybe I am not doing the right things.

Not if you ask it not to do that.  See the example in that section of 
the manual.

Duncan Murdoch

> To test:
>
> %%%%%%%%
> \name{Sexpr}
> \alias{Sexpr}
> \title{Error and verbatim in Sexpr}
> \description{
>       Testing Sexpr in Rd files
>
>       \if{html}{\Sexpr[results=text, stage=render]{"<bold>text in
> bold</bold>"}}
>       \if{text}{\Sexpr[results=text, stage=render]{"_text in bold_"}}
>       \if{latex}{\Sexpr[results=text, stage=render]{"\\\\textbf{text in
> bold}"}}
>
>
>
> }
> %%%%%%%



[Rd] R CMD check and error in an \Sexpr in an Rd file
Duncan Murdoch