Duplicating a theorem (without a new number)

31 views
Skip to first unread message

David Clark

unread,
Aug 7, 2026, 1:26:12 PM (12 days ago) Aug 7
to PreTeXt support
I posted this on the discord, and was directed here. This is a question, but might actually be a feature request.

I have previously created a <theorem> with an xml:id, and I'd like to insert a copy of that theorem later, as a reminder. Basically, I have a worksheet where the theorem is stated and we work through some steps in its proof. Then later I want to collect together some key results on a reference page, using the same numbering.

Using <xref ref=...> inserts a link to the theorem with a knowl, and that knowl can be opened to show the theorem. But I'd like that knowl to be open by default, rather than hidden.

Is there a one-off way to specify that this particular knowl should be open?

I want the theorem to be numbered the same way, so that it's clear which result we're talking about in each instance. This is why just copy-pasting a new copy of the theorem isn't ideal.

To me, this feels like a value for the @text attribute of xref, something like:

<xref ref="my-theorem-ref" text="content-expanded" />

Thanks,
-David

David W. Farmer

unread,
Aug 7, 2026, 1:33:05 PM (12 days ago) Aug 7
to PreTeXt support

I am pretty sure this is a feature request.

We were just discussing this at MathFest. What would be great is a
"transclusion" element, which has the effect of "in this place put that
object from somewhere else". The 'somewhere else' would not need to
be from the same document.
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/pretext-support/c3a64d9c-1dd3-487f-bbc5-f2c49b7c67e2n%40googlegroups.com.
>
>

Rob Beezer

unread,
Aug 7, 2026, 6:15:26 PM (12 days ago) Aug 7
to pretext...@googlegroups.com
An #xref is a cross-reference - a pointer to another location within a document.
Typically it is authored mid-paragraph, or mid-phrase.

Only in HTML output is it rendered in a way that makes the content at the target
readily visible (with a click).

Some PDF viewers will show part of the target on a hover. Print is hopeless. I
think EPUB is just a traditional hyperlink. Jupyter is hostile to knowls
(though there was just activity on a very old issue I filed). Braille will be
just text, like print.

So something like "content-expanded" is really just a hint for one particular
output format, embedded in your (generic, output-agnostic) source. And if I put
my #xref mid-sentence, what would you do, split the sentence? (No, likely where
it opens now, I guess.)

Our ideas about numbering - distinct "counters" only for visually distinct
material - would get very upset with this.
To go:

Corollary 11.2
Theorem 4.28
Definition 11.3

would be very confusing to me.

I would put your theroem in its own XML file (root-element #theorem) and
xi:include it twice. Content always duplicated, even on edits, and I would give
it a (common) #title. Yes, you get two numbers. Also, you cannot put a @xml:id
on it, since it will not be unique. I would think that no matter what you would
have some surrounding explanatory text: "You first saw this theorem in
Worksheet 4.3..."

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> c3a64d9c-1dd3-487f-bbc5-f2c49b7c67e2n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/c3a64d9c-1dd3-487f-bbc5-
> f2c49b7c67e2n%40googlegroups.com?utm_medium=email&utm_source=footer>.

David Clark

unread,
Aug 9, 2026, 1:07:17 PM (10 days ago) Aug 9
to PreTeXt support
I see that xref is the wrong place for this -- thanks for the clarity there.

After reading some more, I see that <list-of-elements /> *almost* does what I'm asking for here, but not quite. So I'm going to change this to a feature request for <list-of-elements />. 

Basically, I would like <list-of-elements /> to optionally include an element's full statement in a print format, not just its name/number.

I have a course with several worksheets. Each worksheet is one day's worth of class notes, with space for students to fill in proofs, examples, etc. I want each worksheet to have a summary page of theorems that we've proved within that worksheet. You could imagine a similar use case for a summary list of theorems, or definitions, at the end of a textbook chapter. To make sense in a print format, this list needs to include the full statement of each theorem -- the goal is to give students a single list of all of the *statements* of each result, not just an index or lookup table.

I just tried this in one of the worksheets: <list-of elements="theorem" scope="worksheet" />

This produced a list of theorems in the worksheet with correct numbers, which is good (and was part of my original request). But the print version still has all of the theorems collapsed, that is, it only shows "Theorem 5" rather than the actual theorem statement. That isn't useful in a print format. What I would like here is for the list to (optionally) show the full theorem statements, not just the name/number.

-David

Rob Beezer

unread,
Aug 9, 2026, 1:46:13 PM (10 days ago) Aug 9
to pretext...@googlegroups.com
Thanks, David, that sounds more feasible. It'll be a few days before I can investigate further.

One clarification. The #list-of does not simply print "Theorem 5", if I remember right. It will also print the #title. You did see the advice about using titles liberally? This is part of the reason why. Anyway, that could be a helpful stopgap for the moment.

Rob

David Clark

unread,
Aug 9, 2026, 1:56:43 PM (10 days ago) Aug 9
to PreTeXt support
Thanks, Rob - yes, I noticed the title is included. But that's quite different from a full and proper statement. (I'm also thinking that this would be helpful for a reference page of <axiom>s, where e.g. a full statement of Eulcid's 5th postulate would be very different from "Axiom 5: Euclidean Parallel Postulate").

I laughed when I just scrolled down and found this at the end of the guide page for <list-of-elements />: "There may be an argument for a @ref attribute that would behave similar to @scope. Make a feature request if you need it?"

Adding a @ref attribute, along with my request to include a full statement, would completely solve my original request! That's assuming that the @ref can refer to anything that is, or contains, some <theorem> and would produce a list of all theorems that are, or are contained in, that @ref.

-David

Rob Beezer

unread,
Aug 9, 2026, 2:02:03 PM (10 days ago) Aug 9
to pretext...@googlegroups.com
We've thought of everything (almost). Just not enough time to implement it all...
Reply all
Reply to author
Forward
0 new messages