Skip to content

Re-enable typeset output in Emacs' *Sage* buffer. #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions emacs_sage_shell_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from emacs_sage_shell import ip
from sage.repl.rich_output.output_basic import OutputLatex
from sage.repl.rich_output.output_basic import OutputLatex, OutputPlainText
from sage.repl.rich_output.output_browser import OutputHtml

from sage.repl.rich_output.output_catalog import OutputImagePng
from sage.repl.rich_output.preferences import DisplayPreferences
Expand All @@ -43,6 +44,9 @@ def __init__(self, text=True, plot=True):
def default_preferences(self):
return DisplayPreferences(text=self.__text)

def supported_output(self):
return [OutputLatex , OutputPlainText , OutputHtml , OutputImagePng]

def _repr_(self):
return "Emacs babel"

Expand All @@ -52,7 +56,7 @@ def displayhook(self, plain_text, rich_output):
msg = "BEGIN_PNG:%s:END_PNG" % msg
return ({u'text/plain': msg}, {})

elif isinstance(rich_output, OutputLatex):
elif isinstance(rich_output, OutputHtml):
text = "BEGIN_TEXT:" + str(plain_text.text.get(), 'utf-8') + ":END_TEXTBEGIN_LATEX:" + \
str(rich_output.latex.get(), 'utf-8') + ":END_LATEX"
return ({'text/plain': text}, {})
Expand Down
5 changes: 4 additions & 1 deletion sage-shell-view.el
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ computes the resolution automatically."
sage-shell-view-latex-documentclass
sage-shell-view-latex-preamble
sage-shell-view-latex-math-environment
math-expr
;; math-expr
(replace-regexp-in-string
"^\$+" ""
(replace-regexp-in-string "\$+$" "" math-expr))
sage-shell-view-latex-math-environment))

(defun sage-shell-view-dir-name ()
Expand Down