Open siwelwerd opened 2 years ago
This might be a bug in PreTeXt. I believe they intend to support bare <me>
tags in <li>
s. I'm guessing you found this when pasting a CheckIt exercise's PreTeXt output into our PreTeXt textbook source? (Screenshot/link me if you can.)
Here's what it looks like in the CheckIt Viewer (which handles PreTeXt-to-HTML differently than the PreTeXt app):
In CheckIt 0.2 I intend to restrict the subset of PreTeXt we support (e.g. you must use <p>
around any mathematics) to avoid these bugs, and explicitly document what that subset is. Then if you use incompatible or invalid PreTeXt, it won't appear in the dashboard when previewing. As part of this process I'll port all the banks linked at https://checkit.clontz.org to 0.2 and fix these kinds of issues (I've been sprinkling in <p>
s in the linear algebra bank throughout the semester to anticipate this, but missed this one...).
Yeah, that's exactly where I encountered it. I corrected it manually in the activity book. My references above were to the HTML output and PreTeXt output displayed by the Dashboard preview (I assumed the viewer was using this same HTML). Here's an example from LE1, note the <p class="math math-display">
in the HTML output, but not <p>
in PreTeXt output.
PreTeXt source
------------
<exercise checkit-seed="4419" checkit-slug="LE1" checkit-title="Linear systems, vector equations, and augmented matrices">
<statement>
<p>Consider the vector equation.</p>
<me>x_{1} \left[\begin{array}{c}
1 \\
3 \\
0 \\
-3
\end{array}\right] + x_{2} \left[\begin{array}{c}
2 \\
4 \\
-1 \\
-4
\end{array}\right] + x_{3} \left[\begin{array}{c}
1 \\
0 \\
-2 \\
-1
\end{array}\right] = \left[\begin{array}{c}
2 \\
9 \\
3 \\
-6
\end{array}\right]</me>
<ol>
<li> Write a system of scalar equations corresponding to this vector equation. </li>
<li> Write an augmented matrix corresponding to this vector equation. </li>
</ol>
</statement>
<answer>
<ol>
<li><me>\begin{matrix}
x & + & 2 \, y & + & z & = & 2 \\
3 \, x & + & 4 \, y & & & = & 9 \\
& - & y & - & 2 \, z & = & 3 \\
-3 \, x & - & 4 \, y & - & z & = & -6 \\
\end{matrix}</me></li>
<li><me>\left[\begin{array}{ccc|c}
1 & 2 & 1 & 2 \\
3 & 4 & 0 & 9 \\
0 & -1 & -2 & 3 \\
-3 & -4 & -1 & -6
\end{array}\right]</me></li>
</ol>
</answer>
</exercise>
HTML source
-----------
<div class="checkit exercise" data-checkit-slug="LE1" data-checkit-title="Linear systems, vector equations, and augmented matrices" data-checkit-seed="4419"> <div class="exercise-statement"> <p>Consider the vector equation.</p> <p class="math math-display">\[x_{1} \left[\begin{array}{c}
1 \\
3 \\
0 \\
-3
\end{array}\right] + x_{2} \left[\begin{array}{c}
2 \\
4 \\
-1 \\
-4
\end{array}\right] + x_{3} \left[\begin{array}{c}
1 \\
0 \\
-2 \\
-1
\end{array}\right] = \left[\begin{array}{c}
2 \\
9 \\
3 \\
-6
\end{array}\right]\]</p> <ol type="a"><li> Write a system of scalar equations corresponding to this vector equation. </li><li> Write an augmented matrix corresponding to this vector equation. </li></ol> </div> <div class="exercise-answer"><p><b>Answer:</b></p> <ol type="a"><li><p class="math math-display">\[\begin{matrix}
x & + & 2 \, y & + & z & = & 2 \\
3 \, x & + & 4 \, y & & & = & 9 \\
& - & y & - & 2 \, z & = & 3 \\
-3 \, x & - & 4 \, y & - & z & = & -6 \\
\end{matrix}\]</p></li><li><p class="math math-display">\[\left[\begin{array}{ccc|c}
1 & 2 & 1 & 2 \\
3 & 4 & 0 & 9 \\
0 & -1 & -2 & 3 \\
-3 & -4 & -1 & -6
\end{array}\right]\]</p></li></ol> </div> </div>
I cannot replicate the bug you reported with things not numbering correctly in the PreTeXt build (the below is the code you pasted above in a book where "exercise" is renamed to "Checkpoint"):
Can you provide more context and a screenshot?
This is from the Sample Exercises in the appendix of the dev version of the LA book (in Cocalc, have not published)
Screenshot:
Relevant code:
<example>
<title>LE1</title>
<statement>
<p>
Consider the scalar system of equations
<md alignment="alignat" alignat-columns="5">
<mrow>
3x_1 &\,+\,& 2x_2 &\,\,& &\,+\,&x_4 &= 1 </mrow><mrow>
-x_1 &\,-\,& 4x_2 &\,+\,&x_3&\,-\,&7x_4 &= 0 </mrow><mrow>
&\,\,& x_2 &\,-\,&x_3 &\,\,& &= -2</mrow>
</md>
</p>
<ol>
<li>
Rewrite this system as a vector equation.
</li>
<li>
Write an augmented matrix corresponding to this system.
</li>
</ol>
</statement>
<solution>
<ol>
<li>
<me> x_1\left[\begin{array}{c} 3 \\ -1 \\ 0 \end{array}{}\right] +
x_2 \left[\begin{array}{c}2 \\ -4 \\ 1 \end{array}{}\right]+
x_3 \left[\begin{array}{c} 1 \\ 1 \\ -1 \end{array}{}\right]
+ x_4 \left[\begin{array}{c} 1 \\ -7 \\ 0 \end{array}{}\right]
= \left[\begin{array}{c} 1 \\ 0 \\ -2 \end{array}{}\right] </me>
</li>
<li>
<me>
\left[\begin{array}{cccc|c}
3 & 2 & 0 & 1 & 1 \\
-1 & -4 & 1 & -7 & 0 \\
0 & 1 & -1 & 0 & -2
\end{array}\right]
</me>
</li>
</ol>
</solution>
</example>
``
Oh boy this is a fun one. I just re-built to be sure, and I see the numbers.
What browser/OS/etc are you using?
Very odd. This is in Firefox 88.0 on Ubuntu .
Yep... this is Firefox 81.x on Windows:
Updating to 93.0 didn't help.
I'll report upstream to PreTeXt. For now, we'll need to start using the <li><p><me>x</me></p></li>
pattern (which will be required by CheckIt anyway soon enough).
Apparently if you give PreTeXt an
<ol>
but the contents of the<li>
are not enclosed in<p></p>
(e.g. if you just give it a<me>
), it will not display the numbering. The solution is to enclose the<me>
in<p>
, which seems to make PreTeXt happy.Currently, CheckIt appears to supply the needed
<p>
in the HTML output, but not the PreTeXt output. A workaround is for the user to ensure that a<p>
is there in the template (though note that a user using the HTML output to debug will not notice an error!).Example outcome that will show this bug: https://github.com/StevenClontz/checkit-tbil-la-2021-dev/blob/main/outcomes/LE1.xml