# Outputing lists without brackets in SageTeX

Hi,

how can I output a list in SageTeX without it being enclosed in brackets? Consider for example:

\begin{sagesilent}
A = [ 1, 2, 4 ]
\end{sagesilent}


and in the text

... $A = \{ \sage{A} \}$


produces $A = \{ \left[1, 2, 4\right] \}$ instead of $\{ 1,2,4 \}$. Or a more realistic example:

\begin{sagesilent}
R.<x,y> = PolynomialRing(QQ, 'x,y', order='lex')
I = R.ideal(x^2+1, y*x-y)
\end{sagesilent}


and know somewhere in the text I want to put

The Groebner basis of $I$ is $\{ \sage{I.groebner_basis()} \}$


but the result is: $\{ \left[x^{2} + 1, y\right] \}$ rather then expected $\{ x^{2} + 1, y \}$

edit retag close merge delete

Sort by ยป oldest newest most voted

Well, instead of adding the {} by yourself why don't you let Sage do it instead ? You could write

... $A = \sage{Set(A)}$


... $A = \{ \sage{A} \}$


And

$\sage{Set(I.groebner_basis())}$


$\{ \sage{I.groebner_basis()} \}$

more

1

Thanks for your reply. It indeed solves the problem in two example cases I presented, but... still I sometimes need yet another delimiters around the sage's output (e.g $\langle$ or $\langle\langle$...)

( 2013-06-29 05:19:40 +0200 )edit