ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 17 Jun 2013 10:27:55 +0200Sage Notebook, R, & problem rendering LaTeXhttps://ask.sagemath.org/question/10240/sage-notebook-r-problem-rendering-latex/Using Sage 5.9 notebook, the output of:
show(r.summary(range(10)))
... shows the LaTeX source, not the rendered LaTeX.
N.B.: My first try generated an error stating that R package 'Hmisc' was required. From:
sage -R
install_package('Hmisc')
... seemed to go fine. The notebook was restarted and:
r.installed_packages()
... showed 'Hmisc' was indeed installed.
Is there some other trick to render R LaTeX output in the notebook?
Mon, 17 Jun 2013 06:51:48 +0200https://ask.sagemath.org/question/10240/sage-notebook-r-problem-rendering-latex/Comment by kcrisman for <p>Using Sage 5.9 notebook, the output of:</p>
<pre><code>show(r.summary(range(10)))
</code></pre>
<p>... shows the LaTeX source, not the rendered LaTeX.</p>
<p>N.B.: My first try generated an error stating that R package 'Hmisc' was required. From:</p>
<pre><code>sage -R
install_package('Hmisc')
</code></pre>
<p>... seemed to go fine. The notebook was restarted and:</p>
<pre><code>r.installed_packages()
</code></pre>
<p>... showed 'Hmisc' was indeed installed.</p>
<p>Is there some other trick to render R LaTeX output in the notebook?</p>
https://ask.sagemath.org/question/10240/sage-notebook-r-problem-rendering-latex/?comment=17493#post-id-17493Just as an aside, `r.install_packages('Hmisc')` should work from the Sage notebook, if you have permissions to install stuff.Mon, 17 Jun 2013 10:15:04 +0200https://ask.sagemath.org/question/10240/sage-notebook-r-problem-rendering-latex/?comment=17493#post-id-17493Answer by kcrisman for <p>Using Sage 5.9 notebook, the output of:</p>
<pre><code>show(r.summary(range(10)))
</code></pre>
<p>... shows the LaTeX source, not the rendered LaTeX.</p>
<p>N.B.: My first try generated an error stating that R package 'Hmisc' was required. From:</p>
<pre><code>sage -R
install_package('Hmisc')
</code></pre>
<p>... seemed to go fine. The notebook was restarted and:</p>
<pre><code>r.installed_packages()
</code></pre>
<p>... showed 'Hmisc' was indeed installed.</p>
<p>Is there some other trick to render R LaTeX output in the notebook?</p>
https://ask.sagemath.org/question/10240/sage-notebook-r-problem-rendering-latex/?answer=15096#post-id-15096Took me a little bit to install this properly because of some unrelated bleeding-edge notebook issue, but here is what is happening:
\newcommand{\Bold}[1]{\mathbf{#1}}% latex.default(sage13, file = "")
%
\begin{table}[!tbp]
\begin{center}
\begin{tabular}{lr}
\hline\hline
\multicolumn{1}{l}{sage13}&\multicolumn{1}{c}{}\tabularnewline
\hline
Min.&$0.00$\tabularnewline
1st Qu.&$2.25$\tabularnewline
Median&$4.50$\tabularnewline
Mean&$4.50$\tabularnewline
3rd Qu.&$6.75$\tabularnewline
Max.&$9.00$\tabularnewline
\hline
\end{tabular}
\end{center}
\end{table}
Mathjax doesn't support non-math commands; [here](http://docs.mathjax.org/en/v1.1-latest/tex.html#environments) is a list of their supported environments, which does not include table or tabular (since they are better done in HTML). It probably doesn't support `newcommand`, either. So I think this would be something we couldn't easily fix.
You could naturally still use this code inside SageTeX or some other setting, though I'd suggest just using `latex(r.summary(range(10)))` in that case.Mon, 17 Jun 2013 10:27:55 +0200https://ask.sagemath.org/question/10240/sage-notebook-r-problem-rendering-latex/?answer=15096#post-id-15096