Re: [Texmacs-dev] [TeXmacs] A question and proposals about references

2023-04-10 Thread Frank

I guess that labeled environments are something desirable. I don't see any 
intrinsic meaning of labels without a specific environment.

This seems to be how ConTeXt does it:


\placesubformula
\startformula \startalign
\NC a_1 x + b_1 y \NC = c_1 \NR[eq:c][c]
\NC a_2 x + b_2 y \NC = c_2 \NR[eq:d][d]
\stopalign \stopformula
(\in[eq:c]) and (\in[eq:d]) form a linear system of equations.


and


\starttheorem[thm:pythagoras]{Pythagoras Theorem}
The square on the hypotenuse is equal to
the sum of the squares on the other two sides.
\stoptheorem


Best,
Frank

On 4/10/23, Massimiliano Gubinelli wrote:

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  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") ".") (concat "It holds for " (math "n100") "." (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


___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] [TeXmacs] A question and proposals about references

2023-04-10 Thread Massimiliano Gubinelli
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  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") ".") (concat "It holds for " (math "n100") "." 
> (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


[Texmacs-dev] [TeXmacs] A question and proposals about references

2023-04-10 Thread Frank

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") ".") (concat "It holds for " (math "n100") "." (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