On 05/05/2009 5:04 AM, robin hankin wrote:
Hi Duncan

I asked this question to R-devel, and there was no reply, so I thought
I'd ask you
directly.  Any ideas?

best wishes

Robin




I am having difficulty including a LaTeX formula in an Rd
file.

The example given in section 2.7 in 'Parsing Rd files' is:


    \deqn{ f(x) = \left\{
      \begin{array}{ll}
      0 & x<0 \\
      1 & x\ge 0
      \end{array}
      \right. }{non latex}


For me, this gives:

\deqn{ f(x) = \left\{
\begin{array}{ll}
0 \& x<0 \bsl{}
1 \& x\ge 0
\end{array}
\right. }{}

in the tex file, which is not  desired because the ampersand
is escaped; the '&' symbol appears in the dvi file, and I
want an ampersand  to indicate  alignment.

Also, the '\\' appears as \bsl{}, which is undesired; the
 resulting dvi file (made by R CMD Rd2dvi) looks wrong.

How do I write the Rd file so as to produce non-escaped
ampersands?

I think the way the docs show it should work but there's a bug in the conversion. If you use the new converter tools::Rd2latex, it comes out as expected. So there's a bug in the Perl version of Rdconv, presumably in share/perl/R/Rdconv.pm, and you might want to try to track it down and fix it if you know Perl well enough. An alternative might be some kludge involving \input{}: put the equation in its own file where Rdconv will ignore it.

I've cc'd R-devel on this again; maybe someone else can jump in with a better idea.

Duncan Murdoch

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to