Exercises and solutions - placement

61 views
Skip to first unread message

Bob Plantz

unread,
Nov 3, 2015, 7:27:11 PM11/3/15
to MathBook XML Support
Earlier this year there was a discussion of exercises and the placement of solutions. It was stated that the solutions can be placed in the backmatter in the PDF version. I'm finding that the solution is also placed at the location of the original statement of the exercise.

In the HTML version there is a knowl at the location of the original statement of the exercise, so the student has to take an action to see it.

In both versions the original exercise is repeated with the solution in the backmatter.

Is it possible to do two things?

1. Not have the solution at the location of the original exercise statement in the PDF version. I'm a fan of including solutions to all exercises in my books (they'll quickly be on the internet anyway) but would like for students to have to make a slight effort to see the solution.

2. Not have the original statement repeated with the solution in the backmatter. My motivation for producing a PDF version is to allow for a paperback version. It seems like a waste of trees to repeat the exercise statement.

I decided several years ago to include solutions to exercises when I wrote my current book (pre-MBX). In addition to knowing that solutions will appear on the internet anyway, I think it's good pedagogy for students to attempt a solution, but be able to at least glance at the solution when they get stuck. Also, in a programming book, I think it's good for students to be able to see my (presumably) good solutions. In a way, I see exercises as try-it-yourself-before-peeking examples of how to do things.

Rob Beezer

unread,
Nov 3, 2015, 7:40:49 PM11/3/15
to mathbook-x...@googlegroups.com
Quick answer - more later.

Look at about line 95 of xsl/mathbook-common.xsl for 8 "xsl:param"

Use these on the command line with --stringparam to control placement. I'd
like to expand them from "yes|no" to "yes|knowl|no" or similar for HTML output,
but that won't happen soon, I don't think.

I think they will do everything you want. Code to build up backmatter needs
real help, but I think it all "works". Look at Tom Judson's AATA source on
github for help with backmatter construction.

Shortly I'll be offline until late tonight and will check back to see if this
does the job for you.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "MathBook XML Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to mathbook-xml-sup...@googlegroups.com
> <mailto:mathbook-xml-sup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Bob Plantz

unread,
Nov 3, 2015, 11:44:42 PM11/3/15
to MathBook XML Support, bee...@ups.edu
Bingo! Does almost exactly what I was looking for. Certainly very acceptable.

It would be nice to drop the "solution-list" from the HTML version since the solutions are knowls at the location of the original exercise statement, but that's a very minor point.

The PDF version comes out just as I wanted.

It looks like I can implement all the features I want for my book. Now I guess it's time to get started on the text. As I've mentioned, it will be a rewrite of my current book, which is written in LaTeX. I'm planning to play with LaTeXML to convert the LaTeX to XML, and then work from that.

Bob

Rob Beezer

unread,
Nov 4, 2015, 2:38:09 AM11/4/15
to mathbook-x...@googlegroups.com
On 11/03/2015 04:27 PM, Bob Plantz wrote:
> I decided several years ago to include solutions to exercises when I wrote my
> current book (pre-MBX). In addition to knowing that solutions will appear on the
> internet anyway, I think it's good pedagogy for students to attempt a solution,
> but be able to at least glance at the solution when they get stuck. Also, in a
> programming book, I think it's good for students to be able to see my
> (presumably) good solutions. In a way, I see exercises as
> try-it-yourself-before-peeking examples of how to do things.

I personally agree 100%, since I did my linear algebra book this way, for pretty
much the same reasons. But I know people who have not chosen to use the book
for this reason. And one person re-TeX'ed my book without solutions and claims
her students never found the public ones at the book's site.

But I also understand reasons for keeping solutions private. Mostly for anybody
reading this thread, we setup Judson's AATA with a private git repository that
has exercises and solutions, and then we use XSL to just extract exercises
(only) into the public repository. It is a bit of a fiddle, but not a big
problem once the book matures, and is scriptable.

Rob

Rob Beezer

unread,
Nov 4, 2015, 2:46:11 AM11/4/15
to mathbook-x...@googlegroups.com
On 11/03/2015 08:44 PM, Bob Plantz wrote:
> Bingo! Does almost exactly what I was looking for. Certainly very acceptable.

Great!

> It would be nice to drop the "solution-list" from the HTML version since the
> solutions are knowls at the location of the original exercise statement, but
> that's a very minor point.

I guess I could have the "solution-list" be totally empty if all "backmatter"
switches were "no", but then you would still have an enclosing
section/chapter/structure that would be hard to squash. I'll have to think
about that one. Basic "problem" is that your source is totally independent of
the output format, so it is hard to say have a back matter solution list for
PDF, but not HTML. (Though it is a perfectly reasonable request.)

> It looks like I can implement all the features I want for my book. Now I guess
> it's time to get started on the text. As I've mentioned, it will be a rewrite of
> my current book, which is written in LaTeX. I'm planning to play with LaTeXML to
> convert the LaTeX to XML, and then work from that.

I thought maybe you were up to Chapter 4 already. ;-) There are single-use
quick-and-dirty sed scripts in the AATA repository that we used to convert to
from LaTeX - you might get some ideas from those.

Keep the questions coming - it'll help me prioritize better documentation this
spring.

Rob

Bob Plantz

unread,
Nov 10, 2015, 6:19:19 PM11/10/15
to mathbook-x...@googlegroups.com


On 11/03/2015 11:38 PM, Rob Beezer wrote:
> On 11/03/2015 04:27 PM, Bob Plantz wrote:
>> I decided several years ago to include solutions to exercises when I
>> wrote my
>> current book (pre-MBX). In addition to knowing that solutions will
>> appear on the
>> internet anyway, I think it's good pedagogy for students to attempt a
>> solution,
>> but be able to at least glance at the solution when they get stuck.
>> Also, in a
>> programming book, I think it's good for students to be able to see my
>> (presumably) good solutions. In a way, I see exercises as
>> try-it-yourself-before-peeking examples of how to do things.
>
> I personally agree 100%, since I did my linear algebra book this way,
> for pretty much the same reasons. But I know people who have not
> chosen to use the book for this reason. And one person re-TeX'ed my
> book without solutions and claims her students never found the public
> ones at the book's site.

CS 101 Exercise: Find the public solutions at the book's site. :-)

Jessica Sklar

unread,
Jul 31, 2017, 4:18:47 PM7/31/17
to MathBook XML Support, bee...@ups.edu
 I'd
like to expand them from "yes|no" to "yes|knowl|no" or similar for HTML output,
but that won't happen soon, I don't think.

Yes, please!

Jessica Sklar

unread,
Jul 31, 2017, 4:22:12 PM7/31/17
to MathBook XML Support, bee...@ups.edu
Oh, wait, it looks like maybe that's done!  Will go play with it in mathbook-common.xsl now ...

Bob Plantz

unread,
Aug 5, 2017, 3:31:25 PM8/5/17
to MathBook XML Support, bee...@ups.edu
"Will go play with it in mathbook-common.xsl now". Not sure what you mean here, Jessica, but if you change this file, it will be overwritten next time you update PreTeXt. A better way is to create your own thin xsl file, which then imports the standard PreTeXt xsl file. E.g., for my book I have the file intro-co-rpi-html.xsl, which includes the statement:

<!-- Edit path for your environment                           -->
<xsl:import href="/home/bob/PreTeXt/xsl/mathbook-html.xsl" />

This is followed by my custom modifications. I also have intro-co-rpi-latex.xsl. Of course, if I want to customize anything in common, it needs to go in both these files (thus tempting the devil).

--Bob

Jessica Sklar

unread,
Aug 5, 2017, 3:38:20 PM8/5/17
to mathbook-x...@googlegroups.com
Hi Bob, 

Thank you! It does indeed get overwritten every time, which has been a pain. 

If I understand you correctly, I could create my own style file that includes the mathbook-html.xsl file, and then contains an additional command changing switches as I like? Do I  just use the same code as in the corresponding line in the mathbook-html.xsl file, but replacing "yes"  with "no"  or vice versa? 

--
You received this message because you are subscribed to a topic in the Google Groups "MathBook XML Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathbook-xml-support+unsub...@googlegroups.com.

Bob Plantz

unread,
Aug 5, 2017, 4:27:44 PM8/5/17
to mathbook-x...@googlegroups.com
Jessica,

Basically, yes. I've attached a copy of my file. Of course, I think you will need to modify path names, etc., for the Windows environment. I don't claim that this is the best way; I'm also learning this stuff as we go. And note that I've commented some things out. I don't recall why at this point.

I've also attached a copy of the script I use to save a lot of typing. Perhaps you can adapt this to Windows.

BTW, I will probably be able to chime in with your Windows work before too long. I switched from Mac to Windows a dozen years ago (after being an early (1984) Mac person). I'm doing the PTX stuff on Ubuntu Linux for now, but I'd like to eventually move it to Windows. (My reasons for switching are another story. Hint: read Isaacson's Steve Jobs, which reinforced my decision.)

--Bob

To unsubscribe from this group and all its topics, send an email to mathbook-xml-support+unsubscrib...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "MathBook XML Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathbook-xml-support+unsub...@googlegroups.com.
intro-co-rpi-html.xsl
do-web.sh

Jessica Sklar

unread,
Aug 5, 2017, 4:32:44 PM8/5/17
to mathbook-x...@googlegroups.com
Thanks for your code and the script!  I'll give it a shot later today or tomorrow. And thanks in advance for any input on the Windows tutorial.

Jess

To unsubscribe from this group and stop receiving emails from it, send an email to mathbook-xml-support+unsubscrib...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "MathBook XML Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathbook-xml-support+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Dr. Jessica Sklar
Chair of Mathematics
Pacific Lutheran University

Jessica Sklar

unread,
Aug 6, 2017, 7:45:01 PM8/6/17
to mathbook-x...@googlegroups.com
Bob, I just wanted to thank you again for your suggestion of a thin xsl file.  I put one in my mathbook/user folder, and now I won't need to keep recoding like a hack everytime I update my local mathbook repo.

Jess

--
Dr. Jessica Sklar
Chair of Mathematics
Pacific Lutheran University

Rob Beezer

unread,
Aug 6, 2017, 8:12:36 PM8/6/17
to mathbook-x...@googlegroups.com
Make sure you keep copies somewhere else. Now and then you may want to clear
out that directory during testing (esp. the mbx script).

On 08/06/2017 04:45 PM, Jessica Sklar wrote:
> Bob, I just wanted to thank you again for your suggestion of a thin xsl file. I
> put one in my mathbook/user folder, and now I won't need to keep recoding like a
> hack everytime I update my local mathbook repo.
>
> Jess
>
> On Sat, Aug 5, 2017 at 1:32 PM, Jessica Sklar <skl...@plu.edu
> <mailto:skl...@plu.edu>> wrote:
>
> Thanks for your code and the script! I'll give it a shot later today or
> tomorrow. And thanks in advance for any input on the Windows tutorial.
>
> Jess
>
> On Sat, Aug 5, 2017 at 1:27 PM, Bob Plantz <rgpl...@gmail.com
> <mailto:rgpl...@gmail.com>> wrote:
>
> Jessica,
>
> Basically, yes. I've attached a copy of my file. Of course, I think you
> will need to modify path names, etc., for the Windows environment. I
> don't claim that this is the best way; I'm also learning this stuff as
> we go. And note that I've commented some things out. I don't recall why
> at this point.
>
> I've also attached a copy of the script I use to save a lot of typing.
> Perhaps you can adapt this to Windows.
>
> BTW, I will probably be able to chime in with your Windows work before
> too long. I switched from Mac to Windows a dozen years ago (after being
> an early (1984) Mac person). I'm doing the PTX stuff on Ubuntu Linux for
> now, but I'd like to eventually move it to Windows. (My reasons for
> switching are another story. Hint: read Isaacson's /Steve Jobs,/ which
> reinforced my decision/./)
>
> --Bob
>
> On Sat, Aug 5, 2017 at 12:38 PM, Jessica Sklar <skl...@plu.edu
> <mailto:skl...@plu.edu>> wrote:
>
> Hi Bob,
>
> Thank you! It does indeed get overwritten every time, which has been
> a pain.
>
> If I understand you correctly, I could create my own style file that
> includes the mathbook-html.xsl file, and then contains an additional
> command changing switches as I like? Do I just use the same code as
> in the corresponding line in the mathbook-html.xsl file, but
> replacing "yes" with "no" or vice versa?
>
> On Aug 5, 2017 12:31 PM, "Bob Plantz" <rgpl...@gmail.com
> <https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email
> to mathbook-xml-sup...@googlegroups.com
> <mailto:mathbook-xml-sup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "MathBook XML Support" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to mathbook-xml-sup...@googlegroups.com
> <mailto:mathbook-xml-sup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "MathBook XML Support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe
> <https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> mathbook-xml-sup...@googlegroups.com
> <mailto:mathbook-xml-sup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
>
>
> --
> Dr. Jessica Sklar
> Chair of Mathematics
> Pacific Lutheran University
>
>
>
>
> --
> Dr. Jessica Sklar
> Chair of Mathematics
> Pacific Lutheran University
>
> --
> You received this message because you are subscribed to the Google Groups
> "MathBook XML Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to mathbook-xml-sup...@googlegroups.com
> <mailto:mathbook-xml-sup...@googlegroups.com>.

Bob Plantz

unread,
Aug 6, 2017, 8:17:46 PM8/6/17
to mathbook-x...@googlegroups.com
You're very welcome, Jess. One of the things I like most about the PreTeXt project is that everyone is very helpful. In my view, that's the best way to do life.

--Bob


To unsubscribe from this group and stop receiving emails from it, send an email to mathbook-xml-support+unsub...@googlegroups.com.

Jessica Sklar

unread,
Aug 6, 2017, 8:35:19 PM8/6/17
to mathbook-x...@googlegroups.com
Will do. 


                For more options, visit https://groups.google.com/d/optout
                <https://groups.google.com/d/optout>.



            --
            You received this message because you are subscribed to the Google
            Groups "MathBook XML Support" group.
            To unsubscribe from this group and stop receiving emails from it,

            For more options, visit https://groups.google.com/d/optout
            <https://groups.google.com/d/optout>.



        --
        You received this message because you are subscribed to a topic in the
        Google Groups "MathBook XML Support" group.
        To unsubscribe from this topic, visit
        https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe
        <https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe>.

        To unsubscribe from this group and all its topics, send an email to

        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.





    --
    Dr. Jessica Sklar
    Chair of Mathematics
    Pacific Lutheran University




--
Dr. Jessica Sklar
Chair of Mathematics
Pacific Lutheran University

--
You received this message because you are subscribed to the Google Groups
"MathBook XML Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email

For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "MathBook XML Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathbook-xml-support/wJ0gDVvtDPc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathbook-xml-support+unsubscrib...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages