marhop/pandoc-unicode-math

Increase readability of existing markdown documents with latex maths

lamyergeier opened this issue · 4 comments

Thank you for the awesome idea.

  • Could you please support this feature:

Convert latex maths symbol (such as $\alpha$, $\times$) in existing markdown documents to unicode symbols α.

Interesting idea! I'll see what I can do.

Hi Anish,

Release 1.1.0 addresses this issue by adding a second filter called pandoc-unicode-math-from-latex. It is explained in the README file. Let me know if you experience any problems!

Best,
Martin

Hi! It works like a charm!

May be we could add a sample test file for future tests:

# [Navier–Stokes equations - Wikipedia](https://en.wikipedia.org/wiki/Navier%E2%80%93Stokes_equations)

- Stokes equations also factor in the [Froude limit][] (no external field) and are not [conservation equations][], but rather a [dissipative system][], in the sense that they cannot be put into the quasilinear [homogeneous][] form:

  $$
  {\displaystyle \mathbf {y} _{t}+\mathbf {A} (\mathbf {y} )\mathbf {y} _{x}=0.}
  $$

- Navier--Stokes equations are useful because they describe the physics of many phenomena of [scientific][] and [engineering][] interest.

- The Navier--Stokes momentum equation can be derived as a particular form of the [Cauchy momentum equation][], whose general convective form is

  $$
  {\frac  {D{\mathbf  {u}}}{Dt}}={\frac  1ρ }∇ ⋅ {\boldsymbol  {σ }}+{\mathbf  {g}}
  $$

- **Linear stress [constitutive equation][]** _(expression used for elastic solid)_ ${\boldsymbol {σ }}=λ (∇ ⋅ \mathbf {u} )\mathbf {I} +2μ {\boldsymbol {ε }}$

  $$
  {\displaystyle \mathbf {u} ⋅ ∇ \mathbf {u} =(∇ × \mathbf {u} )× \mathbf {u} +{\frac {1}{2}}∇ \mathbf {u} ^{2}}
  $$

  where the vector ${\displaystyle (∇ × \mathbf {u} )× \mathbf {u} }$ is known as the [Lamb vector][].

# [Singular value decomposition - Wikipedia][]

- One may then define an index of separability,

  $$
  α ={\frac {σ _{1}^{2}}{∑ _{i}σ _{i}^{2}}},
  $$

  which is the fraction of the power in the matrix M which is accounted for by the first separable matrix in the decomposition.

- A similar problem, with interesting applications in [shape analysis][], is the [orthogonal Procrustes problem][], which consists of finding an orthogonal matrix **O** which most closely maps **A** to **B**. Specifically,

  $$
  {\displaystyle \mathbf {O} ={\underset {Ω }{\operatorname {argmin} }}\|\mathbf {A} {\boldsymbol {Ω }}-\mathbf {B} \|_{F}\quad {\text{subject to}}\quad {\boldsymbol {Ω }}^{\textsf {T}}{\boldsymbol {Ω }}=\mathbf {I} }
  $$

  where $\|\|_{F}$ denotes the Frobenius norm.

# [Schrödinger equation - Wikipedia][]

- **Time-dependent Schrödinger equation** _(general)_ ${\displaystyle i\hbar {\frac {d}{dt}}\vert Ψ (t)\rangle ={\hat {H}}\vert Ψ (t)\rangle }$

- Similarly, the _[momentum-space wave function][]_ can be defined as ${\displaystyle {\tilde {Ψ }}(\mathbf {p} ,t)=\langle \mathbf {p} \vert Ψ \rangle }$ , where ${\displaystyle \vert \mathbf {p} \rangle }$ is the momentum eigenvector.

- Schrödinger used the relativistic energy momentum relation to find what is now known as the [Klein--Gordon equation][] in a [Coulomb potential][] (in [natural units][]):

  $$
  \left(E+{e^{2} \over r}\right)^{2}ψ (x)=-∇ ^{2}ψ (x)+m^{2}ψ (x).
  $$

- [Fourier transform][] of a momentum space wave function:

  $$
  Ψ (\mathbf {r} ,t)={\frac {1}{({\sqrt {2π }})^{3}}}\int Φ (\mathbf {k} )e^{i(\mathbf {k} ⋅ \mathbf {r} -ω t)}d^{3}\mathbf {k} \,\!
  $$

- Substituting the energy and momentum operators into the classical energy conservation equation obtains the operator:

  $$
  E={\dfrac {\mathbf {p} ⋅ \mathbf {p} }{2m}}+V\quad → \quad {\hat {E}}={\dfrac {{\hat {\mathbf {p} }}⋅ {\hat {\mathbf {p} }}}{2m}}+V
  $$

  so in terms of derivatives with respect to time and space, acting this operator on the wave function _Ψ_ immediately led Schrödinger to his equation:

  $$
  i\hbar {\dfrac {\partial Ψ }{\partial t}}=-{\dfrac {\hbar ^{2}}{2m}}∇ ^{2}Ψ +VΨ
  $$

- The solutions in position space are

  $$
  {\displaystyle ψ _{n}(x)={\sqrt {\frac {1}{2^{n}\,n!}}}⋅ \left({\frac {mω }{π \hbar }}\right)^{1/4}⋅ e^{-{\frac {mω x^{2}}{2\hbar }}}⋅ {\mathcal {H}}_{n}\left({\sqrt {\frac {mω }{\hbar }}}x\right),}
  $$

- The solution set may be generated by ${\displaystyle ψ _{n}(x)={\frac {1}{\sqrt {n!}}}\left({\sqrt {\frac {mω }{2\hbar }}}\right)^{n}\left(x-{\frac {\hbar }{mω }}{\frac {d}{dx}}\right)^{n}\left({\frac {mω }{π \hbar }}\right)^{\frac {1}{4}}e^{\frac {-mω x^{2}}{2\hbar }}}$

  [Froude limit]: https://en.wikipedia.org/wiki/Froude_number "Froude number"
  [conservation equations]: https://en.wikipedia.org/wiki/Conservation_law "Conservation law"
  [dissipative system]: https://en.wikipedia.org/wiki/Dissipative_system "Dissipative system"
  [homogeneous]: https://en.wikipedia.org/wiki/Homogeneous_polynomial "Homogeneous polynomial"
  [scientific]: https://en.wikipedia.org/wiki/Scientific "Scientific"
  [engineering]: https://en.wikipedia.org/wiki/Engineering "Engineering"
  [Cauchy momentum equation]: https://en.wikipedia.org/wiki/Cauchy_momentum_equation "Cauchy momentum equation"
  [constitutive equation]: https://en.wikipedia.org/wiki/Constitutive_equation "Constitutive equation"
  [Lamb vector]: https://en.wikipedia.org/wiki/Lamb_vector "Lamb vector"
  [Singular value decomposition - Wikipedia]: https://en.wikipedia.org/wiki/Singular_value_decomposition
  [shape analysis]: https://en.wikipedia.org/wiki/Shape_analysis_(digital_geometry) "Shape analysis (digital geometry)"
  [orthogonal Procrustes problem]: https://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem "Orthogonal Procrustes problem"
  [Schrödinger equation - Wikipedia]: https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation
  [momentum-space wave function]: https://en.wikipedia.org/wiki/Wave_function "Wave function"
  [Klein--Gordon equation]: https://en.wikipedia.org/wiki/Klein%E2%80%93Gordon_equation "Klein–Gordon equation"
  [Coulomb potential]: https://en.wikipedia.org/wiki/Coulomb_potential "Coulomb potential"
  [natural units]: https://en.wikipedia.org/wiki/Natural_units "Natural units"
  [Fourier transform]: https://en.wikipedia.org/wiki/Fourier_transform "Fourier transform"
# [Navier–Stokes equations - Wikipedia](https://en.wikipedia.org/wiki/Navier%E2%80%93Stokes_equations)

- Stokes equations also factor in the [Froude limit][] (no external field) and are not [conservation equations][], but rather a [dissipative system][], in the sense that they cannot be put into the quasilinear [homogeneous][] form:

  $$
  {\displaystyle \mathbf {y} _{t}+\mathbf {A} (\mathbf {y} )\mathbf {y} _{x}=0.}
  $$

- Navier--Stokes equations are useful because they describe the physics of many phenomena of [scientific][] and [engineering][] interest.

- The Navier--Stokes momentum equation can be derived as a particular form of the [Cauchy momentum equation][], whose general convective form is

  $$
  {\frac  {D{\mathbf  {u}}}{Dt}}={\frac  1ρ }∇ ⋅ {\boldsymbol  {σ }}+{\mathbf  {g}}
  $$

- **Linear stress [constitutive equation][]** *(expression used for elastic solid)* ${\boldsymbol {σ }}=λ (∇ ⋅ \mathbf {u} )\mathbf {I} +2μ {\boldsymbol {ε }}$

  $$
  {\displaystyle \mathbf {u} ⋅ ∇ \mathbf {u} =(∇ × \mathbf {u} )× \mathbf {u} +{\frac {1}{2}}∇ \mathbf {u} ^{2}}
  $$

  where the vector ${\displaystyle (∇ × \mathbf {u} )× \mathbf {u} }$ is known as the [Lamb vector][].

# [Singular value decomposition - Wikipedia][]

- One may then define an index of separability,

  $$ 
  \alpha ={\frac {\sigma _{1}^{2}}{\sum _{i}\sigma _{i}^{2}}},
  $$

  which is the fraction of the power in the matrix M which is accounted for by the first separable matrix in the decomposition.

- A similar problem, with interesting applications in [shape analysis][], is the [orthogonal Procrustes problem][], which consists of finding an orthogonal matrix **O** which most closely maps **A** to **B**. Specifically,

  $$ 
  {\displaystyle \mathbf {O} ={\underset {\Omega }{\operatorname {argmin} }}\|\mathbf {A} {\boldsymbol {\Omega }}-\mathbf {B} \|_{F}\quad {\text{subject to}}\quad {\boldsymbol {\Omega }}^{\textsf {T}}{\boldsymbol {\Omega }}=\mathbf {I} }
  $$

  where $\|\cdot \|_{F}$ denotes the Frobenius norm.

# [Schrödinger equation - Wikipedia][]

- **Time-dependent Schrödinger equation** *(general)* ${\displaystyle i\hbar {\frac {d}{dt}}\vert \Psi (t)\rangle ={\hat {H}}\vert \Psi (t)\rangle }$

- Similarly, the *[momentum-space wave function][]* can be defined as ${\displaystyle {\tilde {\Psi }}(\mathbf {p} ,t)=\langle \mathbf {p} \vert \Psi \rangle }$ , where ${\displaystyle \vert \mathbf {p} \rangle }$ is the momentum eigenvector.

- Schrödinger used the relativistic energy momentum relation to find what is now known as the [Klein--Gordon equation][] in a [Coulomb potential][] (in [natural units][]):

  $$ 
  \left(E+{e^{2} \over r}\right)^{2}\psi (x)=-\nabla ^{2}\psi (x)+m^{2}\psi (x).
  $$

- [Fourier transform][] of a momentum space wave function:

  $$ 
  \Psi (\mathbf {r} ,t)={\frac {1}{({\sqrt {2\pi }})^{3}}}\int \Phi (\mathbf {k} )e^{i(\mathbf {k} \cdot \mathbf {r} -\omega t)}d^{3}\mathbf {k} \,\!
  $$

- Substituting the energy and momentum operators into the classical energy conservation equation obtains the operator:

  $$ 
  E={\dfrac {\mathbf {p} \cdot \mathbf {p} }{2m}}+V\quad \rightarrow \quad {\hat {E}}={\dfrac {{\hat {\mathbf {p} }}\cdot {\hat {\mathbf {p} }}}{2m}}+V
  $$

  so in terms of derivatives with respect to time and space, acting this operator on the wave function *Ψ* immediately led Schrödinger to his equation:

  $$ 
  i\hbar {\dfrac {\partial \Psi }{\partial t}}=-{\dfrac {\hbar ^{2}}{2m}}\nabla ^{2}\Psi +V\Psi
  $$

- The solutions in position space are

  $$ 
  {\displaystyle \psi _{n}(x)={\sqrt {\frac {1}{2^{n}\,n!}}}\cdot \left({\frac {m\omega }{\pi \hbar }}\right)^{1/4}\cdot e^{-{\frac {m\omega x^{2}}{2\hbar }}}\cdot {\mathcal {H}}_{n}\left({\sqrt {\frac {m\omega }{\hbar }}}x\right),}
  $$

- The solution set may be generated by ${\displaystyle \psi _{n}(x)={\frac {1}{\sqrt {n!}}}\left({\sqrt {\frac {m\omega }{2\hbar }}}\right)^{n}\left(x-{\frac {\hbar }{m\omega }}{\frac {d}{dx}}\right)^{n}\left({\frac {m\omega }{\pi \hbar }}\right)^{\frac {1}{4}}e^{\frac {-m\omega x^{2}}{2\hbar }}}$
  [Froude limit]: https://en.wikipedia.org/wiki/Froude_number "Froude number"
  [conservation equations]: https://en.wikipedia.org/wiki/Conservation_law "Conservation law"
  [dissipative system]: https://en.wikipedia.org/wiki/Dissipative_system "Dissipative system"
  [homogeneous]: https://en.wikipedia.org/wiki/Homogeneous_polynomial "Homogeneous polynomial"
  [scientific]: https://en.wikipedia.org/wiki/Scientific "Scientific"
  [engineering]: https://en.wikipedia.org/wiki/Engineering "Engineering"
  [Cauchy momentum equation]: https://en.wikipedia.org/wiki/Cauchy_momentum_equation "Cauchy momentum equation"
  [constitutive equation]: https://en.wikipedia.org/wiki/Constitutive_equation "Constitutive equation"
  [Lamb vector]: https://en.wikipedia.org/wiki/Lamb_vector "Lamb vector"
  [Singular value decomposition - Wikipedia]: https://en.wikipedia.org/wiki/Singular_value_decomposition
  [shape analysis]: https://en.wikipedia.org/wiki/Shape_analysis_(digital_geometry) "Shape analysis (digital geometry)"
  [orthogonal Procrustes problem]: https://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem "Orthogonal Procrustes problem"
  [Schrödinger equation - Wikipedia]: https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation
  [momentum-space wave function]: https://en.wikipedia.org/wiki/Wave_function "Wave function"
  [Klein--Gordon equation]: https://en.wikipedia.org/wiki/Klein%E2%80%93Gordon_equation "Klein–Gordon equation"
  [Coulomb potential]: https://en.wikipedia.org/wiki/Coulomb_potential "Coulomb potential"
  [natural units]: https://en.wikipedia.org/wiki/Natural_units "Natural units"
  [Fourier transform]: https://en.wikipedia.org/wiki/Fourier_transform "Fourier transform"

We can add more equations to test more possibilities.

Thanks for the test file! I will add it to the next release.