Ask Your Question
0

Sage Notebook, R, & problem rendering LaTeX

asked 2013-06-17 06:51:48 +0100

rickhg12hs gravatar image

updated 2013-06-17 07:15:04 +0100

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?

edit retag flag offensive close merge delete

Comments

1

Just as an aside, `r.install_packages('Hmisc')` should work from the Sage notebook, if you have permissions to install stuff.

kcrisman gravatar imagekcrisman ( 2013-06-17 10:15:04 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-17 10:27:55 +0100

kcrisman gravatar image

Took 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 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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-06-17 06:51:48 +0100

Seen: 475 times

Last updated: Jun 17 '13