I have a Windows 11 OS, with TeXmacs version 2.1.4.
I have been trying for hours to mimic the replication of the Table of Contents architecture to create a similar List of Doubts object.
I’ve got some of the code right, I guess.
This is the Physics.ts style package file, stored in AppData/Roaming/TeXmacs/packages that generates these tags.
<TeXmacs|2.1.4>
<style|source>
<\body>
<src-title|MASTER PHYSICS PACKAGE>
<src-comment|Standard Dependencies>
<use-package|std-math-layout|amsmath|std-title|std-toc|std-index>
<src-comment|Doubt Database Core>
<assign|doubt-prefix|doubt>
<src-comment|Render Logic: Keep this purely visual for speed>
<assign|doubt-dots|<macro|<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|font-size|1|<space|0.2fn>.<space|0.2fn>>>>|<htab|5mm>>>>
<assign|doubt-tag|<macro|name|page|<vspace*|1fn><with|font-series|bold|font-size|1.19|<arg|name>><doubt-dots><no-break><arg|page><vspace|0.5fn>>>
<src-comment|Entry Logic: High-speed tree writing>
<assign|doubt|<macro|what|
<render-doubt|<arg|what>>
<auto-label>
<write|<value|doubt-prefix>|<compound|doubt-tag|<arg|what>|<the-auto>>>
>>
<assign|render-doubt|<macro|body|<with|color|dark green|font-shape|italic|[Doubt: <arg|body>]>>>
<src-comment|List Generation: Efficient Hooking>
<assign|list-of-doubts-title|<macro|<localize|List of doubts>>>
<assign|insert-list-of-doubts-list|<macro|
<assign|doubt-next-prefix|doubt>
<assign|doubt-next-list-title|<value|list-of-doubts-title>>
<extern|insert-list-of-doubts>
>>
<src-comment|The "Structured List" Renderer>
<assign|render-list-of-doubts|<macro|body|
<section*|<value|list-of-doubts-title>>
<arg|body>
>>
<initial|<\collection>
<associate|preamble|true>
</collection>>
</body>
This is the init-physics.scm file, stored in AppData/Roaming/TeXmacs/progs, that creates the list of the doubts.
`(texmacs-module (init-physics)
(:use (generic generic-menu)))
;; 1. Manually force-load the database primitives if they are missing
(if (not (defined? 'drd-ref))
(lazy-module-force (database drd-database)))
;; 2. Now register the collection safely
(if (not (drd-ref "doubt"))
(drd-add-collection "doubt"))
;; 3. Define the insertion function
(tm-define (insert-list-of-doubts)
(:secure #t)
(exec-delayed (insert-structured-list "List of doubts" "doubt")))`
And this is the my-init-texmacs.scm file, stored in the same AppData/Roaming/TeXmacs/progs, that is supposed to activate when TeXMacs runs.
(load-module (init-physics))
The problem is that while the Physics.ts. file seems to be working well, the reader part of this construct (the .scm files) don’t. Whether I run tests in Scheme->Sessions* like (use-modules(…)), (primitive-load “… init-physics.scm”), or every trick in the book, or whether I try use this package directly on TeXmacs, it always fails, leaving me with undefined variables, or wrongly formatted answers. I do not publish the results because I think they are too long this forum.
Would you be able to run this code and tell me what’s wrong, or suggest a new code, or let me know if somebody has already solved a problem clearly analogous to this, or if it can’t be done.
I credit Google Gemini for helping me refine the code so far, as compared to my initial follies, but in the end it confessed it had reached the end of its knowledge on this niche matter.
If the developrs could respond, it would be great.