text2qti icon indicating copy to clipboard operation
text2qti copied to clipboard

Changing how LaTeX is rendered

Open gordonwatts opened this issue 3 years ago • 8 comments

I've just noticed this and I do not know if it impacts things here, but Canvas is now using a modern version of MathJAX, which makes for a much better rendering of math.

The $ special character read by text2qti could possibly be modified to automatically generate MathJAX recognized strings.

gordonwatts avatar Mar 19 '21 07:03 gordonwatts

Thanks for letting me know about this! This will make things much simpler, and also allow for block equations ($$...$$).

I can probably just change the handling of $ to swap it with \( and \) as needed to work with the new Canvas system.

gpoore avatar Mar 19 '21 14:03 gpoore

Could this change explain why I'm now getting "Latex:p" in my quiz questions when I use "$p$ in my .md file?

mikegilchrist avatar Aug 29 '21 17:08 mikegilchrist

@mikegilchrist If text2qti was working previously, and is now giving "Latex:p", then this could be responsible. At the very least, that probably means that something is failing with the LaTeX renderer and it is falling back to the alt text. Everything is still working for me, but that may also be due to Canvas configuration or other settings. Updating the LaTeX rendering will be part of the next text2qti release, but I probably have to finish a project for one of my other open-source programs before I can get back to working on text2qti.

gpoore avatar Aug 30 '21 11:08 gpoore

Could this change explain why I'm now getting "Latex:p" in my quiz questions when I use "$p$ in my .md file?

@mikegilchrist if you provide a MWE here then I will be glad to check to see if I get the same issue with your file on my Canvas. At the moment it is working OK for me with the .txt files I have. Feel free to email me if you'd rather not post your quiz publicly.

JeffFessler avatar Aug 31 '21 22:08 JeffFessler

Hi Jeff,

Try importing this....

% For use with text2qti
Quiz title: 09/07/2021: Modeling Cancer Development Pt. 1
Quiz description: Detailed description


% HartlAndRuvolo2012 - Probability


Title: Apply the sum rule for mutation rates
Points: 10
1.  There are two basic rules in probability, the sum rule and the product rule.
    These rules are used to calculate the probability of different possible scenarios using the basic mathematical operations of addition and multiplication.
    Using these rules, fill in the blanks for the following sentences
    
    a. Let $p_i$ represent the probability of loss of function mutation $i$ to protein A;
       Similarly, let $p_j$ represent the probability of loss of function mutation $j$ to protein A.
       Using the `____________` rule in probability, the protein A experiences a loss of function via either mutation $i$ or $j$, $p_{i \text{or} j} = $ `_______________` ($\leftarrow$ math goes here).
       
    b. Let $p_k$ represent the probability of loss of function mutation $i$ to protein A and  $p_l$ represent the probability of loss of function mutation $j$ to a different protein, protein B.
       Using the `____________` rule in probability, the probability both protein A and protein B experiences a loss of function via mutation $k$ and $l$, respectively, $p_{k \text{or} l} = $  `_______________` ($\leftarrow$ math goes here).
... a. `sum rule`;    $p_i + p_j$
    b. `product rule`; $p_k \times p_l$
___

When I load it into Canvas I get:

image

mikegilchrist avatar Sep 06 '21 14:09 mikegilchrist

Note that within Canvas if I click on the error spots and accept the 'edit equation' option that comes up, the math is properly typeset and if I save within the equation editor the issue is fixed in that instance.

mikegilchrist avatar Sep 06 '21 14:09 mikegilchrist

I converted your text with text2qti --pandoc-mathml tmp.txt and uploaded and I did not get the "LaTeX" key spilling in my output, but I too got that improper formatting of i \text{or} j and I have seen similar errors with my own source files. Now, perhaps you are using different options than text2qti --pandoc-mathml so let me know if you want me to try again with your options. Here's what it looked like for me:

Screen Shot 2021-09-06 at 12 44 25 PM

JeffFessler avatar Sep 06 '21 16:09 JeffFessler

@mikegilchrist @JeffFessler I had to swap = $ for =$ (note no space) to get the i \text{or} j working (closing $ must be preceded by non-space character), and after that everything works for me in Canvas. This is with the --latex-render-url for my institution...double-checking the URL or trying --pandoc-mathml would be ways to try to track down the source of problems.

gpoore avatar Sep 07 '21 13:09 gpoore