Hi,
This is a problem about writing R documentation (R-exts 2.6). The
command "\deqn" defined in "Rd.sty" is:
\newcommand{\deqn}[2]{\[#1\]}
which will put mathematical formulae in the "displaymath" environment;
that means line breaks are not allowed (or will not be shown) in
formulae, but sometimes we do need multiple lines of formulae. One
solution is to write several equations using "\deqn", but I think to
change the definition of "\deqn" is better:
\newcommand{\deqn}[2]{\begin{eqnarray*}#1\end{eqnarray*}}
This will not change the pdfLaTeX output effect, moreover, line breaks
and alignments using "&" will be available in math formulae.
Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China
Line breaks in mathematical formulae in Rd files (PR#13287)
3 messages · Brian Ripley, Yihui Xie
I think the 'problem' is a lack of attention to the manual. deqn gives ?displayed equations? (as in LaTeX's displaymath environment, or TeX's $$...$$). seems pretty clear to me, and I hope to any LaTeX user.
On Fri, 14 Nov 2008, xieyihui at gmail.com wrote:
Hi,
This is a problem about writing R documentation (R-exts 2.6). The
command "\deqn" defined in "Rd.sty" is:
\newcommand{\deqn}[2]{\[#1\]}
which will put mathematical formulae in the "displaymath" environment;
Well, surprise, surprise it does what it is documented to do!
that means line breaks are not allowed (or will not be shown) in
formulae, but sometimes we do need multiple lines of formulae. One
solution is to write several equations using "\deqn", but I think to
change the definition of "\deqn" is better:
\newcommand{\deqn}[2]{\begin{eqnarray*}#1\end{eqnarray*}}
That will change the spacing.
This will not change the pdfLaTeX output effect, moreover, line breaks and alignments using "&" will be available in math formulae.
Not to the non-latex conversions.
Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thanks, Prof Ripley, I do have noticed the manual; what I mean is the "displaymath" environment might not be appropriate for R documentation when there are multiple lines of formulae; I'm sorry this seems to be a suggestion rather than a bug... According to your response, the only solution is write several displayed equations when a single equation is too long? Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China On Sat, Nov 15, 2008 at 12:29 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
I think the 'problem' is a lack of attention to the manual. deqn gives "displayed equations" (as in LaTeX's displaymath environment, or TeX's $$...$$). seems pretty clear to me, and I hope to any LaTeX user. On Fri, 14 Nov 2008, xieyihui at gmail.com wrote:
Hi,
This is a problem about writing R documentation (R-exts 2.6). The
command "\deqn" defined in "Rd.sty" is:
\newcommand{\deqn}[2]{\[#1\]}
which will put mathematical formulae in the "displaymath" environment;
Well, surprise, surprise it does what it is documented to do!
I didn't mean there was something wrong - I was just explaining the definition which could be modified as below.
that means line breaks are not allowed (or will not be shown) in
formulae, but sometimes we do need multiple lines of formulae. One
solution is to write several equations using "\deqn", but I think to
change the definition of "\deqn" is better:
\newcommand{\deqn}[2]{\begin{eqnarray*}#1\end{eqnarray*}}
That will change the spacing.
This will not change the pdfLaTeX output effect, moreover, line breaks and alignments using "&" will be available in math formulae.
Not to the non-latex conversions.
OK, I see. Thanks!
Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595