I agree, but I think this is an early design problem given by following too tightly the LaTeX model. It is not obvious how to change things and not break old documents.
Anyway I think a good solution to this problem would really improve a lot the design of the document format. best Max > On 10 Apr 2023, at 17:32, Frank <sci.fr...@gmail.com> wrote: > > Dear all, > > Let me first quote a paragraph in TeXmacs documents: > >> You first have to create a label at the position to which you want to refer. >> For equations, the label should be created inside the equation, and >> similarly for theorems and most other tags. The labels for sections, >> subsections, etc. should rather be positioned just after the section titles; >> this prevents TeXmacs from duplicating the labels in the table of contents. > > I did not find any rationale for this. Now I look at some codes, and if I > understand correctly, it is doing the following: > > (set-binding name) — setting a binding with name "name" (this seems to be > undocumented). > (label lab) — setting a label lab, which has the *last* binding. > (reference lab) — a reference to the label lab, displayed as the name of the > associated binding. > > I find this counter-intuitive — where we set a label, it is a priori unclear > where is the last binding, plus depending on a very low-level undocumented > machinery called binding. For example, we can look at the following > artificial TeXmacs Scheme code: > > (document (theorem (document "Consider the following conjecture" (indent > (document (conjecture (document (concat "Some conjucture for " (math > "n<in><bbb-N>") "."))))) (concat "It holds for " (math "n<leq>100") "." > (label "thm:1")))) (reference "thm:1")) > > The label "thm:1" is associated to the binding produced by the "Conjecture > 2", with name "2" instead of "1". This does not seem to be intuitive. This > could be resolved by moving the label "thm:1" before "Conjecture 2", but this > does not seem to be good for me. > > I would propose the following: > > 1. "Bindings" should be local to the environment. In particular, in the > preceding code, "thm:1" should refer to 1 — the binding in "Conjecture 2" > should be local in this environment, and outside this environment, the value > should be resumed to be the one of "Theorem 1" environment. > 2. We should have abstractions "labeled-theorem", "labeled-conjecture", which > allows others to avoid low-level abstractions such as bindings. > > Best wishes, > Frank > > _______________________________________________ > Texmacs-dev mailing list > Texmacs-dev@gnu.org > https://lists.gnu.org/mailman/listinfo/texmacs-dev _______________________________________________ Texmacs-dev mailing list Texmacs-dev@gnu.org https://lists.gnu.org/mailman/listinfo/texmacs-dev