Using xref in overset

132 views
Skip to first unread message

Scott F Beaver

unread,
Jun 4, 2021, 3:32:10 PM6/4/21
to PreTeXt support
Hi all,

Greetings!  My first request for help:  In single-line chains of mathematical relations like a^2=ab=b^2 etc., is it possible to indicate a theorem-like reference directly above the "="?  In my ptx file I have tried 

\overset{<xref ref="AminusBeq0"/>}{=}

which places nothing visible above the "=".  I verified that \overset otherwise accomplishes what it should; it just doesn't seem to work with referencing in the same way it does in LaTeX.

Is the object generated by the referencing command not the kind of object that can legally reside in the stacked setting generated by \overset?   

Thanks in advance for any help you can provide about achieving this functionality.  Best,

Scott


David Farmer

unread,
Jun 4, 2021, 3:44:17 PM6/4/21
to 'Scott F Beaver' via PreTeXt support

A use case which is currently supported, is having the "reason"
to the right of the equations, as in the sample article:

https://pretextbook.org/examples/sample-article/html/section-7.html#p-290

It is going to take some thought to figure out if it might be
possible to have the knowl appear inside a formula. (My assumption
is that on top of an equals sign is not different than in a numerator
or in an exponent.)
> --
> 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 on the web visithttps://groups.google.com/d/msgid/pretext-support/9bf69bda-2c6c-4226-8c5a-09b54857a5a8n%40googlegroups.com.
>
>
>

Scott F Beaver

unread,
Jun 4, 2021, 4:01:30 PM6/4/21
to PreTeXt support
Got it; thanks David.  I wondered if there is an alternate referencing command other than xref, one that would just display the theorem number or counter as text and perhaps without the "Theorem", and which would be more amenable to placement in a formula.

David Farmer

unread,
Jun 4, 2021, 4:41:35 PM6/4/21
to 'Scott F Beaver' via PreTeXt support

There are options on xref which control what appears. But (I speculate)
students would probably prefer to see "Theorem 8.1" instead of just "8.1".
> To view this discussion on the web visithttps://groups.google.com/d/msgid/pretext-support/347af195-64f8-4434-8f9e-3e78e1d64ec2n%40googlegroups.com.
>
>
>

Rob Beezer

unread,
Jun 4, 2021, 9:13:49 PM6/4/21
to pretext...@googlegroups.com
On 6/4/21 1:41 PM, David Farmer wrote:
> There are options on xref which control what appears.

Subsection 4.6.2: Text of a Cross-Reference
https://pretextbook.org/doc/guide/html/topic-cross-referencing.html#subsection-12

David F will be thinking about how to accomplish this in HTML, while I will want
to be certain it functions in LaTeX.

You've not said which conversions you have tested. I would not expect it to
behave in HTML output, but I am curious about behavior in LaTeX. Can you
illuminate?

The "reason to one side" construction is already causing problems with offline
MathJax (for EPUB and braille), so we'll need to think carefully before we get
too fancy.

Rob

Scott F Beaver

unread,
Jun 7, 2021, 12:52:07 PM6/7/21
to PreTeXt support
Thanks David and Rob; I tested both the html and latex outputs and each has the same pathology.  WRT David's email of 6/4 1:41:35 email - apologies for not being clearer: My hope is that above equal signs in the chain I can include abbreviations like "Thm." or "Def." along with the associated number, to keep the inter-expression gap to a minimum, as in:

ChainwRefs.PNG

When the expressions are short enough, I favor this construction over the vertical chain.  Cheers,

Scott

Rob Beezer

unread,
Jun 7, 2021, 8:32:34 PM6/7/21
to pretext...@googlegroups.com
Dear Scott,

Here is a link to the specific paragraph you want to study, from within the subsection provided earlier.

Paragraph
https://pretextbook.org/doc/guide/html/topic-cross-referencing.html#p-277

Table 4.6.3, and the earlier one, have examples.

Rob

Scott Beaver

unread,
Jun 8, 2021, 1:49:52 PM6/8/21
to pretext...@googlegroups.com
Got it; understood.  Thank you Rob!

--
You received this message because you are subscribed to a topic in the Google Groups "PreTeXt support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-support/ZbJxdrPBkTE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAwMC5iZWV6ZXI.1623112353%40quikprotect.


--
Scott Beaver
Mathematics Department
Western Oregon University
WOUFT Communications Director
Pronouns: he / him / his

Rob Beezer

unread,
Jun 8, 2021, 2:05:35 PM6/8/21
to pretext...@googlegroups.com
Thinking about this more, if it were me, I'd just put a number above each equals
sign.

You would get a tooltip in HTML (I think). And a knowl would reveal full
information (one click to show, one to hide). The number would be unique (i.e.
you'd never have Definition 5.6 *and* Theorem 5.6). It'd be less pathological.
And work well for all languages.

Hard-copy print would be a bit deficient (but not wrong nor ambiguous). But
that is almost always the case when compared to the more capable HTML output.

Rob

On 6/8/21 10:49 AM, 'Scott Beaver' via PreTeXt support wrote:
> Got it; understood.  Thank you Rob!
>
> On Mon, Jun 7, 2021 at 5:32 PM Rob Beezer <bee...@ups.edu
> <mailto:bee...@ups.edu>> wrote:
>
> Dear Scott,
>
> Here is a link to the specific paragraph you want to study, from within the
> subsection provided earlier.
>
> Paragraph
> https://pretextbook.org/doc/guide/html/topic-cross-referencing.html#p-277
> <https://pretextbook.org/doc/guide/html/topic-cross-referencing.html#p-277>
>
> Table 4.6.3, and the earlier one, have examples.
>
>  Rob
>
> On June 7, 2021 6:52:07 AM HST, 'Scott F Beaver' via PreTeXt support
> <pretext...@googlegroups.com <mailto:pretext...@googlegroups.com>>
> wrote:
> >Thanks David and Rob; I tested both the html and latex outputs and each
> >has
> >the same pathology.  WRT David's email of 6/4 1:41:35 email - apologies
> >for
> >not being clearer: My hope is that above equal signs in the chain I can
> >
> >include abbreviations like "Thm." or "Def." along with the associated
> >number, to keep the inter-expression gap to a minimum, as in:
> >
> >[image: ChainwRefs.PNG]
> >
> >When the expressions are short enough, I favor this construction over
> >the
> >vertical chain.  Cheers,
> >
> >Scott
> >On Friday, June 4, 2021 at 6:13:49 PM UTC-7 Rob Beezer wrote:
> >
> >> On 6/4/21 1:41 PM, David Farmer wrote:
> >> > There are options on xref which control what appears.
> >>
> >> Subsection 4.6.2: Text of a Cross-Reference
> >>
> >>
> >https://pretextbook.org/doc/guide/html/topic-cross-referencing.html#subsection-12 <https://pretextbook.org/doc/guide/html/topic-cross-referencing.html#subsection-12>
> >>
> >> David F will be thinking about how to accomplish this in HTML, while
> >I
> >> will want
> >> to be certain it functions in LaTeX.
> >>
> >> You've not said which conversions you have tested. I would not expect
> >it
> >> to
> >> behave in HTML output, but I am curious about behavior in LaTeX. Can
> >you
> >> illuminate?
> >>
> >> The "reason to one side" construction is already causing problems
> >with
> >> offline
> >> MathJax (for EPUB and braille), so we'll need to think carefully
> >before we
> >> get
> >> too fancy.
> >>
> >> Rob
> >>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "PreTeXt support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pretext-support/ZbJxdrPBkTE/unsubscribe
> <https://groups.google.com/d/topic/pretext-support/ZbJxdrPBkTE/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> pretext-suppo...@googlegroups.com
> <mailto:pretext-support%2Bunsu...@googlegroups.com>.
> <https://groups.google.com/d/msgid/pretext-support/MTAwMDAwMC5iZWV6ZXI.1623112353%40quikprotect>.
>
>
>
> --
> Scott Beaver
> Mathematics Department
> Western Oregon University
> WOUFT Communications Director
> Pronouns: /he / him / his/
>
> --
> 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-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CABc1f2jXD5mpNbwSQPPyH_a_1V-HkLkpSa7ow77CaD8yjz%2BE0Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-support/CABc1f2jXD5mpNbwSQPPyH_a_1V-HkLkpSa7ow77CaD8yjz%2BE0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.

David Farmer

unread,
Jun 8, 2021, 2:50:25 PM6/8/21
to pretext...@googlegroups.com

I don't think it is possible, not currently anyway, to make
a knowl in an arbitrary part of a formula. We don't have
any examples in the sample article.
> email to pretext-suppo...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/7500c46e-750a-d9f7-25f7-7878de19fff3%40ups.edu.
>

Rob Beezer

unread,
Jun 8, 2021, 4:23:37 PM6/8/21
to pretext...@googlegroups.com
I was just hoping it might "just work". ;-)

Adding Scott's example to the "Mathematics" section of the sample article as a pull request would be welcome. Or I can make a beta for experimentation.

Rob

Alex Jordan

unread,
Jun 8, 2021, 4:45:50 PM6/8/21
to pretext...@googlegroups.com
I think maybe an xref gets nullified in an "m" or an "me".

Using an "md/mrow" like this:

<md>
<mrow>A\stackrel{<xref ref="this-exercise"
text="global">Ex</xref>}{=}B</mrow>
</md>

I get this PDF:
http://spot.pcc.edu/~ajordan/temp/webwork-mini.pdf
which seems OK for what it is.

I get this HTML:
http://spot.pcc.edu/~ajordan/temp/section-1.html
where the math is messed up if I open the knowl. And probably, I'd
prefer the knowl content to open somewhere other than where it opens.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAxOC5iZWV6ZXI.1623183808%40quikprotect.

David Farmer

unread,
Jun 8, 2021, 5:29:31 PM6/8/21
to pretext...@googlegroups.com

I'll look into having that math open in a better place.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CA%2BR-jrcoYKb_Nvyx3E%3DK-LNTRTB_nkXjjF5Bk7K2KiqCdTzeRQ%40mail.gmail.com.
>

David Farmer

unread,
Jun 8, 2021, 6:03:27 PM6/8/21
to pretext...@googlegroups.com

The knowl above an equals sign should open in the correct
place now, if you reload.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CA%2BR-jrcoYKb_Nvyx3E%3DK-LNTRTB_nkXjjF5Bk7K2KiqCdTzeRQ%40mail.gmail.com.
>

Rob Beezer

unread,
Jun 8, 2021, 7:45:58 PM6/8/21
to pretext...@googlegroups.com
I'll suggest this should be supported in "me" and "md/mrow" and not in "m".

If agreeable, I can make that change sometime in the next few days and then report here.

Rob Beezer

unread,
Jun 10, 2021, 4:04:26 PM6/10/21
to pretext...@googlegroups.com
On 6/8/21 4:45 PM, Rob Beezer wrote:
> If agreeable, I can make that change sometime in the next few days and then report here.

An "xref" inside "me" or "men" is now recognized, and will act appropriately in
both LaTeX and HTML output.

LaTeX notes:

* \stackrel was being reported as obsolete in 2011.
https://tex.stackexchange.com/a/39230

* AMSmath and MathJax have \overset, and \underset, which both test fine.

* AMSmath added \overunderset in 2019, but it is not yet in MathJax.
https://tug.org/TUGboat/tb40-3/tb126ltnews30.pdf
https://github.com/mathjax/MathJax/issues/2704

These commands have one drawback - they typeset their stacked argument in
italics. For HTML output I tried adding \text{} into the PTX source, and I
tried adding \text{} into XSL at a convenient location. Either it failed by
breaking the knowl code or broke the *existing* knowls/reasons in md/mrow.

The md/mrow examples are in an upright font, which makes me think the Javascript
is doing this? But perhaps a \overset is exterior and the switch to italics
prevails? Sorry, David. ;-) But I'm not really too concerned about it, since
I think a number alone is sufficient in this use case.

Example at the very end of

Subsection 7.4: Advanced Mathematics
https://pretextbook.org/examples/sample-article/html/section-7.html#subsection-11

Thanks, Scott, for bringing this forward, and to Alex and David for their work
on this one.

Rob

David Farmer

unread,
Jun 10, 2021, 4:24:05 PM6/10/21
to pretext...@googlegroups.com

> These commands have one drawback - they typeset their stacked argument in
> italics. For HTML output I tried adding \text{} into the PTX source, and I
> tried adding \text{} into XSL at a convenient location. Either it failed by
> breaking the knowl code or broke the *existing* knowls/reasons in md/mrow.
>
> The md/mrow examples are in an upright font, which makes me think the
> Javascript is doing this? But perhaps a \overset is exterior and the switch
> to italics prevails? Sorry, David. ;-) But I'm not really too concerned
> about it, since I think a number alone is sufficient in this use case.
>
> Example at the very end of
>
> Subsection 7.4: Advanced Mathematics
> https://pretextbook.org/examples/sample-article/html/section-7.html#subsection-11

I made the "Thm" above the "=" be upright. Is that what you wanted?

Rob Beezer

unread,
Jun 10, 2021, 4:40:34 PM6/10/21
to pretext...@googlegroups.com
Exactly. Looks good.

So now I have to figure out how to make it happen in LaTeX where there is no
real exceptional code yet for this situation! :-(

That was fast. Thanks.

Rob

Scott F Beaver

unread,
Jun 11, 2021, 3:02:05 PM6/11/21
to PreTeXt support
Yes it was fast!  Looks good indeed.  Thanks Rob and David for making this happen.  Cheers,

Scott
Reply all
Reply to author
Forward
0 new messages