Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm putting this in a different answer spot because I think you have a different question than I first thought.

What is your use case? Here are two ways to get nice-looking TeX-ish code in the notebook.

  1. Use a text cell! Move your cursor until you see a thin blue line between two regular math cells, and then press Shift at the same time as you click. Now you get a nice WYSIWYG editor, with the advantage that most things you put between $xyz$ or $$xyz$$ will end up looking like $xyz$ or $$xyz\; .$$ This is how I usually get nicely TeXed stuff.
  2. Use the html() command. You can often get good stuff from that - such as html("I like the number $%s$"%5) becomes "I like the number $5$." This requires a little use of string formatting if you want to have a variable input, but otherwise should behave normally with respect to LaTeX. I use this in interactive cells a lot.

I do not know why the %latex gives such unsatisfactory results, but my guess is that it's using some inferior font in the browser, as opposed to the jsmath fonts, which the two solutions above will use. I really don't know why sws2tex would have problems with this, but remember that sws2tex isn't necessarily about converting percent directives, but just normal Sage input. In any case, I don't think you need %latex, given the two options above - but if you do, please reply!