[Feature:Forum] Support display math in LaTeX#12161
[Feature:Forum] Support display math in LaTeX#12161bmcutler merged 6 commits intoSubmitty:mainfrom samarthnaikk:main
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12161 +/- ##
============================================
- Coverage 21.73% 21.71% -0.03%
- Complexity 9598 9612 +14
============================================
Files 268 268
Lines 36006 36073 +67
Branches 475 475
============================================
+ Hits 7827 7832 +5
- Misses 27708 27770 +62
Partials 471 471
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
I have made the required changes @skara9 . (The CI / JavaScript Lint errors are fixed) |
skara9
left a comment
There was a problem hiding this comment.
Looks good! Thanks for the contribution.
RyanStyron
left a comment
There was a problem hiding this comment.
After testing, can confirm that this PR resolves the attached issue. One note is that the markdown preview does differ from the published reply in that the published reply's render of text wrapped by $$ is not centered, whereas it is centered in the preview. This is not something that should necessarily hold the PR from being merged, but perhaps it should be considered.
Thoughts, @skara9? |
|
@RyanStyron It doesn't look like that's the case. |
There was a problem hiding this comment.
@samarthnaikk Take a look at the CSS and see if you can have the message fill the container width, so the display math is centered to the the box.


|
@skara9 I have updated the code with the required changes |
This reverts commit ad6d811.
Why is this Change Important & Necessary?
Currently, Submitty's LaTeX rendering only supports in-line math mode (e.g.,
$E=mc^2$). This makes it difficult to display complex or multi-line equations in a clear and readable format. This change introduces support for "display math mode," which renders equations on their own line and centered, a standard feature in mathematical typesetting. This enhancement significantly improves the readability of course materials and student submissions that contain mathematical formulas.Closes #11989
Related to #11931
What is the New Behavior?
Before:
Only in-line math using
$...$or\(...\)was rendered. Any expressions using$$...$$or\[...\]were displayed as plain text.After:
Users can now use
$$...$$and\[...\]to render mathematical expressions in display mode. The expressions will appear centered on a new line. Existing in-line math rendering is unaffected.Example:
Before:
$$a^2 + b^2 = c^2$$would just show as plain text.After:
$$a^2 + b^2 = c^2$$will render as:What steps should a reviewer take to reproduce or test the bug or new feature?
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!} (x-a)^n$$\[ \int_a^b f(x) \, dx = F(b) - F(a) \]This is an in-line equation: $E=mc^2$.$$and\[should be rendered on their own lines and centered. The equation wrapped in$should appear in-line with the text.Automated Testing & Documentation
$$...$$and\[...\]). A new GitHub issue should be created to track this documentation update.Other information