1 | initial version |
Note that in the question you reference, the show()
functions are not in the same line as the print
statements. The return value of show
is what would go in the print statement, but what you want is what the show
function does, which depends on whether you are in a notebook, etc. Embedded in a print statement I wouldn't know what to expect in general.
See this example in the Sage cell server to see what I mean:
a = 1
print a
print show(latex(a))
show(latex(a))
Note that this one does seem to do something for the print, but probably this depends on the frontend. Also notice the None
printed at the end - that is what show
returns.
2 | No.2 Revision |
Note that in the question you reference, the show()
functions are not in the same line as the print
statements. The return value of show
is what would go in the print statement, but what you want is what the show
function does, which depends on whether you are in a notebook, etc. Embedded in a print statement I wouldn't know what to expect in general.
See this example in the Sage cell server to see what I mean:
a = 1
print a
print show(latex(a))
show(latex(a))
Note that this one does seem to do something for the print, but probably this depends on the frontend. Also notice the None
printed at the end - that is what show
returns.
Edit: For what you want to do, you might want something along the lines of this:
a = matrix(2,[1,2,3,4])
pretty_print(html("This is the matrix $%s$"%(latex(a))))
Sorry that it wasn't clear to me initially what you actually desired as output.