Beispiel #1
0
try:
    from sage.misc.misc import SAGE_URL
except ImportError:
    SAGE_URL = 'http://sagemath.org'

try:
    from sage.misc.misc import SAGE_DOC
except ImportError:
    SAGE_DOC = "stub"

# TODO: Get macros from server and user settings.
try:
    import sage.all
    from sage.misc.latex_macros import sage_mathjax_macros
    mathjax_macros = sage_mathjax_macros()
except ImportError:
    mathjax_macros = [
        "ZZ : '{\\\\Bold{Z}}'", "RR : '{\\\\Bold{R}}'", "CC : '{\\\\Bold{C}}'",
        "QQ : '{\\\\Bold{Q}}'", "QQbar : '{\\\\overline{\\\\QQ}}'",
        "GF : ['{\\\\Bold{F}_{#1}}', 1]", "Zp : ['{\\\\ZZ_{#1}}', 1]",
        "Qp : ['{\\\\QQ_{#1}}', 1]", "Zmod : ['{\\\\ZZ/#1\\\\ZZ}', 1]",
        "CIF : '{\\\\Bold{C}}'", "CLF : '{\\\\Bold{C}}'",
        "RDF : '{\\\\Bold{R}}'", "RIF : '{\\\\Bold{I} \\\\Bold{R}}'",
        "RLF : '{\\\\Bold{R}}'", "CFF : '{\\\\Bold{CFF}}'",
        "Bold : ['{\\\\mathbf{#1}}', 1]"
    ]
except Exception:
    sage_mathjax_macros_easy = []
    raise
try:
Beispiel #2
0
elif os.environ.has_key('DOT_SAGE'):
    DOT_SAGENB = os.environ['DOT_SAGE']
else:
    DOT_SAGENB = os.path.join(os.environ['HOME'], '.sagenb')

try:
    from sage.env import SAGE_URL
except ImportError:
    SAGE_URL = 'http://sagemath.org'


# TODO: Get macros from server and user settings.
try:
    import sage.all
    from sage.misc.latex_macros import sage_mathjax_macros
    mathjax_macros = sage_mathjax_macros()
except ImportError:
    mathjax_macros = [
        "ZZ : '{\\\\Bold{Z}}'",
        "RR : '{\\\\Bold{R}}'",
        "CC : '{\\\\Bold{C}}'",
        "QQ : '{\\\\Bold{Q}}'",
        "QQbar : '{\\\\overline{\\\\QQ}}'",
        "GF : ['{\\\\Bold{F}_{#1}}', 1]",
        "Zp : ['{\\\\ZZ_{#1}}', 1]",
        "Qp : ['{\\\\QQ_{#1}}', 1]",
        "Zmod : ['{\\\\ZZ/#1\\\\ZZ}', 1]",
        "CIF : '{\\\\Bold{C}}'",
        "CLF : '{\\\\Bold{C}}'",
        "RDF : '{\\\\Bold{R}}'",
        "RIF : '{\\\\Bold{I} \\\\Bold{R}}'",
Beispiel #3
0
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [os.path.join(SAGE_DOC, "common/static"), "static"]

# We use MathJax to build the documentation unless the environment
# variable SAGE_DOC_MATHJAX is set to "no" or "False".  (Note that if
# the user does not set this variable, then the script sage-env sets
# it to "True".)

if os.environ.get("SAGE_DOC_MATHJAX", "no") != "no" and os.environ.get("SAGE_DOC_MATHJAX", "no") != "False":

    extensions.append("sphinx.ext.mathjax")
    mathjax_path = "MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js"

    from sage.misc.latex_macros import sage_mathjax_macros

    html_theme_options["mathjax_macros"] = sage_mathjax_macros()

    from pkg_resources import Requirement, working_set

    sagenb_path = working_set.find(Requirement.parse("sagenb")).location
    mathjax_relative = os.path.join("sagenb", "data", "mathjax")

    # It would be really nice if sphinx would copy the entire mathjax directory,
    # (so we could have a _static/mathjax directory), rather than the contents of the directory

    mathjax_static = os.path.join(sagenb_path, mathjax_relative)
    html_static_path.append(mathjax_static)
    exclude_patterns = [
        "**/" + os.path.join(mathjax_relative, i) for i in ("docs", "README*", "test", "unpacked", "LICENSE")
    ]
else:
Beispiel #4
0
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [os.path.join(SAGE_DOC_SRC, 'common', 'static'), 'static']

# We use MathJax to build the documentation unless the environment
# variable SAGE_DOC_MATHJAX is set to "no" or "False".  (Note that if
# the user does not set this variable, then the script sage-env sets
# it to "True".)

if (os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'no'
            and os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'False'):

    extensions.append('sphinx.ext.mathjax')
    mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js'

    from sage.misc.latex_macros import sage_mathjax_macros
    html_theme_options['mathjax_macros'] = sage_mathjax_macros()

    from pkg_resources import Requirement, working_set
    sagenb_path = working_set.find(Requirement.parse('sagenb')).location
    mathjax_relative = os.path.join('sagenb','data','mathjax')

    # It would be really nice if sphinx would copy the entire mathjax directory,
    # (so we could have a _static/mathjax directory), rather than the contents of the directory

    mathjax_static = os.path.join(sagenb_path, mathjax_relative)
    html_static_path.append(mathjax_static)
    exclude_patterns += ['**/'+os.path.join(mathjax_relative, i)
                         for i in ('docs', 'README*', 'test',
                                   'unpacked', 'LICENSE')]
else:
     extensions.append('sphinx.ext.pngmath')
Beispiel #5
0
    os.path.join(SAGE_DOC_SRC, 'common', 'static'), THEBE_DIR, 'static'
]

# We use MathJax to build the documentation unless the environment
# variable SAGE_DOC_MATHJAX is set to "no" or "False".  (Note that if
# the user does not set this variable, then the script sage-env sets
# it to "True".)

if (os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'no'
        and os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'False'):

    extensions.append('sphinx.ext.mathjax')
    mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js'

    from sage.misc.latex_macros import sage_mathjax_macros
    html_theme_options['mathjax_macros'] = sage_mathjax_macros()

    mathjax_relative = 'mathjax'

    # It would be really nice if sphinx would copy the entire mathjax directory,
    # (so we could have a _static/mathjax directory), rather than the contents of the directory

    mathjax_static = os.path.join(SAGE_SHARE, mathjax_relative)
    html_static_path.append(mathjax_static)
    exclude_patterns += [
        '**/' + os.path.join(mathjax_relative, i)
        for i in ('docs', 'README*', 'test', 'unpacked', 'LICENSE')
    ]
else:
    extensions.append('sphinx.ext.imgmath')