#13504 closed enhancement (fixed)
latex_macros: don't evaluate anything on startup
Reported by: | jhpalmieri | Owned by: | jason |
---|---|---|---|
Priority: | major | Milestone: | sage-5.7 |
Component: | misc | Keywords: | latex macros |
Cc: | vbraun | Merged in: | sage-5.7.beta0 |
Authors: | John Palmieri | Reviewers: | Volker Braun |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #13717 | Stopgaps: |
Description (last modified by )
Right now, sage.misc.latex_macros
evaluates lots of things on startup. The attached patch modifies this: after the patch, the list of LaTeX macros is only computed when asked for.
There needs to be a corresponding change in sagenb: pull request
Attachments (1)
Change History (10)
Changed 9 years ago by
comment:1 Changed 9 years ago by
- Cc vbraun added
- Description modified (diff)
- Status changed from new to needs_review
comment:2 Changed 9 years ago by
comment:3 Changed 9 years ago by
latex
has more uses than just latex(x)
, which is part of the problem: latex.blackboard_bold(...)
uses sage_latex_macros
. If we define latex = LatexCall()
, then we lose
latex.add_macro latex.extra_macros latex.add_package_to_preamble_if_available latex.extra_preamble latex.add_to_mathjax_avoid_list latex.has_file latex.add_to_preamble latex.mathjax_avoid_list latex.blackboard_bold latex.matrix_delimiters latex.check_file latex.pdflatex latex.engine latex.vector_delimiters
With the patch, we should only have to do LatexCall()(x)
a few times, in latex_macros.py; elsewhere, we can just use latex(x)
.
comment:4 Changed 9 years ago by
- Status changed from needs_review to needs_work
Patch doesn't apply on sage-5.4.beta1. For starters there is no mention of mathjax in doc/common/conf.py
. Are you missing a dependency?
comment:5 Changed 9 years ago by
- Reviewers set to Volker Braun
- Status changed from needs_work to positive_review
Just noticed that I accidentally applied it to sage-5.3, not 5.4.beta1. Does indeed work fine on the newest version. Patch looks good to me.
Maybe I can interest you in reviewing #13361 which improves the measurement of the startup time?
comment:6 Changed 9 years ago by
- Dependencies set to sagenb-???
- Milestone changed from sage-5.4 to sage-pending
This obviously needs to depend on some notebook upgrade.
comment:7 Changed 9 years ago by
- Dependencies changed from sagenb-??? to #13717
comment:8 Changed 9 years ago by
- Merged in set to sage-5.7.beta0
- Resolution set to fixed
- Status changed from positive_review to closed
comment:9 Changed 9 years ago by
- Milestone changed from sage-pending to sage-5.7
Maybe I'm missing something, but can't we avoid the bracket bonanza
LatexCall()(x)
with a lazy import? As in http://www.sagemath.org/doc/reference/sage/misc/lazy_import.htmlsage.misc.latex
anywhere on startuplatex = LatexCall()
insage.misc.latex
sage.misc.all
, say