First time here? Check out the FAQ!

Ask Your Question
0

Sage Notebook, R, & problem rendering LaTeX

asked 11 years ago

rickhg12hs gravatar image

updated 11 years ago

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?

Preview: (hide)

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 ( 11 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

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.

Preview: (hide)
link

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: 11 years ago

Seen: 516 times

Last updated: Jun 17 '13