Skip to content

Conversation

vmcj
Copy link
Member

@vmcj vmcj commented Sep 15, 2025

Purely a PoC, only tested/demonstrated at the jury clarification pages. I assume it works for the team pages but that's only because of the shared code.

I didn't test for MathML yet, and the other options for the MathJax object. We would need a couple of example clarifications to test with and do some visual inspection on the result.

I think the fonts can also be version controlled, but GitHub doesn't have a release in the MathJax organization which seems to ship those.

@meisterT
Copy link
Member

I assume it works for the team pages but that's only because of the shared code.

Weirdly enough not for the modal:

image

Also it takes a few seconds to render correctly.

I think the fonts can also be version controlled, but GitHub doesn't have a release in the MathJax organization which seems to ship those.

Yeah would be nice if would also come from packagist.

@meisterT
Copy link
Member

I tested a lot of things with the help of Gemini, the cross product is the only thing that didn't work:

    $$\vec{a} \times \vec{b} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_x & a_y & a_z \\ b_x & b_y & b_z \end{vmatrix}$$
image

Should look like this:
image

I also tested in a mathjax playground that this works in general. Not sure why it doesn't work here and whether it is important to fix.

@meisterT
Copy link
Member

Or rather like this:

image

@vmcj
Copy link
Member Author

vmcj commented Sep 15, 2025

I assume it works for the team pages but that's only because of the shared code.

Weirdly enough not for the modal:
image

I think I need to apply the MathJax code to the new element from the modal, I assume those elements don't exist in the DOM when MathJax is loaded. Similar to what we need for clarifications previews.

Also it takes a few seconds to render correctly.

I think that's because of the rendering being done on clientside. It might be possible to do this serverside if we use nodejs but I don't think MathJax has a PHP equivalent.

Yeah would be nice if would also come from packagist.

I'll keep on looking, but might be for a future PR if this works before the weekend.

@vmcj
Copy link
Member Author

vmcj commented Sep 26, 2025

I tested a lot of things with the help of Gemini, the cross product is the only thing that didn't work:

    $$\vec{a} \times \vec{b} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_x & a_y & a_z \\ b_x & b_y & b_z \end{vmatrix}$$

So when you add that part to the menu it does work so it's special to the clarifications. I would almost say we make a separate issue for it if the other issues are fixed.

@vmcj
Copy link
Member Author

vmcj commented Sep 27, 2025

I tested a lot of things with the help of Gemini, the cross product is the only thing that didn't work:

    $$\vec{a} \times \vec{b} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_x & a_y & a_z \\ b_x & b_y & b_z \end{vmatrix}$$

So when you add that part to the menu it does work so it's special to the clarifications. I would almost say we make a separate issue for it if the other issues are fixed.

I tested a lot of things with the help of Gemini, the cross product is the only thing that didn't work:

    $$\vec{a} \times \vec{b} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_x & a_y & a_z \\ b_x & b_y & b_z \end{vmatrix}$$

So when you add that part to the menu it does work so it's special to the clarifications. I would almost say we make a separate issue for it if the other issues are fixed.

I found the problem, the \\ gets replaced by \ by the default markdown_to_html filter.

Which stashes LaTeX during conversion and pops it afterwards.
This reverts commit 9a2e9f041f173e9623d77de5705946af6227d159.
This is to render Math statements like LaTeX in clarifications
This reverts commit f3541a4dad21fbbbc9c19637581779ed45c2ab62.
The fonts are missing from the release so we need to manually keep those in sync, we can't use the normal asset function as we get the version string added which is interpret as an option by MathJax and gives unharmful console log entries.
@vmcj vmcj marked this pull request as ready for review September 27, 2025 12:17
@vmcj
Copy link
Member Author

vmcj commented Sep 27, 2025

The packages on packagist doesn't have the fonts so we need to store those locally. I now installed the 2 packages with npm. So we have 2 possible solutions:

  • Use npm in the development scripts next to composer, the advantage is that we can version control those
  • Check the needed files in and not burden ourselves with another package manager.

If it was only for those 2 npm packages I would vote for option 2, but we have some other JS libraries which we might want to also manage with npm.

@vmcj vmcj marked this pull request as draft September 28, 2025 11:11
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

Successfully merging this pull request may close these issues.

2 participants