Opened 8 years ago

Closed 8 years ago

#16557 closed enhancement (fixed)

FiniteStateMachine - LaTeX output in notebook

Reported by: cheuberg Owned by:
Priority: minor Milestone: sage-6.3
Component: finite state machines Keywords: finite_state_machine, latex
Cc: skropf, dkrenn, elixyre, ncohen Merged in:
Authors: Clemens Heuberger Reviewers: Jean-Baptiste Priez
Report Upstream: N/A Work issues:
Branch: 1bfb513 (Commits, GitHub, GitLab) Commit: 1bfb513ca3a9dc11a232bdd6ee31625fe5822572
Dependencies: Stopgaps:

Status badges

Description (last modified by cheuberg)

In #16020, graphs.setup_latex_preamble has been modified to include tikz into the mathjax avoid list so that graphs can be rendered more easily in the sage notebook. This ticket does the same for finite_state_machine.setup_latex_preamble.

Moreover, finite_state_machine.setup_latex_preamble is now loaded automatically (as it is the case in the graphs module).

Change History (6)

comment:1 Changed 8 years ago by cheuberg

  • Status changed from new to needs_review

comment:2 Changed 8 years ago by elixyre

  • Reviewers set to Jean-Baptiste Priez
  • Status changed from needs_review to needs_work

In #16020, we don't need to call:

sage.combinat.finite_state_machine.setup_latex_preamble()

to see some multi-graphs. It could be convenient to directly load these lines:

latex.add_package_to_preamble_if_available('tikz')
latex.add_to_mathjax_avoid_list("tikz")
latex.add_to_preamble('\\usetikzlibrary{automata}')

when we load the file.

It seems to me, that is not disturbing to load these lines... but it is disturbing to have to call this method to draw some automata.

Cheers,

Jean-Baptiste Priez

comment:3 Changed 8 years ago by git

  • Commit changed from 2ac09bc134bde5ae44d326bd9ad2a4266fb7f2c6 to 1bfb513ca3a9dc11a232bdd6ee31625fe5822572

Branch pushed to git repo; I updated commit sha1. New commits:

dbc80a0Automatically call setup_latex_preamble
1bfb513Forgot to import cached_function

comment:4 Changed 8 years ago by cheuberg

  • Description modified (diff)
  • Status changed from needs_work to needs_review

Thanks for pointing this out, I was not aware of the fact that the graphs module calls setup_latex_preamble automatically. Therefore, I submitted a patch for adapting the documentation of the graphs module (#16620).

So, we now call setup_latex_preamble automatically (not when first loading the file as suggested, but when _latex_ is called as the graphs module does). To reduce overhead, setup_latex_preamble is now a cached function (as in the graphs module). Finally, the documentation has been adapted to reflect the change.

comment:5 Changed 8 years ago by elixyre

  • Status changed from needs_review to positive_review

comment:6 Changed 8 years ago by vbraun

  • Branch changed from u/cheuberg/fsm/mathjax-avoid-tikz to 1bfb513ca3a9dc11a232bdd6ee31625fe5822572
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.