Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing how LaTeX is rendered #43

Open
gordonwatts opened this issue Mar 19, 2021 · 8 comments
Open

Changing how LaTeX is rendered #43

gordonwatts opened this issue Mar 19, 2021 · 8 comments

Comments

@gordonwatts
Copy link

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.

@gpoore
Copy link
Owner

gpoore commented Mar 19, 2021

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.

@mikegilchrist
Copy link

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

@gpoore
Copy link
Owner

gpoore commented Aug 30, 2021

@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.

@JeffFessler
Copy link

JeffFessler commented Aug 31, 2021

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.

@mikegilchrist
Copy link

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
Copy link

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.

@JeffFessler
Copy link

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

@gpoore
Copy link
Owner

gpoore commented Sep 7, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants