PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
266 stars 208 forks source link

<intertext> not working inside a webwork exercise #754

Closed rkouzes closed 4 years ago

rkouzes commented 7 years ago

We have a Webwork exercise set up in our content and part of the solution has an intertext tag that does not properly compile to the html version. Instead it is simply missing as if it weren't there at all. Any idea why this is happening? We use the intertext tag successfully later on the page in a non-Webwork example.

rbeezer commented 7 years ago

Sorry for the delay - I've been traveling, mostly without internet. I like to reply to bug reports much faster than this.

I think this should mostly be an oversight. The WW language is a bit restriictive, but we should be able to support this. @Alex-Jordan knows the details better than me, maybe he can comment on what needs to happen?

Alex-Jordan commented 7 years ago

I looked a little closer.

The main issue is that mathbook-webwork-pg.xsl has a template for md, and that template uses the mrows but does nothing with any intertext.

I briefly put some effort into a patch for this. However there is a snag that should be resolved with input from Rob. The snag is that in a WW, md doesn't use align, alignat, or gather. It necessarily uses aligned, alignedat, or gathered. So to use any intertexts, you have to close one of these ed variants. There is a common template to identify if an md is using align, alignat, or gather, but not one for ed variants.

So here's an idea for a patch I could implement with Rob's nod of approval. Augment the common template to look upward to see if there is a webwork ancestor. And if so, use the ed variant. Then modify md in mathbook-webwork-pg.xsl accordingly to make use of any intertext. And also, define webwork//intertext.

rbeezer commented 7 years ago

Yes, I think modifying the common template to return a "-ed" variant in the case of a "webwork" ancestor would be the cleanest way to go. Document that it is only effective for WW problems (even if the condition seems to make it clear). If you use xsl:choose (or it is there already), but more restrictive cases first.

Thanks for investigating this one - sounds pretty much like I expected.

On 10/23/2017 08:36 PM, Alex Jordan wrote:

I looked a little closer.

The main issue is that |mathbook-webwork-pg.xsl| has a template for |md|, and that template uses the |mrow|s but does nothing with any |intertext|.

I briefly put some effort into a patch for this. However there is a snag that should be resolved with input from Rob. The snag is that in a WW, |md| doesn't use |align|, |alignat|, or |gather|. It necessarily uses |aligned|, |alignedat|, or |gathered|. So to use any |intertext|s, you have to close one of these |ed| variants. There is a common template to identify if an |md| is using |align|, |alignat|, or |gather|, but not one for |ed| variants.

So here's an idea for a patch I could implement with Rob's nod of approval. Augment the common template to look upward to see if there is a |webwork| ancestor. And if so, use the |ed| variant. Then modify |md| in |mathbook-webwork-pg.xsl| accordingly to make use of any |intertext|. And also, define |webwork//intertext|.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/754#issuecomment-338755557, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2cm_AR2xB1oI-C1DuTp-qpNvhVYs9ks5svNyhgaJpZM4P-TA4.

Alex-Jordan commented 4 years ago

1309 should address this.

rbeezer commented 4 years ago

Closing in favor of #1309