Or, if you don't like constantly having to repeat the variable name, something like:
sage: def vshow(_v): ....: print '%s = %s\n' % (_v,latex(globals()[_v])) ....: sage: var('q') q sage: a = 3*q/2 sage: vshow('a') a = \frac{{3 q}}{2} This is far from an ideal solution, as if you call it from within another function, you may have to change 'globals()' to 'locals()' or get even a bit more complex by trying locals first, then globals ... Samuel Gaehwiler wrote: > hi, > > I use sage (in notebook mode) for basic calculations on a daily basis. > I also like to print out my calculations and hand it in with my > exercise. > Since the people who correct them here at the ETH university in Z�rich > are not familiar with sage, I would like to print every result with > the variable-name in front of it. > > i.e. > sage> a_2 = 2/3+1 > sage> show(a_2) > > a_2 = 5/3 (nicly formated, as if typsetted in latex) > > is this somehow possible? (is there an argument for show() I've > missed, or maybe a little phyton script?) > > best regards, > Samuel --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---