WeBWorK Main Forum

Essay questions and live preview

Essay questions and live preview

by Robert Mařík -
Number of replies: 2

Hello all.

I use (as many others) WeBWorK as a part of final grading and like also the essay questions. Many students do not answer these questions and I think that the reason is that LaTeX is new for them and they prefer computational questions. (Despite the fact that they get simple questions worth a good amount of points. But this is another story.)

In order to simplify writing the answer I tried to enable the live preview. The code is in fact taken from http://bandicoot.maths.adelaide.edu.au/MathJax/test/sample-dynamic-2.html

The result and the demo pg file is in the attached zip file. You have to load the file PGessayLivePreview.pl in the preamble and add the command "tlacitko" after "essay_box". This creates a new button "Zivy nahled zapnout/vypnout" which means "Live preview on/off". Clicking this button shrinks the textarea and opens the live preview.

There are some limitations, such as fixed name of the field, but it seems to be suitable for my requirements just now.

Someone could find this also useful so I am sharing the code. Any improvements or suggestions are welcome. Feel free to use/modify/extend/customize.

The file left.css just aligns the text in the preview table to the left (it is centered by default which makes the text looking strange).

Essay with live preview


In reply to Robert Mařík

Re: Essay questions and live preview

by Ping-Shun Chan -
I am very interested in seeing further development on this. In fact, with Mathquill, I wonder if it is worthwhile to consider inserting equation editors inline into the essay box (more precisely a "fake" one which mirrors the actual textarea one). I really can't expect many students, especially those in service courses, to bother to learn LaTeX. Below is a screenshot of something I cobbled together.

(I think, in the long run, "tinkerers" like myself would find it very helpful to have some specifications outlining how a javascript program should talk to various DOM elements generated by WeBWorK.)
In reply to Ping-Shun Chan

Re: Essay questions and live preview

by Robert Mařík -

Anyway, IMHO raw LaTeX is far better comparing to MathQuill. No doubt for mathematicians. But I teach non-mathematicians and especially these students work frequently with various software and need to enter formula there. LaTeX is common math notation and has support on all major platforms (Wikipedia, WordPress and WWW in general, markdown with all successors such as Rmarkdown, MS Word, regular LaTeX, Matlab live editor, ...) and it does not make any sense to omit the skills to write some math in scientific courses. I think that replacing LaTeX notation with a plugin is in general not good idea.