mailing-list for TeXmacs Users

Text archives Help


Re: about esc-esc-& in math centered equation


Chronological Thread 
  • From: Giovanni Piredda <address@hidden>
  • To: address@hidden
  • Subject: Re: about esc-esc-& in math centered equation
  • Date: Fri, 3 Sep 2021 19:51:15 +0000


On 02.09.21 18:12, Giovanni Piredda wrote:



or from the definition of the menu button for changing inline into display formulae (from progs/math/math-menu.scm):

(tm-menu (focus-variant-menu t)
  (:require (tree-in? t '(math equation equation*)))
  ("Inline formula" (variant-formula t))
  ("Displayed formula" (variant-equation t)))




This worked in the few tests I did:

(texmacs-modes
(in-inline% (inside? 'math)))

(texmacs-modes
(in-display% (or (inside? 'equation*) (inside? 'equation))))

(kbd-map
(:mode in-inline?)
("d d" (variant-equation (focus-tree))))

(kbd-map
(:mode in-display?)
("d d" (variant-formula (focus-tree))))


First I define two new modes (in-inline and in-display, where for the latter one can be inside either a numbered or an unnumbered equation); after which I define the keyboard shortcut d d (press twice the D key) to have a different effect whether one is in an inline or a displayed formula. For the code, I assumed that the code that gets executed when one presses the menu button that appears when one is in an equation would work here, using the substitution t -> (focus-tree) (assuming that the t of the button is the focus tree!). I did not check what the variant-formula and variant-equation functions do---I understand faintly what the code does, so that it might even be wrong; that means use it at your own risk ;-)

By the way I think I have to define the modes because I understood that kbd-map is conditional on modes only, but I may be wrong there too.

Giovanni





Archive powered by MHonArc 2.6.19.

Top of page