Reveal Feature Proof-of-Concept

71 views
Skip to first unread message

Geoffrey Cox

unread,
Jun 30, 2025, 3:02:13 PMJun 30
to PreTeXt development
In the past, I always used beamer templated slides for in class discussions. Today I started thinking about the possibility of walking into class with a tablet or even a phone and have parts of the book templated as well. I could pose a question and have a discussion before revealing the hidden content.

So I mocked up what I envisioned this might look like in the link below. I don't have the CSS figured out, so you'll want to toggle off dark mode to see the revealed text.

My questions are:
(1) Would this have broader appeal to others?
(2) Is it "PreTextable"? That is, does it align with the philosophy? How reasonable is it to extend the xml to include "reveal"-type element? etc.?
(3) If the above are true, where would be the best place to start looking to make a beta version of this feature?

Rob Beezer

unread,
Jul 2, 2025, 3:12:20 PMJul 2
to prete...@googlegroups.com
Dear Geoff,

Thanks for mocking this up - its very helpful. (Not sure I would have
understood without it!) Replies interspersed.

On 6/30/25 12:02, Geoffrey Cox wrote:
> (1) Would this have broader appeal to others?

Yes, I too would love to hear from others what they think of this feature.

> (2) Is it "PreTextable"? That is, does it align with the philosophy?

In my best Andrew Scholer impersonation, a long drawn out, "I thiiiiiink
sooooo." I certainly can think of how markup would work, and it makes
class-time more interactive/engaging, I'd guess. But really only an HTNL feature?

> How
> reasonable is it to extend the xml to include "reveal"-type element? etc.?

I don't think it would be too invasive. A #reveal element, sorta like an #em or
#m. In the middle of sentences.

> (3) If the above are true, where would be the best place to start looking to
> make a beta version of this feature?
Let's have some discussion first. Like I can think of a publisher switch that
might turn all of these off or on. And I could see a per-page menu item that
did a mass reveal (say, for a second reading through a page). And so on.

Rob

Oscar Levin

unread,
Jul 2, 2025, 5:09:04 PMJul 2
to prete...@googlegroups.com
I think this idea intersects nicely with the idea of guided notes that others have been asking for.  The general idea would be that pretext elements could be hidden initially, either via some sort of HTML redaction that can be revealed, or replaced with blank space in a print version.  Instructors could reveal the official solution like you suggest here, or let student print out a version where they can write their own notes.  The HTML can then be revealed live or later shown as default.

But regardless of whether this gets implemented in a way that could be used for both use cases, I think there would be a lot of interest in a "click to show" feature for HTML.  Imagine a multi-step solution, where each step can be clicked on so students can really focus on things one step at a time (no need to enforce an order on then).  

Yes, I know I'm pushing toward allowing more than just a fragment of text as being reveal-able.  Yes, this is sort of like letting authors create arbitrary knowls.

Implementation wise, put a component on something just like versions.  Have a publisher element such as `/publication/source/version/@hide` that accepts names of components.  

Alternatively, extend fillin to allow a default filled-in thing.

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAwMy5iZWV6ZXI.1751483538%40pnsh.

Bradley Miller

unread,
Jul 2, 2025, 5:21:00 PMJul 2
to PreTeXt development
I love it.

My question from the Runestone Academy side is, could we -- on Runestone -- ask the student for their best guess before we reveal?

On Runestone  (RST) we had exactly a feature called "reveal" but I think Rob and I agreed years ago that knowls filled that role in PreTeXt .  This is different in that it is a much smaller chunk.

@oscarlevin  I think this is different than a fillin as it blends so seamlessly with the flow of the text.

This feels a little like what I used to do in class.  Me:  "Ok, so we need to iterate over all the elements in this list so we are going to use aaaaaaayyyyy what kind of loop?"  If we want to promote active reading/learning, this will support that.

Brad

Geoffrey Cox

unread,
Jul 3, 2025, 12:59:19 PMJul 3
to PreTeXt development
Thanks for the feedback. I know things are busy getting ready for the fall, so I imagine this might be the best time to inject new ideas. 

That said, I think this would be an attractive feature for many thinking about adopting pretext/runestone. Especially, if it can be tied into the clicker-like functionality (I forget what they are called in runestone). Perhaps, you could have them submit their answers (e.g., Multiple Choice or Fill-in) before revealing the hidden text.

I also really like the idea of having a pdf option for the students who can write in the revealed text either digitally or physically, but maybe the initial implementation should just have the text revealed by default in the print version.

There are undoubtedly a lot more technical considerations, but maybe we can pick up the conversation again when things settle down.

Bradley Miller

unread,
Jul 3, 2025, 4:48:37 PMJul 3
to PreTeXt development
There is never a bad time for a PR :-)


Brad Miller
Professor Emeritus, Luther College
Founder, Runestone Academy LTD
Blog: http://reputablejournal.com

Set up a time to meet with me.


Chrissy Safranski

unread,
Jul 3, 2025, 7:30:57 PMJul 3
to PreTeXt development
>I also really like the idea of having a pdf option for the students who can write in the revealed text either digitally or physically, but maybe the initial implementation should just have the text revealed by default in the print version.

It seems to me like reveal should be similar to how fill-in-the-blank is handled.  I would think just leaving an underline in print by default would be good, and then if you wanted to print a version with answers (solutions?), the answer would appear in place.  

Cool idea, Geoff!

Rob Beezer

unread,
Jul 3, 2025, 9:26:43 PMJul 3
to prete...@googlegroups.com
Thanks, all for the great replies (which, of course, open up some new avenues!).

> Yes, I know I'm pushing toward allowing more than just a fragment of text as
being reveal-able

Yes, Oscar, I got there well before you revealed you were leading me there. ;-)
And I wondered who would be first to coin the noun "revealable".

I'd like to propose we start simple with span-like reveals. *Not* because I
don't like the other suggestions. I think we can get some insight into how we
want to markup, control, show, etc, this feature more easily in this setting and
it will influence how we extend it. But mostly, I'd like to invite Geoff to
work on all the aspects of getting this in place.

Geoff? HTML, print, neutered in other formats, publisher switches, CSS (JS?),
schema, documentation? From soup to nuts. It may seem like it takes longer
than you expect, but there's lots of help here. And I can outline a few steps,
so PRs will not be too cumbersome. If you are in, I can suggest first steps.

Rob


Geoffrey Cox

unread,
Jul 4, 2025, 10:12:43 AMJul 4
to PreTeXt development
I'd be interested in hearing the first steps, and I'd be happy to give it a try.

I can hack HTML, CSS, and JS enough to do things, but I have no experience integrating them into a larger Pretext/Runestone framework.

Rob Beezer

unread,
Jul 4, 2025, 12:48:48 PMJul 4
to prete...@googlegroups.com
Great, Geoff, hang on for the ride! You might want to get comfortable with the
pretext/pretext script in a Python virtual environment - I won't be much help
with VSCode, CLI, etc. And certain things are easier.

First step: can we all think of a name for some "span-like", phrase/word-level
markup, that is better than "reveal"? Its a verb, and Oscar is already making
nouns from it. ;-) It'd be nice to reserve "reveal" for switches and actions,
etc. A noun like "curtain"? As in "reveal what is behind the curtain"? No, I
am not serious, but the intent is clear? "veil"? Check a thesaurus (or AI, I
guess).

Geoff (and anybody else who might want to play along!):

1. Begin with markup. Always begin with the markup. Put some "reveal"
elements into the sample article (or some better name). Wrap words, phrases,
maybe 2.5 sentences, include some #m inside, maybe an #em. Several examples:
simple to tortuous. Use the sample article (yes it takes a few seconds to build)
because you are going to make sure you don't wreck anything else.

2. In xsl/pretext-common.xsl add a new template definition. It should "match"
#reveal and all it should do is "apply-templates" to its children. I'm being a
bit vague here intentionally, since getting this right illustrates all sorts of
basic principles. See if poking around the code helps.

3. Done correctly, nothing will happen. :-( This will be the "base" behavior.
How can you test? Build the sample article as a LaTeX file (a switch for the
script) and as HTML, while on master. Do it again in a new directory with your
changes from (2). ('git stash save' and 'git stash pop' can be useful, or make
a commit, switch branches and "amend" the commit as you go. Even better, make
"old-dir" before you start changing code.)

Do a "git diff old-dir new-dir" (make sure your directories are in /tmp, or
similar, not under a directory ruled by git). You will see an obvious small
change in each case, and should see no substantive changes otherwise.

4. No need for a PR yet. Post your new template here.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/5e74d13e-edda-4ae5-8670-a6da1f9e33d5n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/5e74d13e-edda-4ae5-8670-
> a6da1f9e33d5n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Geoffrey Cox

unread,
Jul 4, 2025, 3:56:21 PMJul 4
to PreTeXt development
@Rob. Thanks for all the details. I'll try it out in the next week or so, and if I have any questions, I'll drop a follow-up post.

Rob Beezer

unread,
Jul 4, 2025, 5:21:28 PMJul 4
to prete...@googlegroups.com
Sounds good. And if Monday AM Drop-Ins work, that is a great time/way to make
progress. They are the virtual versions of the hotel lobby in the evening at a
workshop. -Rob
> <https://groups.google.com/d/msgid/pretext->
> > dev/5e74d13e-edda-4ae5-8670-a6da1f9e33d5n%40googlegroups.com
> <http://40googlegroups.com> <https://
> > groups.google.com/d/msgid/pretext-dev/5e74d13e-edda-4ae5-8670- <http://
> groups.google.com/d/msgid/pretext-dev/5e74d13e-edda-4ae5-8670->
> > a6da1f9e33d5n%40googlegroups.com?utm_medium=email&utm_source=footer
> <http://40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/9d25fc7c-ff21-4425-868a-4d220fa322ean%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/9d25fc7c-
> ff21-4425-868a-4d220fa322ean%40googlegroups.com?utm_medium=email&utm_source=footer>.

Geoffrey Cox

unread,
Jul 4, 2025, 5:37:38 PMJul 4
to PreTeXt development
Sounds good. And if Monday AM Drop-Ins work, that is a great time/way to make
progress. They are the virtual versions of the hotel lobby in the evening at a
workshop.

Nice, good to know.
 

Geoffrey Cox

unread,
Jul 11, 2025, 10:22:31 AMJul 11
to PreTeXt development
I am ready to put some time into this, but after re-reading Rob's post, I realize the intention may have been to make baby steps through the process and update here as I go.

Either way, here is an update:

I created a dev environment based on the documentation at pretext-cli.

First Step: As for a name, "veil" seems good to me. Maybe "cover" or "covering"?

1. I may not be able to see the big picture yet, but I prefer starting with simple markup until I see it working. Then go in and try to break it.
2. Is this what you mean?
```
<xsl:template match="veil">
  <xsl:apply-templates/>
</xsl:template>

```

That's where I am. 

Andrew Scholer

unread,
Jul 11, 2025, 10:46:27 AMJul 11
to prete...@googlegroups.com
That looks like a good start. 

Where is it? (pretext-html.xsl is the natural place for html output templates)

Then add some output that you can see. 
xsl:message will print to the console for debugging.
HTML can be written more or less verbatim. This will wrap the contents of your <veil> in a div:

<xsl:template match="veil">
  <xsl:message>==This will print to the console if you run pretext in verbose mode==</xsl:message>
  <div class="veil">
    <xsl:apply-templates/>
  </div>
</xsl:template>


p.s. I thought we were supposed to start from the schema. ;)

Andrew Scholer (he/him/his)
Computer Science Instructor
Chemeketa Community College


--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/793687db-3d6a-4114-a4bf-e6502fede488n%40googlegroups.com.

Rob Beezer

unread,
Jul 11, 2025, 10:50:25 AMJul 11
to prete...@googlegroups.com
On 7/11/25 07:22, Geoffrey Cox wrote:
> I am ready to put some time into this, but after re-reading Rob's post, I
> realize the intention may have been to make baby steps through the process and
> update here as I go.

Exactly - one step at a time.

> First Step: As for a name, "veil" seems good to me. Maybe "cover" or "covering"?

Sure - your call as implementer. ;-) "cover" might get confused with book covers.

> 1. I may not be able to see the big picture yet, but I prefer starting with
> simple markup until I see it working. Then go in and try to break it.

I presume you have some #veil in a new paragraph in the sample article.

> 2. Is this what you mean?
> ```
> <xsl:template match="veil">
>   <xsl:apply-templates/>
> </xsl:template>
And that should have no effect. ;-) Good.

Now in the LaTeX stylesheet, and in the HTML stylesheet, make templates with the
identical @match. These will override your base template according to the
import hierarchy.

Have the one spit out the HTML you demo'ed in your original post.

Have the LaTeX make an underline or something else (will the content be there,
or not?). You could put the content in a footnote. (Just kidding.) See
#fillin for some hints on underlines (I think). Not clear to me if the length
of the space should be proportional to the content.

If you get things working, a draft PR might be a good way to get more feedback.

Rob

Geoffrey Cox

unread,
Jul 11, 2025, 2:07:44 PMJul 11
to PreTeXt development
Just another update to make sure I am on the right track.

Summary:

1. Added some <veil> markup to sample-article.xml:

<section xml:id="section-veil-testing">
    <title><c>veil</c> Testing</title>
   
    <p>
        The function <veil><m>f(t) = e^{-t}</m></veil> satisfies the differential equation
        <me>f'(t) = -f(t)</me>,
        which is characteristic of <veil>exponential</veil> decay.
    </p>
</section>

1. Modified pretext-common.xsl:


<xsl:template match="veil">
    <xsl:apply-templates/>
</xsl:template>

2. Modified pretext-html.xsl:

<xsl:template match="veil[not(parent::m or parent::me or parent::men or parent::mrow)]">
    <span class="veil-wrapper">
        <span class="veil-inner">
        <span class="veil-toggle">reveal</span>
        <span class="veil-content">
            <xsl:apply-templates/>
        </span>
        </span>
    </span>
</xsl:template>

3. Added _veil.scss.

4. Modified _pretext.scss:

@use 'elements/veil';

After building the sample article, here is what I see 
veil-screen.png

I haven't hooked up the JS yet, so it doesn't do anything.

So, which JS file should I be modifying to bring this to life?




Geoffrey Cox

unread,
Jul 11, 2025, 2:10:36 PMJul 11
to PreTeXt development
I forgot to mention that I haven't messed with the LaTeX side yet. 

Geoffrey Cox

unread,
Jul 11, 2025, 2:21:51 PMJul 11
to PreTeXt development
Also, the XML header

<xsl:template match="veil[not(parent::m or parent::me or parent::men or parent::mrow)]">

 I stole this from <fillin>, so I don't know exactly what it does or if it is even necessary for this element.

D. Brian Walton

unread,
Jul 11, 2025, 2:37:18 PMJul 11
to prete...@googlegroups.com
That is going to skip instances with the veil element inside a math-mode element. I don't think you want to try to veil individual subformulas within a math element, so you can probably start by dropping the bracketed expression. (If you kept it, you would probably need to use `\phantom{...}` surrounding the formula, and it would be up to the author to ensure that this was going to be self-consistent.)

Brian

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/7d5f38e5-ca6e-4015-9f7d-809b34781ef4n%40googlegroups.com.

Geoffrey Cox

unread,
Jul 11, 2025, 2:40:10 PMJul 11
to PreTeXt development
That makes perfect sense and should not be there. Thank you!

Andrew Scholer

unread,
Jul 11, 2025, 7:11:26 PMJul 11
to prete...@googlegroups.com
As far as what JS file, pretext_add_on.js is likely the best spot.


Andrew Scholer (he/him/his)
Computer Science Instructor
Chemeketa Community College

On Fri, Jul 11, 2025 at 11:40 AM Geoffrey Cox <gcox...@gmail.com> wrote:
That makes perfect sense and should not be there. Thank you!

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.

Geoffrey Cox

unread,
Jul 14, 2025, 4:07:54 PMJul 14
to PreTeXt development
Thanks for the help, Andrew.

I believe I got the basic pieces together. Still needs more work, though.


Geoffrey Cox

unread,
Aug 20, 2025, 11:04:21 AMAug 20
to PreTeXt development
Update: I closed the previous PR and opened a new one here: https://github.com/PreTeXtBook/pretext/pull/2671

The HTML side of this seems straightforward, but Rob mentioned that the print version needs further discussion. Currently, the print version displays the <veil>'s content and underlines it for inline only. Multiline content is displayed as usual. So it is essentially an "instructor's version".

From a guided notes perspective, there should be a good way to create a "student version" that can be printed, and the <veil>'s content is blank, and the students fill it in.

To the group: Are there any suggestions on the best way to move forward?



Reply all
Reply to author
Forward
0 new messages