#14839: Calling latex(...) shouldn't typeset the result
----------------------------------------------+-----------------------------
Reporter: iandrus | Owner: was
Type: enhancement | Status: positive_review
Priority: minor | Milestone:
sage-duplicate/invalid/wontfix
Component: user interface | Resolution:
Keywords: latex notebook typesetting | Work issues:
Report Upstream: N/A | Reviewers: Volker Braun
Authors: | Merged in:
Dependencies: | Stopgaps:
----------------------------------------------+-----------------------------
Comment (by was):
The design of "typeset mode" in sagenb isn't so good in my opinion. For
the record, I've implemented something similar for
https://cloud.sagemath.com, which correctly handles the above problem in
an extensible way. Here's the *complete* code for the entire thing:
{{{
_system_sys_displayhook = sys.displayhook
import sage.misc.latex, types
TYPESET_MODE_EXCLUDES = (sage.misc.latex.LatexExpr, types.NoneType)
def typeset_mode(on=True):
"""
Turn typeset mode on or off. When on, each output is typeset using
LaTeX.
EXAMPLES::
typeset_mode() # turns typesetting on
typeset_mode(False) # turn typesetting off
"""
if on:
def f(obj):
if isinstance(obj, TYPESET_MODE_EXCLUDES):
_system_sys_displayhook(obj)
else:
salvus.tex(obj)
sys.displayhook = f
else:
sys.displayhook = _system_sys_displayhook
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14839#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.