Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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:

Status badges

Description (last modified by jhpalmieri)

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)

trac_13504-latex-macros.patch (9.3 KB) - added by jhpalmieri 9 years ago.

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by jhpalmieri

comment:1 Changed 9 years ago by jhpalmieri

  • Cc vbraun added
  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 9 years ago by vbraun

Maybe I'm missing something, but can't we avoid the bracket bonanza LatexCall()(x) with a lazy import? As in

  • don't import sage.misc.latex anywhere on startup
  • define an instance latex = LatexCall() in sage.misc.latex
  • lazy import it from sage.misc.all, say

comment:3 Changed 9 years ago by jhpalmieri

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; elsewhere, we can just use latex(x).

comment:4 Changed 9 years ago by vbraun

  • 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/ Are you missing a dependency?

comment:5 Changed 9 years ago by vbraun

  • 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 jdemeyer

  • 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 kini

  • Dependencies changed from sagenb-??? to #13717

comment:8 Changed 9 years ago by jdemeyer

  • 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 jdemeyer

  • Milestone changed from sage-pending to sage-5.7
Note: See TracTickets for help on using tickets.