Opened 9 years ago

Closed 9 years ago

#16207 closed enhancement (fixed)

FiniteStateMachine._latex_: more options, better documentation

Reported by: Clemens Heuberger Owned by:
Priority: major Milestone: sage-6.3
Component: combinatorics Keywords: finite_state_machine
Cc: Daniel Krenn, Sara Kropf Merged in:
Authors: Clemens Heuberger Reviewers: Daniel Krenn
Report Upstream: N/A Work issues:
Branch: e5a3191 (Commits, GitHub, GitLab) Commit: e5a31912c6ab32068484eb7b4008cecf896c5d75
Dependencies: #16132, #16145, #16146, #16200, #16205 Stopgaps:

Status badges

Description

Improved FiniteStateMachine._latex_:

  • use state iterators instead of lists
  • move code format_transition_label
  • collect tikz options in array
  • typeset final_word_out, introduce relevant options: if a final state has an attribute final_word_out, this is typeset as a leaving edge. This is in preparation for #16191
  • new method latex_options: Provide a new convenience function collecting all options for LaTeX output. While all of its functionality can also be achieved by directly setting attributes of FiniteStateMachine, FSMState and FSMTransition, this function also (somewhat) checks its input and serves to collect documentation on all these options.
  • Added a section in the introduction to the module explaining how to latex a FiniteStateMachine? and pointing to this method for details.
  • Similarly, expanded explanations in setup_latex_preamble.
  • Use latex_options in other doctest instead of direct attribute assignment
  • new method default_format_transition_label: Previously, when no custorm FiniteStateMachine.format_transition_label was provided by the user, words have simply typeset by calling latex. As words are always lists, parentheses [ ] have always been printed. This new default method typesets words by juxtaposition of their letters, the letters are piped through format_letter first. The latter now defaults to latex.

Finally, format_transition_label is by default set to default_format_transition_label in the hope of providing a sensible default value.

  • Convenience Formatting functions for digit problems: When using negative digits, it is quite customary to write e.g. \overline{1} instead of -1 in LaTeX. Introduce FiniteStateMachine.format_letter_negative for this purpose.

Furthermore, In digit expansions, digits are frequently processed from the least significant to the most significant position, but it is customary to write the least significant digit at the right-most position. Therefore, the labels have to be reversed. Provide a method FiniteStateMachine.format_transition_label_reversed for this purpose.

Change History (14)

comment:1 Changed 9 years ago by git

Commit: d6661e70a561f949bab7b3f5e319e9f4d48a53b653a700c61f5f05d3193b712483dbca169055e25a

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

fe9b380marked 3 doctests as indirect
92526f6Merge branch 'fsm/latex-initial-state-new' into fsm/latex-rotate-labels-new
0bd8c5aMerge branch 'fsm/latex-rotate-labels-new' #16205 into fsm/latex-improved
2438f93replaced range by srange
1e294f2replace \overline{-1} by \overline{1}
53a700cMoved FiniteStateMachine._latex_.accepting_where to finite_state_machine.tikz_automata_where

comment:2 Changed 9 years ago by Clemens Heuberger

Status: newneeds_review

comment:3 Changed 9 years ago by git

Commit: 53a700c61f5f05d3193b712483dbca169055e25a4aee51173f9a97e6a5ab07a2a84f425fdc070ec3

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

2d43fddFiniteStateMachine: add failing doctests: non-hashable colors
547968aFiniteStateMachine.product_FiniteStateMachine, composition: fix unhashable colors
d51be51Automaton.determinisation(): docstring on hashable colors
c5dd860Merge branch 'fsm/state_color' into fsm/process_output_new
70294bftrac ticket number added
ed93dd3Minor changes during review.
3820c49corrected whitespaceerror
a14dd81Merge remote-tracking branch 'origin/u/dkrenn/ticket/16132' into fsm/process_output_new-on-beta8
afc15e5Replaced two raise ..., ... by raise ...(...) in the spirit of #15990
4aee511Merge ticket #16132 into #16207 in order to resolve merge conflict.

comment:4 Changed 9 years ago by Clemens Heuberger

Dependencies: #16146, #16200, #16205#16132, #16146, #16200, #16205

Merged #16132, otherwise, this will not merge (commit 53a700c introduced a new module local variable at the same position where #16132 did the same).

comment:5 Changed 9 years ago by Clemens Heuberger

trac's automerge fails. Patch is based on 6.2.beta8, it merges cleanly with 6.2.rc0.

comment:6 Changed 9 years ago by Daniel Krenn

Reviewers: Daniel Krenn

comment:7 Changed 9 years ago by git

Commit: 4aee51173f9a97e6a5ab07a2a84f425fdc070ec356b1d48dfeef86415338ffe06f1de7ec6ef61142

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

a6a417dFiniteStateMachine._latex_: write final_word_out as "$ | output"
1f14955FiniteStateMachine._latex_: use tikz arrow style "latex"
56b1d48default accepting_distance=7ex because of $ in final output

comment:8 Changed 9 years ago by git

Commit: 56b1d48dfeef86415338ffe06f1de7ec6ef61142a0d894ef1c76c66cc17382599492487549be9314

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

f13725dasymptotic_moments: add explanation on PolynomialRing vs SymbolicRing
878acffasymptotic_moments: replaced parameter verbose by sage.misc.misc.verbose
40da528Explanations for >1 final components, periodic final components
00e063easymptotic_moments: upgraded two tests to examples
1908a5dasymptotic_moments: unique initial states, all states are final
78997f5Corrected and improved version of commit 40da528
d56a769Rewrote asymptotic_moments to output en+Order(1) etc.
24b6d69explained the shifting in the Gray code-construction differently
0b1200dMerge branch 't/16143/fsm/example_gray_code' into fsm/asymptotic-moments
a0d894eMerge remote-tracking branch 'aau/fsm/asymptotic-moments' into fsm/latex-options-digits

comment:9 Changed 9 years ago by Clemens Heuberger

Dependencies: #16132, #16146, #16200, #16205#16132, #16145, #16146, #16200, #16205

comment:10 Changed 9 years ago by Clemens Heuberger

merged #16145 in order to avoid a merge conflict and listed #16145 as a dependency.

comment:11 Changed 9 years ago by Daniel Krenn

Branch: u/cheuberg/fsm/latex-improvedu/dkrenn/fsm/latex-improved

comment:12 Changed 9 years ago by Daniel Krenn

Commit: a0d894ef1c76c66cc17382599492487549be9314e5a31912c6ab32068484eb7b4008cecf896c5d75
Status: needs_reviewpositive_review

finished my review; everything is fine; corrected one PEP8-spacing.


New commits:

e5a3191corrected one spacing (PEP8)

comment:13 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:14 Changed 9 years ago by Volker Braun

Branch: u/dkrenn/fsm/latex-improvede5a31912c6ab32068484eb7b4008cecf896c5d75
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.