ForNeVeR / xaml-math

A collection of .NET libraries for rendering mathematical formulae using the LaTeX typesetting style, for the WPF and Avalonia XAML-based frameworks
MIT License
641 stars 102 forks source link

Only a subset of LaTeX formulas supported? #190

Open MillerMark opened 5 years ago

MillerMark commented 5 years ago

In our testing, we found the engine unable to render a number of LaTeX formulas. Is only a subset of the LaTeX formula engine currently implemented? Or is it more likely we are using the engine incorrectly or perhaps making a mistake elsewhere?

For example, we were unable to render the following formulas/symbols:

\iff

\iint

\iiint

\dots

\notin

\vdots

\ddots

\nexists

\implies

\idotsint

\idotsint

\mapsto

\ulcorner

\urcorner

\sqsubset

\nsubseteq

\varnothing

\rightleftarrows

{ }

{^n}C_r

\dddot{a}

\ddddot{a}

\textup{A}A

\mathring{a}

1 \tfrac{1}{2}

\int\limits_a^b

\int_a^b \dotsi

A_1\dotso A_N

A_1,A_2,\dotsc,

_{10}^{5}C^{16}

A_1 \dotsm A_N

\left { A \right }

A_1+\dotsb+A_N

\overleftarrow{AB}

\boldsymbol{A}+B

\stackrel\frown{AAA}

1 \mathbf{\tfrac{1}{2}}

\overleftrightarrow{AB}

( \big( \Big( \bigg( \Bigg(

\textrm{z}\textsl{y}\texttt{t}

\frac{d}{dx}e^{ax}=a\,e^{ax}

\left{\frac{x^2}{y^3}\right}

\sqrt[n]{1+x+x^2+x^3+\dots+x^n}

2H_2 + O_2 \xrightarrow{n,m}2H_2O

P\left(A=2\middle|\frac{A^2}{B}>4\right)

\sum_{\substack{0<i<m \ 0<j<n }} P(i, j)

\vec{F}_g=-F\frac{m_1 m_2}{r^2} \vec{e}_r

\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x

A\underset{0}{\overset{a}{\rightleftarrows}}B

\begin{pmatrix} 1 & 0 \ 0 & 1 \end{pmatrix}

A\underset{b}{\overset{a}{\longleftrightarrow}}B

\begin{array}{c|c} 1 & 2 \ \hline 3 & 4 \end{array}

M = \bordermatrix{~ & x & y \cr A & 1 & 0 \cr B & 0 & 1 \cr}

\left(\begin{ array}{c} n \ r \end{array} \right) = \frac{n!}{r!(n-r)!}

A\underset{0^{\circ}C }{\overset{100^{\circ}C}{\rightleftarrows}}B

\begin{pmatrix} a{11} & \cdots & a{1n}\ \vdots & \ddots & \vdots\ a{m1} & \cdots & a{mn} \end{pmatrix}

\begin{pmatrix} a{11} & a{12} & a{13}\ a{21} & a{22} & a{23}\ a{31} & a{32} & a_{33} \end{pmatrix}

f(n) = \begin{cases} n/2 & \quad \text{if } n \text{ is even}\ -(n+1)/2 & \quad \text{if } n \text{ is odd} \end{cases}

\begin{pmatrix} a{11} & a{12} & a{13} & a{14}\ a{21} & \hdotsfor{2} & a{24}\ a{31} & a{32} & a{33} & a{34}\end{pmatrix}

ForNeVeR commented 5 years ago

Hello! Yes, only a subset of full LaTeX markup is supported currently. Right now, I'm working on matrix support (i.e. pmatrix will be supported sooner or later); other samples from your collection will require small pieces of additional work. I would be happy if someone could take the collection, convert it into a unit test set (should be very easy) and started implementing the necessary commands/features.

\begin{} / \end{} environments will require a lot more additional work and I'd suggest to create another issue for them; most of the other stuff is simple enough.

And thanks for your thorough testing, it will help us a lot with the development of the corresponding features!

MillerMark commented 5 years ago

I'm confused about the suggestion to create another issue for the \begin \end environments, as these seem to be integral to the work you are already doing to support pmatrix. I'm happy to create a separate issue but what differentiates these \begin \end environments in your mind from the matrix work you are doing?

ForNeVeR commented 5 years ago

Alright, I'll explain. In my view, \pmatrix is a proper command itself: it requires no additional stuff to work with; it's just a command (that parses its own arguments as it wants). It almost works already in #155.

On the other hand, \begin{matrix} is not just a command: it is a whole world consisting of named environments that behave like commands. There's no single command \begin; there're subcommands (if you wish) \begin{something} and \begin{marix}.

For now, our command/parser system has no place for these environments at all; that's why I think that it deserves its own ticket. It is a separate problem not from the rendering point of view, but a separate problem/world (we have no infrastructure for) from parsing point of view.

MillerMark commented 5 years ago

Understood. Creating a separate ticket now. Thanks for the explanation!