Getting LaTeX code from Sage when running %display latex
I typically use
%display latex
at the beginning of all of my worksheets, so that the equations are rendered in LaTeX (when using .display(), for example). However, now I want to copy some of these equations into a LaTeX document, and I can't figure out how to "revert" them back to code. All my view(eq), print(eq), latex(eq.display()) all seem to spit out the rendered tex, or sometimes information about the object, like "rank 2 tensor g".
Is there a way I can do this without removing the display command at the beginning and re-running the sheet?
EDIT: Maybe more info is needed. I'm running Jupyter notebooks, Sage 8.7 on a linux machine. I'm pretty sure I used the Ubuntu binaries in this case to install.
Right click on any equation to open the MathJax contextual menu. Choose Show Math As and then TeX Commands. This opens a small window with the LaTeX source used to render the equation. You can copy the contents of this window.
By the way, to revert the effect of
%display latex
, you can use%display default
or%display plain
. However, you then need to reevaluate the cells.I marked below as answer, but this totally works as well.