Graphs in multiple choice question

13 views
Skip to first unread message

Martin Jones

unread,
May 17, 2022, 6:59:03 AM5/17/22
to Numbas Users
I was looking into a question where the student needs to select the correct graph of a given function, but it is not working.

I used the syntax {graph} in the choice but it shows blank

I then tried $\var{graph}$ and it shows as in attached screenshot.
ppp3.png

Christian Lawson-Perfect

unread,
May 17, 2022, 8:49:02 AM5/17/22
to numbas...@googlegroups.com
Do you reuse the graph somewhere else, such as the advice? An HTML element such as a graph can only appear once in the question. If you want the same graph multiple times, often the best thing is to copy the code from the variable definition to a function, and use that to make a new instance of the graph in each place you want it to appear.
I'm sorry this feels unnecessarily awkward - it's impossible for Numbas to automatically copy interactive elements.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/72f9d9de-ecd8-4a00-9a86-ad6244e2b29bn%40googlegroups.com.

Don Shearman

unread,
May 17, 2022, 8:08:12 PM5/17/22
to Numbas Users
I had the same problem earlier in the year. Christian identified that the JSXGraph element was ending up in the "expected answer" box and not being displayed in the question. replacing the variable JSXGraph element with a function fixed this for us.

Don Shearman

Martin Jones

unread,
May 25, 2022, 6:36:08 AM5/25/22
to Numbas Users
Thanks for pointing this out. I was indeed using the same graph in the advice section.
Reply all
Reply to author
Forward
0 new messages