texmath 0.1.0.4 → 0.1.1
raw patch · 4 files changed
+241/−3 lines, 4 files
Files
- Text/TeXMath/Parser.hs +17/−1
- tests/19.tex +26/−0
- tests/19.xhtml +195/−0
- texmath.cabal +3/−2
Text/TeXMath/Parser.hs view
@@ -136,7 +136,23 @@ sepBy1 (many (notFollowedBy (try $ char '\\' >> char '\\') >> expr)) (symbol "&") array :: GenParser Char st Exp-array = stdarray <|> eqnarray <|> cases+array = stdarray <|> eqnarray <|> cases <|> matrix++matrix :: GenParser Char st Exp+matrix = matrixWith "pmatrix" "(" ")"+ <|> matrixWith "bmatrix" "[" "]"+ <|> matrixWith "Bmatrix" "{" "}"+ <|> matrixWith "vmatrix" "\x2223" "\x2223"+ <|> matrixWith "Vmatrix" "\x2225" "\x2225"++matrixWith :: String -> String -> String -> GenParser Char st Exp+matrixWith keywd opendelim closedelim =+ inEnvironment keywd $ do+ aligns <- option [] arrayAlignments+ lines' <- sepEndBy1 arrayLine (try $ symbol "\\\\")+ return $ EGrouped [ ESymbol Open opendelim+ , EArray aligns lines'+ , ESymbol Close closedelim] stdarray :: GenParser Char st Exp stdarray = inEnvironment "array" $ do
+ tests/19.tex view
@@ -0,0 +1,26 @@+\begin{bmatrix} + \dfrac{\partial x_1}{\partial y_1} & \dfrac{\partial x_2}{\partial y_1} +\\ ~+\\ \dfrac{\partial x_1}{\partial y_2} & \dfrac{\partial x_2}{\partial y_2} +\end{bmatrix}++\begin{pmatrix} + 1 & 2 \\+ 3 & 4+\end{pmatrix}++\begin{Bmatrix} + 1 & 2 \\+ 3 & 4+\end{Bmatrix}++\begin{vmatrix} + 1 & 2 \\+ 3 & 4+\end{vmatrix}++\begin{Vmatrix} + 1 & 2 \\+ 3 & 4+\end{Vmatrix}+
+ tests/19.xhtml view
@@ -0,0 +1,195 @@+<?xml version='1.0' ?>+<html xmlns="http://www.w3.org/1999/xhtml">+ <head>+ <meta content="application/xhtml+xml; charset=UTF-8" http-equiv="Content-Type" />+ </head>+ <body>+ <math display="block" xmlns="http://www.w3.org/1998/Math/MathML">+ <mrow>+ <mrow>+ <mo>[</mo>+ <mtable>+ <mtr>+ <mtd>+ <mstyle displaystyle="true">+ <mfrac>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>x</mi>+ <mn>1</mn>+ </msub>+ </mrow>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>y</mi>+ <mn>1</mn>+ </msub>+ </mrow>+ </mfrac>+ </mstyle>+ </mtd>+ <mtd>+ <mstyle displaystyle="true">+ <mfrac>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>x</mi>+ <mn>2</mn>+ </msub>+ </mrow>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>y</mi>+ <mn>1</mn>+ </msub>+ </mrow>+ </mfrac>+ </mstyle>+ </mtd>+ </mtr>+ <mtr>+ <mtd>+ <mspace width="0.333em" />+ </mtd>+ </mtr>+ <mtr>+ <mtd>+ <mstyle displaystyle="true">+ <mfrac>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>x</mi>+ <mn>1</mn>+ </msub>+ </mrow>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>y</mi>+ <mn>2</mn>+ </msub>+ </mrow>+ </mfrac>+ </mstyle>+ </mtd>+ <mtd>+ <mstyle displaystyle="true">+ <mfrac>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>x</mi>+ <mn>2</mn>+ </msub>+ </mrow>+ <mrow>+ <mo>∂</mo>+ <msub>+ <mi>y</mi>+ <mn>2</mn>+ </msub>+ </mrow>+ </mfrac>+ </mstyle>+ </mtd>+ </mtr>+ </mtable>+ <mo>]</mo>+ </mrow>+ <mrow>+ <mo>(</mo>+ <mtable>+ <mtr>+ <mtd>+ <mn>1</mn>+ </mtd>+ <mtd>+ <mn>2</mn>+ </mtd>+ </mtr>+ <mtr>+ <mtd>+ <mn>3</mn>+ </mtd>+ <mtd>+ <mn>4</mn>+ </mtd>+ </mtr>+ </mtable>+ <mo>)</mo>+ </mrow>+ <mrow>+ <mo>{</mo>+ <mtable>+ <mtr>+ <mtd>+ <mn>1</mn>+ </mtd>+ <mtd>+ <mn>2</mn>+ </mtd>+ </mtr>+ <mtr>+ <mtd>+ <mn>3</mn>+ </mtd>+ <mtd>+ <mn>4</mn>+ </mtd>+ </mtr>+ </mtable>+ <mo>}</mo>+ </mrow>+ <mrow>+ <mo>∣</mo>+ <mtable>+ <mtr>+ <mtd>+ <mn>1</mn>+ </mtd>+ <mtd>+ <mn>2</mn>+ </mtd>+ </mtr>+ <mtr>+ <mtd>+ <mn>3</mn>+ </mtd>+ <mtd>+ <mn>4</mn>+ </mtd>+ </mtr>+ </mtable>+ <mo>∣</mo>+ </mrow>+ <mrow>+ <mo>∥</mo>+ <mtable>+ <mtr>+ <mtd>+ <mn>1</mn>+ </mtd>+ <mtd>+ <mn>2</mn>+ </mtd>+ </mtr>+ <mtr>+ <mtd>+ <mn>3</mn>+ </mtd>+ <mtd>+ <mn>4</mn>+ </mtd>+ </mtr>+ </mtable>+ <mo>∥</mo>+ </mrow>+ </mrow>+ </math>+ </body>+</html>
texmath.cabal view
@@ -1,5 +1,5 @@ Name: texmath-Version: 0.1.0.4+Version: 0.1.1 Cabal-version: >= 1.2 Build-type: Simple Synopsis: Conversion of LaTeX math formulas to MathML.@@ -32,7 +32,8 @@ tests/15.tex, tests/15.xhtml, tests/16.tex, tests/16.xhtml, tests/17.tex, tests/17.xhtml,- tests/18.tex, tests/18.xhtml+ tests/18.tex, tests/18.xhtml,+ tests/19.tex, tests/19.xhtml Flag cgi description: Compile cgi executable.