Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found a hack that "works sufficiently well" (but requires to put a symbolic link in your working directory). It goes as follows:

  • At the root of your tree (the directory which is displayed when you visit http://localhost:8888/tree), put a symbolic link to your temporary sage folder. In bash (linux) I did it via the command ln -s .sage/temp/ ./tmp_sage_cells
  • then define the function my_view as follows:

def my_view(e,density=150,extra=""): tf=tmp_filename(name="png_cell",ext=".png") sage.misc.latex.png(e,tf,density=density) pretty_print(html('<img src="http://localhost:8888/tree/tmp_sage_cells/%s" %s>'%(tf.split(r".sage/temp/")[1],extra)))

(I'm sorry I don't know the syntax to display the code more nicely)

You can test the function with my_view(graphs.CompleteGraph(4)) or my_view(graphs.CompleteGraph(4),density=50,extra='style="height:100px;"') for fancier options. This function my_view is a small variation from the functions defined in /sagemath/local/lib/python2.7/site-packages/sage/misc/latex.py

I found a hack that "works sufficiently well" (but requires to put a symbolic link in your working directory). It goes as follows:

  • At the root of your tree (the directory which is displayed when you visit http://localhost:8888/tree), put a symbolic link to your temporary sage folder. In bash (linux) I did it via the command ln -s .sage/temp/ ./tmp_sage_cells
  • then define the function my_view as follows:

def my_view(e,density=150,extra=""): my_view(e,density=150,extra=""): tf=tmp_filename(name="png_cell",ext=".png") tf=tmp_filename(name="png_cell",ext=".png") sage.misc.latex.png(e,tf,density=density) sage.misc.latex.png(e,tf,density=density) pretty_print(html('<img src="http://localhost:8888/tree/tmp_sage_cells/%s" %s>'%(tf.split(r".sage/temp/")[1],extra)))

(I'm sorry I don't know the syntax to display the code more nicely)

You can test the function with my_view(graphs.CompleteGraph(4)) or my_view(graphs.CompleteGraph(4),density=50,extra='style="height:100px;"') for fancier options. This function my_view is a small variation from the functions defined in /sagemath/local/lib/python2.7/site-packages/sage/misc/latex.py

I found a hack that "works sufficiently well" (but requires to put a symbolic link in your working directory). It goes as follows:

  • At the root of your tree (the directory which is displayed when you visit http://localhost:8888/tree), put a symbolic link to your temporary sage folder. In bash (linux) I did it via the command ln -s .sage/temp/ ./tmp_sage_cells
  • then define the function my_view below:

def my_view(e,density=150,extra=""):
    tf=tmp_filename(name="png_cell",ext=".png")
    sage.misc.latex.png(e,tf,density=density)
    pretty_print(html('<img src="http://localhost:8888/tree/tmp_sage_cells/%s" %s>'%(tf.split(r".sage/temp/")[1],extra)))

You can test the function with my_view(graphs.CompleteGraph(4)) or my_view(graphs.CompleteGraph(4),density=50,extra='style="height:100px;"') for fancier options. This function my_view is a small variation from the functions defined in /sagemath/local/lib/python2.7/site-packages/sage/misc/latex.py