Creating a new list does not seem to work

Hello,
when I modify an existing list it works very well but if I want to create my own list with a new name the “items” do not appear in texmacs I may be doing something wrong.
Here is my preamble:
liste-pr%C3%A9ambule


Thank you for your help and once again thank you for this wonderful software and your always responsive answers.

I don’t understand the details but it may be the following: you have to insert the list through a make-tmlist Scheme form, which is what happens when you execute the menu item Insert->Itemize-Arrows.

This is not yet complete, though, because in the test I did the Return key does not start a new item. Let us see if someone knows more.

We would need to see the TeXmacs source, it is not clear what it is going on from your image. Possibly you have to insert \item by hand inside the \itemize-perso environment.

I inserted \item by hand and indeed it works very well now.
It would be nice if the items appeared automatically like with the predefined lists
Thank you.

Using the Execute -> Evaluate scheme expression menu I did

(make-tmlist 'itemize-perso)

and one gets the first menu item but the Return key does not generate a new one.
Might it be a keyboard shortcut inside the list environment?

This depends on having [enter] trigger the creation of an item in the editor, one would have to add some Scheme command in order to recognise your custom environment. Probably this command should work

(define-group itemize-tag
  itemize itemize-minus itemize-dot itemize-arrow itemize-perso)

It works fine now, the item appears directly. For the first, you have to click twice.
But where should I position this scheme command? In the my-init-texmacs.scm file? Where else?

I would put the following in the my-init-texmacs file

(menu-bind itemize-menu
  (former)
  ---
  ("Perso" (make-tmlist 'itemize-perso)))

This adds the menu item, which inserts the itemization list with the first item.
Then again in my-init-texmacs

(define-group itemize-tag
  itemize itemize-minus itemize-dot itemize-arrow itemize-perso)

I tested the commands in a Scheme session, not in the initialization file.

1 Like

It suits me very well. It works as I wanted.
Thanks.

What does define-group do? I found its definition in progs/utils/edit/variants.scm but I did not understand it.

define a group of similar objects, eg. when you hit Tab to circulate variants of environments . TeXmacs needs to know that itemise-perso behaves like any other itemisation. I guess it is also used to populate menus, e.g. in the variants pushdown button present in the focus bar.

I a writing a blog post about the definition of new lists and I was hoping for a bit more insight but I am able to write it with your explanation, id est without details of what define-group does and saying that with define-group the Return key generates a new item like in the other itemization lists.

Well, I’m not sure what kind of explanation would be enough: groups are a fundamental concept in TeXmacs, they are used to compute variants in the UI and in this case to apply the same treatment to a group of tags which should have similar behaviour of the keyboard. It is not a “function”, it is a declaration. TeXmacs learn that a list of tags are similar and collectively referred to by the name of the group. This declaration is stored in a kind of “database” and when TeXmacs see a tag it can inquire if this tag belongs to some specific group, in which case it does things related to the group and not to the individual tag. You might want to search in the scheme code for the group name, i.e. itemize-tag so that you see where this is used.

The post is almost ready. The following is not yet working: when I write a list with a new list type, the html converted file does not show the item symbol.

Maybe we need to add the environment to the css file?

I would need to look at this. Probably the HTML exporter ignore the grouping mechanism. I’m not sure. Also note that one can define HTML variants of custom macros, e.g. if you have a macro \my-itemize then you can define \tmhtml-my-itemize to customise the way the exporter should process your macro (I think the default is to expand it). So you can define \tmhtml-my-itemize to downgrade to the usual \itemize, in which case I think it will be exported correctly.

I’ll work on it. Perhaps I’ll have to do as you say. Substituting the lists with jpg images of them isn’t good because it gives users the idea that you can export them to html, and I don’t yet know how :slight_smile:

Well I think these are two different issues: if it is a tutorial, you want to give a feeling of how it looks in TeXmacs, so screenshots are ok in my opinion. Then remains the problem to customise environments in a way that the export to HTML works well (and LaTeX). I guess this could be topic of a different blog post.

Perhaps images, telling the readers that they are images as html export needs additional work, and that pdf export works.

I have tried the \tmhtml-my-itemize macro with itemize in the macro code, but together with itemize the editor places two document tags, and the list environment exported to html is blank.
Do you know how to get the editor to write

<assign|tmhtml-itemize-perso|<\macro|body>
      <\itemize>
        <arg|body>
      </itemize>
    </macro>>\

in a single paragraph?

Post at https://texmacs.github.io/notes/docs/new-lists.html

(I forgot to insert it in the list of articles in the main webpage of the blog, I will do it!)

1 Like