Ask Your Question
1

Outputing lists without brackets in SageTeX

asked 2013-06-27 08:37:27 +0200

pkoprowski gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-27 11:30:21 +0200

Nathann gravatar image

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

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

instead of

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

And

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

instead of

$\{ \sage{I.groebner_basis()} \}$
edit flag offensive delete link more

Comments

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$...)

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

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-27 08:37:27 +0200

Seen: 443 times

Last updated: Jun 27 '13