Permalink
Browse files

Merge pull request #12 from rekka/master

Treat \ commands as tex tokens in arguments
  • Loading branch information...
2 parents 8145486 + 81a88a5 commit bd79b2645a3c73d4be6d1cdfc76fb207ca497413 @jgm committed May 19, 2012
Showing with 166 additions and 1 deletion.
  1. +1 −1 Text/TeXMath/Parser.hs
  2. +110 −0 tests/tokens.omml
  3. +17 −0 tests/tokens.tex
  4. +38 −0 tests/tokens.xhtml
View
@@ -97,7 +97,7 @@ inbraces :: TP Exp
inbraces = liftM EGrouped (braces $ many $ notFollowedBy (char '}') >> expr)
texToken :: TP Exp
-texToken = inbraces <|> inbrackets <|>
+texToken = texSymbol <|> inbraces <|> inbrackets <|>
do c <- anyChar
spaces
return $ if isDigit c
View
@@ -0,0 +1,110 @@
+<?xml version='1.0' ?>
+<m:oMathPara>
+ <m:oMathParaPr>
+ <m:jc m:val="center" />
+ </m:oMathParaPr>
+ <m:oMath>
+ <m:acc>
+ <m:accPr>
+ <m:chr m:val="~" />
+ </m:accPr>
+ <m:e>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ </m:e>
+ </m:acc>
+ <m:rad>
+ <m:radPr>
+ <m:degHide m:val="on" />
+ </m:radPr>
+ <m:deg />
+ <m:e>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ </m:e>
+ </m:rad>
+ <m:f>
+ <m:fPr>
+ <m:type m:val="bar" />
+ </m:fPr>
+ <m:num>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ </m:num>
+ <m:den>
+ <m:r>
+ <m:rPr />
+ <m:t>ξ</m:t>
+ </m:r>
+ </m:den>
+ </m:f>
+ <m:f>
+ <m:fPr>
+ <m:type m:val="bar" />
+ </m:fPr>
+ <m:num>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ </m:num>
+ <m:den>
+ <m:r>
+ <m:rPr />
+ <m:t>ξ</m:t>
+ </m:r>
+ </m:den>
+ </m:f>
+ <m:f>
+ <m:fPr>
+ <m:type m:val="bar" />
+ </m:fPr>
+ <m:num>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ </m:num>
+ <m:den>
+ <m:r>
+ <m:rPr />
+ <m:t>ξ</m:t>
+ </m:r>
+ </m:den>
+ </m:f>
+ <m:r>
+ <m:rPr />
+ <m:t>(</m:t>
+ </m:r>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ <m:r>
+ <m:rPr />
+ <m:t>)</m:t>
+ </m:r>
+ <m:r>
+ <m:rPr />
+ <m:t>(</m:t>
+ </m:r>
+ <m:r>
+ <m:rPr />
+ <m:t>ϕ</m:t>
+ </m:r>
+ <m:r>
+ <m:rPr />
+ <m:t>)</m:t>
+ </m:r>
+ <m:r>
+ <m:rPr />
+ <m:t>ξ</m:t>
+ </m:r>
+ </m:oMath>
+</m:oMathPara>
View
@@ -0,0 +1,17 @@
+\newcommand{\my}[1]{(#1)}
+
+
+% diacritics
+\tilde\phi
+
+% unary operators
+\sqrt\phi
+
+% binary operators
+\frac\phi\xi
+\frac \phi {\xi}
+\frac {\phi} \xi
+
+% custom
+\my\phi
+\my{\phi}\xi
View
@@ -0,0 +1,38 @@
+<?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>
+ <mover>
+ <mi>ϕ</mi>
+ <mo accent="true">~</mo>
+ </mover>
+ <msqrt>
+ <mi>ϕ</mi>
+ </msqrt>
+ <mfrac>
+ <mi>ϕ</mi>
+ <mi>ξ</mi>
+ </mfrac>
+ <mfrac>
+ <mi>ϕ</mi>
+ <mi>ξ</mi>
+ </mfrac>
+ <mfrac>
+ <mi>ϕ</mi>
+ <mi>ξ</mi>
+ </mfrac>
+ <mo stretchy="false">(</mo>
+ <mi>ϕ</mi>
+ <mo stretchy="false">)</mo>
+ <mo stretchy="false">(</mo>
+ <mi>ϕ</mi>
+ <mo stretchy="false">)</mo>
+ <mi>ξ</mi>
+ </mrow>
+ </math>
+ </body>
+</html>

0 comments on commit bd79b26

Please sign in to comment.