[sage-support] %latex broken in notebook

2007-03-09 Thread Mark Wooding


I'm using the Linux prebuilt binary of version 2.3, with Debian
IceWeasel 2.0.0.1.

Any attempt to use \sage{...} in a %latex cell (at leastreports `source
must be a string' and typesets [... undefined].  This is due to a bug in
misc/sage_eval.py, which insists its argument be a `str'; unfortunately,
Latex._latex_preparse attempts to pass it a `unicode'.

The following patch, against Sage 2.3, fixes the problem for me.

--- sage/misc/sage_eval.py.orig   2007-03-06 22:35:06.0 +
+++ sage/misc/sage_eval.py2007-03-09 11:41:59.0 +
@@ -101,7 +101,7 @@
 
 Here you can see eval simply will not work but \code{sage_eval} will.
 
-if not isinstance(source, str):
+if not isinstance(source, basestring):
 raise TypeError, source must be a string.
 
 import sage.all

-- [mdw]

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: HTML in the notebook

2007-03-09 Thread William Stein

Moreover, you can output arbitrary HTML as part of a normal
SAGE command and have it appear in HTML in the output.
Just wrap what you print in html and /html.  E.g.,


{{{
print 'html'
for i in range(10):
print 'bfont color=red size=+4 %o /font/bbr'%i
print '/html'
///
html
bfont color=red size=+4 0 /font/bbr
bfont color=red size=+4 1 /font/bbr
bfont color=red size=+4 2 /font/bbr
bfont color=red size=+4 3 /font/bbr
bfont color=red size=+4 4 /font/bbr
bfont color=red size=+4 5 /font/bbr
bfont color=red size=+4 6 /font/bbr
bfont color=red size=+4 7 /font/bbr
bfont color=red size=+4 10 /font/bbr
bfont color=red size=+4 11 /font/bbr
/html
}}}


On 3/9/07, David Joyner [EMAIL PROTECTED] wrote:

 HTML tables can be created in a cell. For example, paste the following
 into a cell:


 %html
 p
 table style=text-align: center; width: 100%; border=1
 cellpadding=2 cellspacing=2
 tbody
 tr
 td 1 /tdtd 2/td
 /tr
 tr
 td 3 /tdtd 1+2sup4/sup/td
 /tr
 /tbody
 /table

 However, if you put anything after the /table you'll get nothing.
 Try pasting this into a cell:

 %html
 table style=text-align: center; width: 100%; border=1
 cellpadding=2 cellspacing=2
 tbody
 tr
 td 1 /tdtd 2/td
 /tr
 tr
 td 3 /tdtd 4/td
 /tr
 /tbody
 /table
 hi = Hello World!

 I get nothing at all.


 On 3/9/07, Timothy Clemans [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I created an interesting html table and colored it, using Python. I
  tried putting the code into SAGE, but I just could not seem to get it
  to work (just a bunch of \n's).
 
  http://tclemans.nonlogic.org/table.html
 
  def dt(s):
  string = html\n
  string += head\n
  string += titleFactor Table/title\n
  string += style\n
  string += table {margin: 0; padding: 0; border: 1px solid #ccc;}\n
  string += tr {margin: 0; padding: 0; border: 1px solid #ccc;}\n
  string += td {margin: 0; padding: 0; border: 1px solid #ccc;
  width: 20px; height; 20px;}\n
  string += #yes {background: red; margin: 0; padding: 0; width;
  20px; height: 20px;}\n
  string += #no {background: blue; margin: 0; padding: 0; width;
  20px; height: 20px;}\n
  string += /style\n
  string += body\n
  string += table\n
 
  for a in range(1,s+1):
  string += tr
  for b in range(1,s+1):
  if a%b == 0:
  string += 'td id=yes/td'
  else:
  string += 'td id=no/td'
  string += /tr\n
  string += /table\n/body\n/html\n
  return string
 
  
 

 



-- 
William Stein
Associate Professor of Mathematics
University of Washington

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: HTML in the notebook

2007-03-09 Thread Timothy Clemans

It would be nice if I could create some HTML using Python and have the
web browser show it. It would also be nice to have a SAGE/HTML system
for using SAGE to generate web pages and maybe even CGI-based ones.
Maybe in the future, each user could be alloted virtual space (use
SQLite database) for creating there own databases served through the
web complete source code.

On 3/9/07, David Joyner [EMAIL PROTECTED] wrote:

 HTML tables can be created in a cell. For example, paste the following
 into a cell:


 %html
 p
 table style=text-align: center; width: 100%; border=1
 cellpadding=2 cellspacing=2
 tbody
 tr
 td 1 /tdtd 2/td
 /tr
 tr
 td 3 /tdtd 1+2sup4/sup/td
 /tr
 /tbody
 /table

 However, if you put anything after the /table you'll get nothing.
 Try pasting this into a cell:

 %html
 table style=text-align: center; width: 100%; border=1
 cellpadding=2 cellspacing=2
 tbody
 tr
 td 1 /tdtd 2/td
 /tr
 tr
 td 3 /tdtd 4/td
 /tr
 /tbody
 /table
 hi = Hello World!

 I get nothing at all.


 On 3/9/07, Timothy Clemans [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I created an interesting html table and colored it, using Python. I
  tried putting the code into SAGE, but I just could not seem to get it
  to work (just a bunch of \n's).
 
  http://tclemans.nonlogic.org/table.html
 
  def dt(s):
  string = html\n
  string += head\n
  string += titleFactor Table/title\n
  string += style\n
  string += table {margin: 0; padding: 0; border: 1px solid #ccc;}\n
  string += tr {margin: 0; padding: 0; border: 1px solid #ccc;}\n
  string += td {margin: 0; padding: 0; border: 1px solid #ccc;
  width: 20px; height; 20px;}\n
  string += #yes {background: red; margin: 0; padding: 0; width;
  20px; height: 20px;}\n
  string += #no {background: blue; margin: 0; padding: 0; width;
  20px; height: 20px;}\n
  string += /style\n
  string += body\n
  string += table\n
 
  for a in range(1,s+1):
  string += tr
  for b in range(1,s+1):
  if a%b == 0:
  string += 'td id=yes/td'
  else:
  string += 'td id=no/td'
  string += /tr\n
  string += /table\n/body\n/html\n
  return string
 
  
 

 


--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---