Processing math: 100%
Ask Your Question
1

Outputing lists without brackets in SageTeX

asked 11 years ago

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={[1,2,4]} 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: {[x2+1,y]} rather then expected {x2+1,y}

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

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()} \}$
Preview: (hide)
link

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

pkoprowski gravatar imagepkoprowski ( 11 years ago )

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: 554 times

Last updated: Jun 27 '13