[main]Notes on TeXmacs
The TeXmacs manual, in Section 11.4.4, and the Jolly Writer suggest that the macro new-list can be used to define new list types.
Quoting from the manual
The std-list d.t.d. also provides a macro new-list to define new lists. Its syntax is <new-list|name|item-render|item-transform>, where name is the name of the new list environment, item-render an (inline) macro for rendering the item and item-transform an additional transformation which is applied on the item text. For instance, the enumerate-roman environment is defined by
<new-list|enumerate-roman|aligned-dot-item|<macro|x|<number|x|roman>>>
As user bpascal40 observed in the forum, this is not enough for obtaining a new list type that works like the default itemize environment. If one has defined a list type by, exempli gratia,
<new-list|itemize-perso|aligned-dot-item|<macro|x|⊛>>
then generating a list in the hybrid mode as will generate the itemize-perso environment but won't add the first item to it; moreover pressing Return while in the list environment won't add an item to the list.
In order to get an itemize-perso list to behave like a default itemize list we need two more instructions for TeXmacs.
We get a hint for the first instruction by examining the menu item
We need then to add a menu entry for itemize-perso and we do it through the following code in my-init-texmacs.scm:
(menu-bind itemize-menu (former) --- ("Perso" (make-tmlist 'itemize-perso)))
Executing the new menu entry that appears (
Note. The current
If we press Return inside this list no new item appears. We need one more piece of code, the declaration
(define-group itemize-tag itemize itemize-minus itemize-dot itemize-arrow itemize-perso)
The writer of this blog post does not understand how the declaration works, only the following that was explained by user mgubi in the forum: the declaration instructs TeXmacs to treat the group of tags in the same way.
Following this hint and looking inside the TeXmacs code one notices (without entering into the details of the code) that kbd-enter is defined inside lists (with a (:require (list-context? t)) declaration) as (make-item) (see the code in progs/text/text-edit.scm).
In fact after calling the define-group declaration above
the itemize-perso list works nicely; after executing
the menu entry
As a conclusion, to define a new list one should, in addition to executing the new-list macro, put in one's own my-init-texmacs.scm the following code (here, again, using the itemize-perso example)
(menu-bind itemize-menu (former) --- ("Perso" (make-tmlist 'itemize-perso))) (define-group itemize-tag itemize itemize-minus itemize-dot itemize-arrow itemize-perso)