Ask Your Question

Revision history [back]

I had a further look at this, and it seems that there are many variables named EMBEDDED_MODE, which are set to False in their respective module and set to True in sage/server/support.py (and modified is some doctests) :

sage.server.support.EMBEDDED_MODE
sage.plot.plot.EMBEDDED_MODE
sage.misc.latex.EMBEDDED_MODE
sage.misc.pager.EMBEDDED_MODE
sage.misc.sageinspect.EMBEDDED_MODE

Hence, they will provide the right information unless someone (like the user) set one of them to a different value to get some particuler behaviour for some particular module, independently of whether the notebook is running or not.

The one that seems more appropriate is sage.server.support.EMBEDDED_MODE, and actually it is called by the function embedded() whose doctest claims to give the right answer:

Return True if this copy of Sage is running embedded in the Sage
notebook.

Hence it seems that the right call is:

sage: misc.embedded()
False

Which is also the shortest :)

I had a further look at this, and it seems that there are many variables named EMBEDDED_MODE, which are set to False by default in their respective module and set to True in sage/server/support.py when the notebook is running (and also modified is some doctests) :

sage.server.support.EMBEDDED_MODE
sage.plot.plot.EMBEDDED_MODE
sage.misc.latex.EMBEDDED_MODE
sage.misc.pager.EMBEDDED_MODE
sage.misc.sageinspect.EMBEDDED_MODE

Hence, they will provide the right information unless someone (like the user) set one of them to a different value to get some particuler behaviour for some particular module, independently of whether the notebook is running or not.

The one that seems more appropriate is sage.server.support.EMBEDDED_MODE, and actually it is called by the function embedded() whose doctest claims to give the right answer:

Return True if this copy of Sage is running embedded in the Sage
notebook.

Hence it seems that the right call is:

sage: misc.embedded()
False

Which is also the shortest :)