Hiding solutions in printed worksheets

14 views
Skip to first unread message

Oscar Levin

unread,
Dec 27, 2025, 4:15:10 PM12/27/25
to PreTeXt development
I've been working on improvements to the printable worksheets in HTML.  One thing that will be possible with the next CLI release is to hide solutions (including hints and answers) when printing.  So if you wanted to share solutions to a worksheet, but wanted to get a version to print without those solutions, you can just hide them when printing (all done with the javascript).

I need some insight from people who might use this (Mitch and others).  Say you have a worksheet that has no authored pages, but you have specified workspace.  When you first load the print preview, the javascript tries to break up pages based on honoring your workspace as best as it can and distributing extra workspace equitably.  If you have a solution, it takes up some space, so those page breaks might be different if the solution was there or not.  What should happen if you hide/show that solution?  Should page breaks be recomputed?  On the one hand, you probably don't want to print the solutions, so you would design the worksheet without thinking about the space taken up by solutions.  But then if you did want to get a version with printed solutions, the pages might break differently (which might be expected anyway).

I don't really know how to let the solutions "eat up" the workspace; I think that if you really wanted a printed version with solutions you would print from the main page, not the print preview anyway, but who knows?

A related question: should answers and solutions be hidden by default?  Right now I'm storing you choices in local storage, so this would only need to be clicked once anyway, but for students, it might make sense to only print solutions when requested.


Alex Jordan

unread,
Dec 27, 2025, 5:20:59 PM12/27/25
to prete...@googlegroups.com
Just my thoughts on the matter. If I were printing the worksheet and revealing solutions, I believe I'd want it to match the original worksheet as far as where page breaks happen, and other layout within each page. And in this scenario, I don't expect students to actually write their own solutions, so the workspace is not needed. Can you use CSS to make it so the solution container (some sort of div?) has "zero height" and is just overlaid on top of the workspace? Of course I am assuming the workspace was reasonable for a solution to fit, and that the PTX solution will be at least as compact as a student's hand-written solution.

Could you also use some CSS scaling to shrink a solution to force it to fit in the workspace?

As an instructor, I don't think I'd print off solutions like this. I'm just offering my thoughts, not requesting any particular behavior.

--
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/ce0c09a9-384b-49a0-b7ac-22fbcb7e5c41n%40googlegroups.com.

Andrew Scholer

unread,
Dec 27, 2025, 8:53:26 PM12/27/25
to prete...@googlegroups.com
My super helpful answer: it depends.

In testing out printable worksheets used as exams this past term, I ended up setting them up to paginate differently when printing keys, where the scoring details for a particular question (sample solution + rubric) often didn't fit in the same space that a student was given to write their answer.

But that was a situation with a small number of long answer questions.

For a large number of shorter answers, I would want the pagination to be consistent between exam and key. That way a student scanning their own work (or me using the grade to hand score something) is a much more efficient process.

I would say if you care that much about pagination, you maybe should specify pages manually. (Which I sometimes did.)

I really did find myself wanting <pagebreak/>. I know it has been discussed ad nauseum, but there are times when I know I don't know if a section (say introduction) is going to be a 0.5 pages, or 1.25 pages, or possibly one while printing a "key" version of the worksheet and the other while printing the "work" version of it, but I know I want to start a new page after that content is finished. In that situation, <page></page> is frustrating.


On Sat, Dec 27, 2025 at 1:15 PM Oscar Levin <oscar...@gmail.com> wrote:

Mitch Keller

unread,
Dec 29, 2025, 11:11:28 AM12/29/25
to prete...@googlegroups.com
I think others have already chimed in to suggest that if folks care immensely about this, they should author #page elements. However, I understand the desire/need to have some sensible default behavior. I think having the page breaks occur after the same elements is the key thing to me. If that ends up with a bunch of pages that look underfull once solutions are turned on, so be it. (I’m thinking that with solutions turned on, you just don’t bother leaving whitespace. Use the pagebreak information from the no solutions version and break after the solution for the last element that made it onto the page in the no solutions version.)

To the hidden by default question: Yes, I think it would be nice if hiding answers and solutions were the default.

While you’re working on this, can I put in a request to get some better styling for Hints on the printable page? I think the last time I had one, it was putting “Hint.” on a line by itself and then the text of the hint showed up below. That eats up a ton of space, so it would be nicer to have the hint header inline. (Definitely the same for answer. I think doing that for solution would also be fine.)

--
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/ce0c09a9-384b-49a0-b7ac-22fbcb7e5c41n%40googlegroups.com.

Oscar Levin

unread,
Dec 30, 2025, 9:07:49 PM (14 days ago) 12/30/25
to PreTeXt development
Thanks all for the suggestions.  Just submitted a PR that does some of this.  Notably:

- Styling will be a lot nicer
- After loading the page, if you toggle the "hide solutions" checkbox, pages are not recomputed, but workspace is evened out.
- If you reload the page after showing/hiding long solutions, that might change the page breaks.

I don't know if the last two are desirable, but with the way I'm computing workspaces and heights, there doesn't seem to be an easy way to ignore solutions (since they are inside the blocks that have their height computed).  So I'm giving up for now and if it turns out to be super annoying for some folks, I can revisit later.

Reply all
Reply to author
Forward
0 new messages