On Jun 21, 9:09 am, Rolf <kamha...@googlemail.com> wrote:
> This question may sound somehow out of place, but maybe you can offer
> some help.
> Where in the documentation did you find something about this fancy
> notation to include variables into your html()?

I found it on one of the published worksheets not in official Sage
docs.  That may have been a bad thing to do.  Is
html("Some string with some Latex $x^2$") valid?

"x is %d" % y is standard Python for having variables in strings.
Perhaps that is not allowed here?

The funny thing is my original code in Sci.sws works fine if you press
evaluate.  The *ONLY* problem is that it will not automatically run
thanks to %auto.

Does this new version where I moved the string tricks out of html
sound better?  (It still has the same problem in that it works when
you press evaluate but doesn't automatically run.)

%auto
%hide
@interact
def _(exponent=(-6..6)):
  first_sentence = "The Number: $%f$" % (5 * 10**exponent)
  second_sentence = "In Scientific Notation: $5 \cdot 10^{%d}$" %
exponent
  html(first_sentence)
  html(second_sentence)

> An to use two variables as in
>
> html('In Scientific Notation: ${%d} \cdot 10^{%d}$'%base%exponent)
>
> doesn't work either.

I didn't see that in http://phil4.com/public/Sci.sws.  I'm not sure
where you saw that.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to