Skip to content

Missing instant preview for essay questions #1353

Open
@robert-marik

Description

@robert-marik

Issue description: In many places (Colab for example) we can see instant preview for the text typed by the student. It would be great to have this feature in WeBWorK as well.


Partial workaround follows

Until some kind of the live preview gets into WeBWorK I can share at least some partial solution/hack. It relies on the fact that there is no other question than the essay question in the problem (the field name is hardcoded in javascripts), it works in WeBWorK 2.16 and the output should be as on the picture.

Screenshot from 2021-04-30 07-56-31

The text area is hidden and replaced by Ace editor with instant preview. The output of the ace editor is written also to the hidden text area for answers and this is saved by webwork. There are some buttons which help to insert characters like \frac{}{} which is very annoying on non-US keyboard. The file from the example in the image is https://github.com/robert-marik/hw-webwork/blob/master/makra/ace_test.pg and it needs the macros from https://github.com/robert-marik/hw-webwork/blob/master/makra/PGessayLivePreviewAce3.pl . The only requirement is to load this macro, the rest of the pg file is as usual.

For older version prior WW2.16 and MathJax3 you can use https://github.com/robert-marik/hw-webwork/blob/master/makra/PGessayLivePreviewAce.pl and replace the corresponding line in the pg file.

This allows to use more comfortable way to enter answers to essay questions without changing webwork internals. Feel free to use it. Unfortunately, I do not have enough knowledge of webwork internals to provide full integration. Anyway it seems to be reliable solution if you ask just on this essay questions. I used this in last two semesters in courses for non-math students (wood engineering, landscape engineering, urban forestry, ...) and it allows to learn and use LaTeX easily.

The missing css file just aligns the preview in the preview table to the left. Safe to ignore for testing purposes.

For non-US users: The file complains on other character than ASCII and Czech accents. You may customize the function CheckForAscii if you decide to allow also other characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions