LaTeX to XML Math Delimiters
Vim is amazing when used to edit MediaWiki text, but typing "<math> . . . </math>" can be tiresome and frustrating if formulas are used often. LaTeX delimiters are so concise and even come in two flavors: "\( . . . \)" for inline math and "\[ . . . \]" for centered formulas. The goal is to perform the following conversions: "\( . . . \)" becomes "<math>. . .</math>" "\[ . . . \]" becomes "<center><math>. . .</math></center>"
Start file
Given two vectors \(\vec{x}\) and \(\vec{y}\) in \( \mathbb{R}^n \), their '''dot product''' or '''inner product''' is defined as the following: \[ \sum_{i=0}^{n} x_i \, y_i \] ---- Integration by parts is another way of writing the product rule of differentiation. For two functions \(f(x)\) and \(g(x)\), the following are equivalent: \[ \begin{align} \frac{\mathrm{d}}{\mathrm{d}x} \left( f(x) \, g(x) \right) &= f'(x) \, g(x) + f(x) \, g'(x) \\ \int f(x) \, g'(x) \, \mathrm{d}x &= f(x) \, g(x) - \int f'(x) \, g(x) \, \mathrm{d}x \end{align} \] ---- Matrix multiplication is not commutative \( \begin{align} \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \, \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} &\ne \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} \, \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \\ \begin{bmatrix} a_{11} \, b_{11} + a_{12} \, b_{21} & a_{11} \, b_{12} + a_{12} \, b_{22} \\ a_{21} \, b_{11} + a_{22} \, b_{21} & a_{21} \, b_{12} + a_{22} \, b_{22} \end{bmatrix} &\ne \begin{bmatrix} a_{11} \, b_{11} + a_{21} \, b_{12} & a_{12} \, b_{11} + a_{22} \, b_{12} \\ a_{11} \, b_{21} + a_{21} \, b_{22} & a_{12} \, b_{21} + a_{22} \, b_{22} \end{bmatrix} \begin{align} \) ''Quod erat demonstrandum''.
End file
Given two vectors <math>\vec{x}</math> and <math>\vec{y}</math> in <math>\mathbb{R}^n</math>, their '''dot product''' or '''inner product''' is defined as the following: <center><math>\sum_{i=0}^{n} x_i \, y_i</math></center> ---- Integration by parts is another way of writing the product rule of differentiation. For two functions <math>f(x)</math> and <math>g(x)</math>, the following are equivalent: <center><math>\begin{align} \frac{\mathrm{d}}{\mathrm{d}x} \left( f(x) \, g(x) \right) &= f'(x) \, g(x) + f(x) \, g'(x) \\ \int f(x) \, g'(x) \, \mathrm{d}x &= f(x) \, g(x) - \int f'(x) \, g(x) \, \mathrm{d}x \end{align}</math></center> ---- Matrix multiplication is not commutative <math> \begin{align} \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \, \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} &\ne \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} \, \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \\ \begin{bmatrix} a_{11} \, b_{11} + a_{12} \, b_{21} & a_{11} \, b_{12} + a_{12} \, b_{22} \\ a_{21} \, b_{11} + a_{22} \, b_{21} & a_{21} \, b_{12} + a_{22} \, b_{22} \end{bmatrix} &\ne \begin{bmatrix} a_{11} \, b_{11} + a_{21} \, b_{12} & a_{12} \, b_{11} + a_{22} \, b_{12} \\ a_{11} \, b_{21} + a_{21} \, b_{22} & a_{12} \, b_{21} + a_{22} \, b_{22} \end{bmatrix} \begin{align} </math> ''Quod erat demonstrandum''.
View Diff
1c1 < Given two vectors \(\vec{x}\) and \(\vec{y}\) in \( \mathbb{R}^n \), --- > Given two vectors <math>\vec{x}</math> and <math>\vec{y}</math> in <math>\mathbb{R}^n</math>, 4c4 < \[ \sum_{i=0}^{n} x_i \, y_i \] --- > <center><math>\sum_{i=0}^{n} x_i \, y_i</math></center> 9c9 < For two functions \(f(x)\) and \(g(x)\), the following are equivalent: --- > For two functions <math>f(x)</math> and <math>g(x)</math>, the following are equivalent: 11c11 < \[ \begin{align} --- > <center><math>\begin{align} 14c14 < \end{align} \] --- > \end{align}</math></center> 20c20 < \( --- > <math> 48c48 < \) --- > </math>
Solutions by @vimgolfern00b:
Unlock 1 remaining solutions by signing in and submitting your own entry