Skip to content

Commit c125c1f

Browse files
authored
Merge pull request #1161 from morozov-av/issue-1155
issue-1155 Update math delimiters in ClickableAreaEditor, Editor, MathJaxWrapper, and TipTapDocModal
2 parents aefa9f5 + 372901b commit c125c1f

4 files changed

Lines changed: 39 additions & 35 deletions

File tree

bases/rsptx/assignment_server_api/assignment_builder/src/components/routes/AssignmentBuilder/MathJaxWrapper.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export const mathJaxConfig = {
1313
},
1414
tex: {
1515
inlineMath: [
16-
["$", "$"],
17-
["\\(", "\\)"]
16+
["\\(", "\\)"],
17+
["$", "$"]
1818
],
1919
displayMath: [
20-
["$$", "$$"],
21-
["\\[", "\\]"]
20+
["\\[", "\\]"],
21+
["$$", "$$"]
2222
],
2323
processEscapes: true,
2424
packages: {
@@ -64,7 +64,7 @@ export const mathJaxConfig = {
6464
"code",
6565
"annotation",
6666
"annotation-xml"
67-
],
67+
]
6868
}
6969
};
7070

bases/rsptx/assignment_server_api/assignment_builder/src/components/routes/AssignmentBuilder/components/exercises/components/CreateExercise/components/ClickableAreaExercise/ClickableAreaEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export const ClickableAreaEditor: FC<ClickableAreaEditorProps> = ({
185185
}
186186
}),
187187
MathExtension.configure({
188-
delimiters: "dollar",
188+
delimiters: "bracket",
189189
katexOptions: {
190190
throwOnError: false,
191191
strict: false,

bases/rsptx/assignment_server_api/assignment_builder/src/components/routes/AssignmentBuilder/components/exercises/components/TipTap/Editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export const Editor = ({
198198
}
199199
}),
200200
MathExtension.configure({
201-
delimiters: "dollar",
201+
delimiters: "bracket",
202202
katexOptions: {
203203
throwOnError: false,
204204
strict: false,

bases/rsptx/assignment_server_api/assignment_builder/src/components/routes/AssignmentBuilder/components/exercises/components/TipTap/TipTapDocModal.tsx

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -100,60 +100,64 @@ export const TipTapDocModal: FC<TipTapDocModalProps> = ({ visible, onHide }) =>
100100
<section className={styles.section}>
101101
<h3>Math Expressions</h3>
102102
<p>
103-
<strong>All math must be wrapped in dollar signs!</strong> Use LaTeX syntax for
104-
mathematical expressions:
103+
<strong>
104+
All math must be wrapped in <code>\(</code> and <code>\)</code> delimiters!
105+
</strong>{" "}
106+
Use LaTeX syntax for mathematical expressions:
105107
</p>
106108
<ul>
107109
<li>
108-
<strong>Inline math:</strong> <code>$x^2 + y^2 = z^2$</code> (single dollar signs)
110+
<strong>Inline math:</strong> <code>\(x^2 + y^2 = z^2\)</code> (backslash-parentheses)
109111
</li>
110112
<li>
111-
<strong>Block math:</strong> <code>$$\int_0^1 x^2 dx$$</code> (double dollar signs for
113+
<strong>Block math:</strong> <code>\[\int_0^1 x^2 dx\]</code> (backslash-brackets for
112114
centered display)
113115
</li>
114116
</ul>
115117
<p>
116-
<strong>Quick tip:</strong> Type <code>$\alpha$</code> to get α, <code>$\beta$</code> to
117-
get β, etc.
118+
<strong>Quick tip:</strong> Type <code>\(\alpha\)</code> to get α,{" "}
119+
<code>\(\beta\)</code> to get β, etc.
118120
</p>
119121
<p>
120-
<strong>Important:</strong> All LaTeX symbols must be wrapped in dollar signs ($).
122+
<strong>Important:</strong> All LaTeX symbols must be wrapped in <code>\(</code> and{" "}
123+
<code>\)</code> delimiters.
121124
</p>
122125
<p>Common symbols and usage:</p>
123126
<ul>
124127
<li>
125128
<strong>Greek letters:</strong>{" "}
126129
<code>
127-
$\alpha$, $\beta$, $\gamma$, $\delta$, $\epsilon$, $\theta$, $\lambda$, $\mu$,
128-
$\pi$, $\sigma$, $\phi$, $\omega$
130+
\(\alpha\), \(\beta\), \(\gamma\), \(\delta\), \(\epsilon\), \(\theta\),
131+
\(\lambda\), \(\mu\), \(\pi\), \(\sigma\), \(\phi\), \(\omega\)
129132
</code>
130133
</li>
131134
<li>
132135
<strong>Fractions:</strong>{" "}
133136
<code>
134-
$\frac{"{numerator}"}
135-
{"{denominator}"}$
137+
\(\frac{"{numerator}"}
138+
{"{denominator}"}\)
136139
</code>
137140
</li>
138141
<li>
139-
<strong>Superscripts:</strong> <code>$x^{"{superscript}"}$</code> or{" "}
140-
<code>$x^2$</code>
142+
<strong>Superscripts:</strong> <code>\(x^{"{superscript}"}\)</code> or{" "}
143+
<code>\(x^2\)</code>
141144
</li>
142145
<li>
143-
<strong>Subscripts:</strong> <code>$x_{"{subscript}"}$</code> or <code>$x_1$</code>
146+
<strong>Subscripts:</strong> <code>\(x_{"{subscript}"}\)</code> or{" "}
147+
<code>\(x_1\)</code>
144148
</li>
145149
<li>
146-
<strong>Square root:</strong> <code>$\sqrt{"{x}"}$</code> or{" "}
147-
<code>$\sqrt[n]{"{x}"}$</code>
150+
<strong>Square root:</strong> <code>\(\sqrt{"{x}"}\)</code> or{" "}
151+
<code>\(\sqrt[n]{"{x}"}\)</code>
148152
</li>
149153
<li>
150-
<strong>Integrals:</strong> <code>$\int$, $\sum$, $\prod$</code>
154+
<strong>Integrals:</strong> <code>\(\int\), \(\sum\), \(\prod\)</code>
151155
</li>
152156
<li>
153157
<strong>Number sets (with shortcuts):</strong>{" "}
154158
<code>
155-
$\R$, $\N$, $\Z$, $\Q$, $\C$ (shortcuts for $\mathbb{"{R}"}$, $\mathbb{"{N}"}$,
156-
etc.)
159+
\(\R\), \(\N\), \(\Z\), \(\Q\), \(\C\) (shortcuts for \(\mathbb{"{R}"}\), \(\mathbb
160+
{"{N}"}\), etc.)
157161
</code>
158162
</li>
159163
</ul>
@@ -162,36 +166,36 @@ export const TipTapDocModal: FC<TipTapDocModalProps> = ({ visible, onHide }) =>
162166
</p>
163167
<ul>
164168
<li>
165-
<code>$\alpha + \beta = \gamma$</code> → α + β = γ
169+
<code>\(\alpha + \beta = \gamma\)</code> → α + β = γ
166170
</li>
167171
<li>
168172
<code>
169-
$\frac{"{1}"}
173+
\(\frac{"{1}"}
170174
{"{2}"} + \frac{"{1}"}
171175
{"{3}"} = \frac{"{5}"}
172-
{"{6}"}$
176+
{"{6}"}\)
173177
</code>{" "}
174178
→ ½ + ⅓ = ⅚
175179
</li>
176180
<li>
177181
<code>
178-
$\int_0^1 x^2 dx = \frac{"{1}"}
179-
{"{3}"}$
182+
\(\int_0^1 x^2 dx = \frac{"{1}"}
183+
{"{3}"}\)
180184
</code>{" "}
181185
→ ∫₀¹ x² dx = ⅓
182186
</li>
183187
<li>
184-
<code>$x^2 + y^2 = r^2$</code> → x² + y² = r²
188+
<code>\(x^2 + y^2 = r^2\)</code> → x² + y² = r²
185189
</li>
186190
<li>
187191
<code>
188-
$\sum_{"{i=1}"}^n i = \frac{"{n(n+1)}"}
189-
{"{2}"}$
192+
\(\sum_{"{i=1}"}^n i = \frac{"{n(n+1)}"}
193+
{"{2}"}\)
190194
</code>{" "}
191195
→ Σᵢ₌₁ⁿ i = n(n+1)/2
192196
</li>
193197
<li>
194-
<code>$\R \subseteq \C$ and $\alpha \in \R$</code> → ℝ ⊆ ℂ and α ∈ ℝ
198+
<code>\(\R \subseteq \C\) and \(\alpha \in \R\)</code> → ℝ ⊆ ℂ and α ∈ ℝ
195199
</li>
196200
</ul>
197201
</section>

0 commit comments

Comments
 (0)