New submenus environments

hello

in the submenu where i can choose “theorem”, “corollary”, … i would like to add some other items “application”, “rappel”…

can i do this with some code in my-init-texmacs ?

maybe using http://forum.texmacs.cn/t/how-do-i-add-a-new-environment-assumption/795/2 ?

but can i do this with just modifying my-init-texmacs ? so to be able to share easily with others ?

Vincent

As far as I know one needs to split what you want into two parts:

  1. adding some new environments, that you need to do with TeXmacs macros
  2. making them available in menus, which you do with Scheme

The sharing, then, you do with a package file. I can try to post an example, but I will be slow.

This part is easy, e.g.:

<new-remark|construction|Construction>

Save it as a .ts file in the ${TEXMACS_HOME}/packages directory, then load it when you use it.

thanks for answering
just tried now
saved in ~/.TeXmacs/packages as “construction.ts”
loaded with cmd+O while a file was opened
then how do you use it ?
i have tried \construction or \remark …

The construction package should be added as a style package to the document where you want to use it. If the ts file is in the right location, it should appear under Document->Style->Add package (or click the “plus” icon in the toolbar).

1 Like

Thanks a lot for posting that :slight_smile:
The Scheme part for my-init-texmacs.scm (I ill also remind myself how to integrate it within the package) is I think

(delayed (lazy-initialize-force)
	 (define-group remark-tag remark note example convention warning acknowledgments construction)

	 (menu-bind enunciation-menu
		    (if (style-has? "env-theorem-dtd")
			("Theorem" (make 'theorem))
			("Proposition" (make 'proposition))
			("Lemma" (make 'lemma))
			("Corollary" (make 'corollary))
			("Proof" (make 'proof))
			---
			("Axiom" (make 'axiom))
			("Definition" (make 'definition))
			("Notation" (make 'notation))
			("Convention" (make 'convention))
			---
			("Remark" (make 'remark))
			("Note" (make 'note))
			("Example" (make 'example))
			("Warning" (make 'warning))
			("Acknowledgments" (make 'acknowledgments*))
			("Construction" (make 'construction))
			---)
		    ("Exercise" (make 'exercise))
		    ("Problem" (make 'problem))
		    ("Question" (make 'question))
		    ("Solution" (make 'solution*))
		    ("Answer" (make 'answer*))))

where I rebuilt the whole enunciation menu, as I did not see a way to insert a new menu item between already-existing items.
I also place construction inside the remark-tag group to get construction into the menu where one can cycle between the environments.

By the way the new enunciation menu works only if I am placing its definition after the lazy-initialize-force function call. In https://texmacs.github.io/notes/docs/new-lists.html I wrote the menu redefinition for the new list item without lazy-initialize-force; as far as I recall it worked, I will check then report/change the blog post if it does not.
Is it ok to always use lazy-initialize-force in redefinitions? Does anyone know?