Embed homework questions created with other systems?

242 views
Skip to first unread message

Libin Mou

unread,
Feb 4, 2021, 7:55:51 PM2/4/21
to PreTeXt development
How do I embed homework questions created with other systems like MyOpenMath?
(https://www.myopenmath.com/) It would be really nice since I have an easier way to access the system and many questions have been created. Any ideas or suggestions would be appreciated.

Alex Jordan

unread,
Feb 4, 2021, 8:10:03 PM2/4/21
to prete...@googlegroups.com
Hello Libin,

There is preliminary support for MyOpenMath in particular, as
demonstrated in the sample article here:
https://pretextbook.org/examples/sample-article/html/section-myopenmath.html

This is rudimentary, and a motivated contributor to grow this feature
would be welcome. I could even coach as needed given my understanding
of how it is all done with WeBWorK.

Alex
> --
> 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 on the web visit https://groups.google.com/d/msgid/pretext-dev/68fea702-f6dc-48e3-a327-3b7d9d995267n%40googlegroups.com.

Libin Mou

unread,
Feb 4, 2021, 8:33:14 PM2/4/21
to PreTeXt development
Alex,

That is great and I would like to figure out how to do it. I think MyOpenMath is some kind of derivative of IMathAS (https://www.imathas.com/) , which is similar to WebWork and has some other features.  I installed IMathAS on a web hosting server and have full access to the system.

I installed Pretext on a PC with window 10. Did anyone install Pretext on a cloud server? 

Thanks!
Libin

Alex Jordan

unread,
Feb 5, 2021, 3:12:16 AM2/5/21
to prete...@googlegroups.com
Just spouting some thoughts here. iMathAS is the underlying system,
and MyOpenMath is an instance of it that provides open hosting. What
PreTeXt has right now is only for MyOpenMath itself. So it would take
a little work (but maybe not much?) to adjust PTX to get problems from
another iMathAS instance.

You can reference a MOM problem ID, like 2572 and 7492 are the ones
used in the PTX sample article. The pretext script calls these
problems from MOM, where David Lippman has set things up so that a PTX
version of a specified random version the exercise is returned. This
is what you see in the sample article PDF, or the sample article HTML
if configured to make a static version of the problem. If the HTML is
configured to make a live version of the problem, it will be embedded
in an iframe as it is right now at
https://pretextbook.org/examples/sample-article/html/section-myopenmath.html.

There are several issues to overcome for robust support. One is that
in general MOM problems are written by contributors, using HTML for
the problem statement portion. And it is common to find non-semantic
markup in that HTML (like a <b> tag, or inline CSS styling to achieve
some desired visual end). The PTX you get back from that is only ever
going to be a guess (like guessing <em> for the <b>) or is going to be
completely lost (like any inline CSS).

Another issue is that it is not uncommon to find incorrect HTML (like
a <p> tag never gets closed). It's not clear what the PTX that comes
out of that will look like, if it will be valid.

Another issue is that I don't know if more complicated constructions,
like a table with cells spanning multiple columns is supported (that
is, would return usable PTX). Those two examples don't contain an
image, so I wonder if images are supported right now. Extending what
is supported now might need direct assistance from David Lippman.

A WeBWorK exercise coming from the OPL might have some of these
issues, but it is less likely. Mostly because WW was built from the
start to support multiple output formats (PDF and HTML), so that has
helped it have PTX support added. Everything already passes through
presentation macros where you can just define what the "new" PTX
output should be. The fact that MOM exercise statements are written
directly using HTML reveals that HTML is central, and it will be
harder to get good PTX out of the existing MOM problems. As things
stand, it's hard to predict how successful you would be just pulling
in the MOM problems you want to pull in. The next thing to try is to
take those problems and make copies of them in MOM that you edit as
needed to fix things, like say the p tag that was never closed.

On the WW side, you can also write the exercise directly into your PTX
document. This leaves you with a WW problem that is guaranteed to work
for all the PTX purposes. It would be nice to have that for MOM too
(or rather, for iMathAS). But then you would be writing problems from
scratch, and it sounds like the goal is to access the existing MOM
problems.

One more thought. Just because you have an iMathAS installation, I'm
not sure if you necessarily get the libraries of problems that are up
at MOM. I know that it's possible to have an iMathAS instance with
your own private or in-house libraries. With the one you set up, have
you seen if you have those libraries? Can you load problem 7492 from
there? If not, I bet there is a way to get them. But I would guess
that the id numbers might differ, since other iMathAS instances can
make their own private libraries using the same id system. [I may have
a fundamental misunderstanding here.]

Can you provide a small sample of MOM problem ID numbers that you
would like to have? I could do a cursory analysis to assess how well
they will work with the current state of PTX.

> I installed Pretext on a PC with window 10. Did anyone install Pretext on a cloud server?

I think Rob or someone else should give you an answer to this.

On Thu, Feb 4, 2021 at 5:33 PM 'Libin Mou' via PreTeXt development
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/ea77c0c3-00c4-4733-88e6-92a787f0cf60n%40googlegroups.com.

Libin Mou

unread,
Feb 5, 2021, 1:05:32 PM2/5/21
to PreTeXt development
Alex, 

Thanks a lot for taking the time to explain the issues. They are very helpful.

I think once it is done and works for MyOpenMath, the other sites of IMathAS can work similarly.

Indeed, the codes of some of the questions created at IMathAS may contain non-semantic markups and incorrect tags, but they can be easily corrected by the creators of the questions if they want to embed the questions in PreText.  As for tables and images included in the questions that I tried, they appear to be displayed correctly. Here are some examples.  

https://www.myopenmath.com/embedq.php?id=4 (table)

https://www.myopenmath.com/embedq.php?id=5046 (with video)

https://www.myopenmath.com/embedq.php?id=6000 (image)

https://www.myopenmath.com/embedq.php?id=6010 (3D graph)

https://www.myopenmath.com/embedq.php?id=7000 (histogram)

Being able to write exercises directly into PTX is nice and desirable, if necessary. I can access the libraries of questions and their id numbers. The id numbers of the questions are different at different installations of IMathAS. The above list of embedding links also work for other IMathAS, but the Id numbers of the same questions change when the questions are exported/imported. I have contact with Dave Lippman. He is very helpful as well. 

Thank you and the whole group for the wonderful project!

Libin

Alex Jordan

unread,
Feb 5, 2021, 1:22:48 PM2/5/21
to prete...@googlegroups.com
To clear something up, yes those exercises with images work as live
problems in HTML. Where they may not yet be supported is static PTX
output formats. For example, here are the two MOM problems in the
sample article PDF:
https://pretextbook.org/examples/sample-article/derivatives.pdf#page=150

Or also, there are situations where you would only want a static,
non-interactive version in HTML.

On Fri, Feb 5, 2021 at 10:05 AM 'Libin Mou' via PreTeXt development
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/f76deb0a-40f4-4958-a2ee-9c09ca17c605n%40googlegroups.com.

Libin Mou

unread,
Feb 5, 2021, 3:58:21 PM2/5/21
to prete...@googlegroups.com
I see. Thanks for the pdf reference.
Libin




You received this message because you are subscribed to a topic in the Google Groups "PreTeXt development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-dev/cB8-6SiWhrY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/CA%2BR-jrf7XvQ0w-Lg1MViYwULpJ5p%3D01J-qDS03SZDdkV-Zv21Q%40mail.gmail.com.

Rob Beezer

unread,
Feb 6, 2021, 7:03:23 PM2/6/21
to prete...@googlegroups.com
On 2/4/21 5:33 PM, 'Libin Mou' via PreTeXt development wrote:
> I installed Pretext on a PC with window 10. Did anyone install Pretext on a
> cloud server?

Not sure exactly what you have in mind here, but the only thing I know about
that comes close is CoCalc, where some project are successfully produced.

Basically it gives you an Ubuntu Linux command-line and file storage. Various
bits and pieces necessary for PreTreXt are already installed there - and if not
the CoCalc folks are very responive about adding in Python packages and other
open source tools.

Rob

Libin Mou

unread,
Feb 7, 2021, 9:52:48 PM2/7/21
to PreTeXt development
Right. What I meant was something like CoCalc. I would like to try to install Pretext on a domain hosted by a web server, 
which stores the programs, source files, and output files together.  Is there an instruction on to do it?

Also, I would like to know the XML codes to include an external URL like the following. 
 https://pretextbook.org/examples/sample-article/html/section-myopenmath.html
(I could only know how to use href="domain.com" /> for a link like https://www.myopenmath.com/embedq.php?id=4)

Is the link embedded in an iframe?  I like to know how to do it too. I went through the Pretext guides and samples that I could find, 
but I would like to have some XML code samples to follow.

Thanks a lot.
Libin

Rob Beezer

unread,
Feb 7, 2021, 10:52:27 PM2/7/21
to prete...@googlegroups.com
On 2/7/21 6:52 PM, 'Libin Mou' via PreTeXt development wrote:
> Right. What I meant was something like CoCalc. I would like to try to install
> Pretext on a domain hosted by a web server,
> which stores the programs, source files, and output files together.  Is there an
> instruction on to do it?

Not sure what the point of having a web server would be? If you are wondering
about a web interface for processing source to output, I'm not aware of any such
thing. We've not created any explicit support for this, everything is oriented
to local production via the command line.

> Also, I would like to know the XML codes to include an external URL like the
> following.
>  https://pretextbook.org/examples/sample-article/html/section-myopenmath.html
> (I could only know how to use href="domain.com" /> for a link
> like https://www.myopenmath.com/embedq.php?id=4)

https://pretextbook.org/doc/guide/html/topic-url.html

> Is the link embedded in an iframe?  I like to know how to do it too. I went
> through the Pretext guides and samples that I could find,
> but I would like to have some XML code samples to follow.

Poke around in

https://pretextbook.org/examples/sample-article/annotated/derivatives.html

and open thw "View Source" knowls. This is teh "Annotated" sample article
linked off of:

https://pretextbook.org/examples.html

Rob

Libin Mou

unread,
Feb 8, 2021, 12:18:14 AM2/8/21
to prete...@googlegroups.com
I thought it might be convenient if all files were saved online; the authors could access them anywhere and directly make the html files available online. However, I understand the purpose of the current design. 

I appreciate the resource links. They give me the samples and instructions that I need.
Thanks!
Libin



--
You received this message because you are subscribed to a topic in the Google Groups "PreTeXt development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-dev/cB8-6SiWhrY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/af383a88-56e4-d004-87a6-9de5d5a0ba7a%40ups.edu.

Rob Beezer

unread,
Feb 8, 2021, 5:56:35 PM2/8/21
to prete...@googlegroups.com
On 2/7/21 9:17 PM, 'Libin Mou' via PreTeXt development wrote:
> I thought it might be convenient if all files were saved online; the authors
> could access them anywhere and directly make the html files available online.
> However, I understand the purpose of the current design.

Many projects have their git repository at GitHub, which is a way to have the
files available through pushing and pulling (or downloading a zip file). It can
be complicated but collaborators can be trained to pull regularly and at least
always have a current copy.

GitHub can perform certain automated checks. I guess having it run xsltproc
and have HTML output end up hosted on a github.io site might be too much to expect.

> I appreciate the resource links. They give me the samples and instructions that
> I need.

Great! I'm glad that is what you needed.

Rob
Reply all
Reply to author
Forward
0 new messages