var inside c?

10 views
Skip to first unread message

Alex Jordan

unread,
May 23, 2023, 12:43:05 AM5/23/23
to pretext...@googlegroups.com
I have a webwork exercise where there is some text that should be inside a "c", but what goes in that text is randomized. So It would be like this:

<c><var name="$random_text"/></c>

Except that "c" won't permit element children. Is there a possible future where "var" inside "c" would be processed? Or is it not worth carving out that exception?

Any other ideas for how to make this work?

Rob Beezer

unread,
May 23, 2023, 10:19:23 AM5/23/23
to pretext...@googlegroups.com
Can you provide a more complete example?
> --
> 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/CA%2BR-jreM1N8vSLX9NGTJzTCN4Kc9h4Pf10HzNiSfQRbXRUi7tA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CA%2BR-jreM1N8vSLX9NGTJzTCN4Kc9h4Pf10HzNiSfQRbXRUi7tA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Alex Jordan

unread,
May 23, 2023, 12:26:17 PM5/23/23
to pretext...@googlegroups.com
The exercise asks for a linear equation to be solved, where the variable is randomized. There's a line of PG code like this:

$x = list_random( 'a' .. 'n', 'p' .. 'z', 'A' .. 'N', .. 'P' .. 'T', 'V' ..  'Z' );
# 'o', 'O' skipped as they look like '0'; 'U' skipped because PG defaults to seeing it as the union operator

The answer is supposed to be entered like
x = 7
or
V =7
etc.
Students may default to typing something like "7".

So all that motivates:
<instruction>
    Enter your solution in the form <c><var name="$x"/> = number</c>.
</instruction>

I think you might suggest:
<instruction>
    Enter your solution in the form <c>variable = number</c>.
</instruction>
which is a fallback plan if I don't end up with a way to use c/var.




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 visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAzNy5iZWV6ZXI.1684851559%40quikprotect.

Rob Beezer

unread,
May 23, 2023, 12:39:00 PM5/23/23
to pretext...@googlegroups.com
Thanks.

Does it make sense that we would only need to override the "c" template within
"extract-pg.xsl"?

Rob
> <mailto:pretext-support%2Bunsu...@googlegroups.com>
> > <mailto:pretext-suppo...@googlegroups.com
> <mailto:pretext-support%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pretext-support/CA%2BR-jreM1N8vSLX9NGTJzTCN4Kc9h4Pf10HzNiSfQRbXRUi7tA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CA%2BR-jreM1N8vSLX9NGTJzTCN4Kc9h4Pf10HzNiSfQRbXRUi7tA%40mail.gmail.com> <https://groups.google.com/d/msgid/pretext-support/CA%2BR-jreM1N8vSLX9NGTJzTCN4Kc9h4Pf10HzNiSfQRbXRUi7tA%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pretext-support/CA%2BR-jreM1N8vSLX9NGTJzTCN4Kc9h4Pf10HzNiSfQRbXRUi7tA%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> 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%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/MTAwMDAzNy5iZWV6ZXI.1684851559%40quikprotect <https://groups.google.com/d/msgid/pretext-support/MTAwMDAzNy5iZWV6ZXI.1684851559%40quikprotect>.
>
> --
> 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/CA%2BR-jrfAj7vEHcF7JY-WoJnnCf2G3zp49VByveLJeWP7_S1C1g%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CA%2BR-jrfAj7vEHcF7JY-WoJnnCf2G3zp49VByveLJeWP7_S1C1g%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Alex Jordan

unread,
May 23, 2023, 12:49:30 PM5/23/23
to pretext...@googlegroups.com
I think so, but I haven't tried yet. There is a special run-time error/warning message if your "c" has an element child, and I'm not sure if over-riding the c template in extract-pg would sidestep that message. It might.
'
I have a growing list of summer projects and I would add this to that list. But I want to check if it's a nonstarter first. I could understand the principle that verbatim should just be verbatim, if we want that to be the case.

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 visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAwNi5iZWV6ZXI.1684859935%40quikprotect.

Sean Fitzpatrick

unread,
May 23, 2023, 1:02:52 PM5/23/23
to pretext...@googlegroups.com
For this WeBWorK problem, is there a reason it should be verbatim?
My first thought was that you could do something like 
<m><var name="$x"/>=\texttt{number}</>


Alex Jordan

unread,
May 23, 2023, 1:16:17 PM5/23/23
to pretext...@googlegroups.com
Since it's instructions on what keys to type with a keyboard, I view it as a case for "c", not "m". I guess if I were not using "c", I'd probably prefer using "q" to using "m".

Reply all
Reply to author
Forward
0 new messages