texmath 0.8.6.7 → 0.9
raw patch · 23 files changed
+636/−191 lines, 23 files
Files
- changelog +22/−0
- src/Text/TeXMath/Readers/MathML.hs +4/−2
- src/Text/TeXMath/Readers/OMML.hs +17/−1
- src/Text/TeXMath/Readers/TeX.hs +27/−9
- src/Text/TeXMath/Unicode/Fonts.hs +243/−0
- src/Text/TeXMath/Writers/OMML.hs +33/−1
- tests/readers/mml/badTag1.error +0/−0
- tests/readers/mml/badTag1.native +0/−1
- tests/readers/mml/badTagPhantom2.error +0/−0
- tests/readers/mml/badTagPhantom2.native +0/−1
- tests/readers/mml/complex4.error +0/−0
- tests/readers/mml/complex4.native +0/−1
- tests/readers/mml/nestedMath3.error +0/−0
- tests/readers/mml/nestedMath3.native +0/−1
- tests/readers/tex/math-in-text.native +1/−0
- tests/src/math-in-text.tex +1/−0
- tests/test-texmath.hs +27/−12
- tests/writers/complex1.omml +85/−88
- tests/writers/complex3.omml +64/−72
- tests/writers/math-in-text.mml +39/−0
- tests/writers/math-in-text.omml +68/−0
- tests/writers/math-in-text.tex +1/−0
- texmath.cabal +4/−2
changelog view
@@ -1,3 +1,25 @@+texmath (0.9)++ * OMML writer: Properly handle nary inside delimiters (#92).+ Previously under-overs inside delimiters didn't get+ converted to nary the way they did outside of delimiters.+ * TeX reader: Support bm, mathbold, pmd.+ * OMML reader: Handle w:sym (#65).+ * New module, Text.TeXMath.Unicode.Fonts, for MS font code point+ lookup. Copied from pandoc Text.Pandoc.Readers.Docx.Fonts,+ which will be changed to import this. [API change]+ * Fixed typo in test program for round-trip tests.+ * Parse math inside text constructions (#62). E.g.+ `\text{if $y$ is greater than $0$}` Text and math can nest indefinitely.+ * Modify test suite so tests can be marked as "ought to raise error."+ So far this is only used in mml. If the test is called foo+ and `readers/mml/foo.error` exists, then the test is expected+ to raise a parse error.+ * MathML reader err: Don't print colon after line number.+ * Restore proper error handling to MathML reader. Note that the tests+ need to be redone, since they assumed the old behavior of just+ returning empty elements on parse errors.+ texmath (0.8.6.7) * TeX reader: treat backslash + newline as like backslash + space.
src/Text/TeXMath/Readers/MathML.hs view
@@ -120,7 +120,9 @@ "mtable" -> mkE <$> table e "maction" -> mkE <$> action e "semantics" -> mkE <$> semantics e- _ -> return $ mkE empty+ "maligngroup" -> return $ mkE empty+ "malignmark" -> return $ mkE empty+ _ -> throwError $ "Unexpected element " ++ err e where mkE :: Exp -> [IR Exp] mkE = (:[]) . E@@ -560,7 +562,7 @@ nargs n xs = length xs == n err :: Element -> String-err e = name e ++ " line: " ++ (show $ elLine e) ++ (show e)+err e = name e ++ maybe "" (\x -> " line " ++ show x) (elLine e) findAttrQ :: String -> Element -> MML (Maybe String) findAttrQ s e = do
src/Text/TeXMath/Readers/OMML.hs view
@@ -35,11 +35,12 @@ import Text.XML.Light import Data.Maybe (isJust, mapMaybe, fromMaybe) import Data.List (intercalate)-import Data.Char (isDigit)+import Data.Char (isDigit, readLitChar) import Text.TeXMath.Types import Text.TeXMath.Shared (fixTree, getSpaceWidth, getOperator) import Text.TeXMath.Unicode.ToTeX (getSymbolType) import Control.Applicative ((<$>))+import Text.TeXMath.Unicode.Fonts (getUnicode, stringToFont) readOMML :: String -> Either String [Exp] readOMML s | Just e <- parseXMLDoc s =@@ -163,6 +164,7 @@ || isElem "w" "delText" element = Just $ TextRun $ strContent element | isElem "w" "br" element = Just LnBrk | isElem "w" "tab" element = Just Tab+ | isElem "w" "sym" element = Just $ TextRun $ getSymChar element | otherwise = Nothing elemToOMathRunElems :: Element -> Maybe [OMathRunElem]@@ -467,3 +469,17 @@ expToString (EGrouped exps) = concatMap expToString exps expToString (EStyled _ exps) = concatMap expToString exps expToString _ = ""++-- The char attribute is a hex string+getSymChar :: Element -> String+getSymChar element+ | Just s <- lowerFromPrivate <$> getCodepoint+ , Just font <- getFont =+ let [(char, _)] = readLitChar ("\\x" ++ s) in+ maybe "" (:[]) $ getUnicode font char+ where+ getCodepoint = findAttrBy (hasElemName "w" "char") element+ getFont = stringToFont =<< findAttrBy (hasElemName "w" "font") element+ lowerFromPrivate ('F':xs) = '0':xs+ lowerFromPrivate xs = xs+getSymChar _ = ""
src/Text/TeXMath/Readers/TeX.hs view
@@ -504,6 +504,9 @@ , ("\\mathup", EStyled TextNormal) , ("\\mathbf", EStyled TextBold) , ("\\boldsymbol", EStyled TextBold)+ , ("\\bm", EStyled TextBold)+ , ("\\mathbold", EStyled TextBold)+ , ("\\pmb", EStyled TextBold) , ("\\mathbfup", EStyled TextBold) , ("\\mathit", EStyled TextItalic) , ("\\mathtt", EStyled TextMonospace)@@ -540,8 +543,29 @@ text :: TP Exp text = do c <- oneOfCommands (M.keys textOps)- maybe mzero (<$> (bracedText <* spaces)) $ M.lookup c textOps+ op <- maybe mzero return $ M.lookup c textOps+ char '{'+ let chunk = ((op . concat) <$> many1 textual)+ <|> (char '{' *> (asGroup <$> manyTill chunk (char '}')))+ <|> innermath+ contents <- manyTill chunk (char '}')+ spaces+ case contents of+ [] -> return (op "")+ [x] -> return x+ xs -> return (EGrouped xs) +innermath :: TP Exp+innermath = choice $ map innerMathWith+ [("$","$"),("$$","$$"),("\\(","\\)"),("\\[","\\]")]++innerMathWith :: (String, String) -> TP Exp+innerMathWith (opener, closer) = do+ try (string opener)+ e <- manyExp expr+ string closer+ return e+ textOps :: M.Map String (String -> Exp) textOps = M.fromList [ ("\\textrm", (EText TextNormal))@@ -3682,7 +3706,7 @@ -- text mode parsing textual :: TP String-textual = regular <|> sps <|> ligature <|> textCommand <|> bracedText+textual = regular <|> sps <|> ligature <|> textCommand <?> "text" sps :: TP String@@ -3704,16 +3728,10 @@ textCommand :: TP String textCommand = do cmd <- oneOfCommands (M.keys textCommands)+ optional $ try (char '{' >> spaces >> char '}') case M.lookup cmd textCommands of Nothing -> fail ("Unknown control sequence " ++ cmd) Just c -> c--bracedText :: TP String-bracedText = do- char '{'- inner <- concat <$> many textual- char '}'- return inner tok :: TP Char tok = (try $ char '{' *> spaces *> anyChar <* spaces <* char '}')
+ src/Text/TeXMath/Unicode/Fonts.hs view
@@ -0,0 +1,243 @@+{-+Copyright (C) 2014 Matthew Pickering <matthewtpickering@gmail.com>++This program is free software; you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation; either version 2 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+-}++{- |+ Module : Text.TeXMath.Unicode.Fonts+ Copyright : Copyright (C) 2014 Matthew Pickering+ License : GNU GPL, version 2 or above++ Maintainer : Matthew Pickering <matthewtpickering@gmail.com>+ Stability : alpha+ Portability : portable++Utilities to convert between MS font codepoints and unicode characters.+-}+module Text.TeXMath.Unicode.Fonts (getUnicode, Font(..), stringToFont) where+++-- | Enumeration of recognised fonts+data Font = Symbol -- ^ <http://en.wikipedia.org/wiki/Symbol_(typeface) Adobe Symbol>+ deriving (Show, Eq)++-- | Parse font name into Font if possible.+stringToFont :: String -> Maybe Font+stringToFont "Symbol" = Just Symbol+stringToFont _ = Nothing++-- | Given a font and codepoint, returns the corresponding unicode+-- character+getUnicode :: Font -> Char -> Maybe Char+getUnicode Symbol c = lookup c symbol++-- Generated from lib/fonts/symbol.txt+symbol :: [(Char, Char)]+symbol =+ [ (' ',' ')+ , (' ','\160')+ , ('!','!')+ , ('"','\8704')+ , ('#','#')+ , ('$','\8707')+ , ('%','%')+ , ('&','&')+ , ('\'','\8715')+ , ('(','(')+ , (')',')')+ , ('*','\8727')+ , ('+','+')+ , (',',',')+ , ('-','\8722')+ , ('.','.')+ , ('/','/')+ , ('0','0')+ , ('1','1')+ , ('2','2')+ , ('3','3')+ , ('4','4')+ , ('5','5')+ , ('6','6')+ , ('7','7')+ , ('8','8')+ , ('9','9')+ , (':',':')+ , (';',';')+ , ('<','<')+ , ('=','=')+ , ('>','>')+ , ('?','?')+ , ('@','\8773')+ , ('A','\913')+ , ('B','\914')+ , ('C','\935')+ , ('D','\916')+ , ('D','\8710')+ , ('E','\917')+ , ('F','\934')+ , ('G','\915')+ , ('H','\919')+ , ('I','\921')+ , ('J','\977')+ , ('K','\922')+ , ('L','\923')+ , ('M','\924')+ , ('N','\925')+ , ('O','\927')+ , ('P','\928')+ , ('Q','\920')+ , ('R','\929')+ , ('S','\931')+ , ('T','\932')+ , ('U','\933')+ , ('V','\962')+ , ('W','\937')+ , ('W','\8486')+ , ('X','\926')+ , ('Y','\936')+ , ('Z','\918')+ , ('[','[')+ , ('\\','\8756')+ , (']',']')+ , ('^','\8869')+ , ('_','_')+ , ('`','\63717')+ , ('a','\945')+ , ('b','\946')+ , ('c','\967')+ , ('d','\948')+ , ('e','\949')+ , ('f','\966')+ , ('g','\947')+ , ('h','\951')+ , ('i','\953')+ , ('j','\981')+ , ('k','\954')+ , ('l','\955')+ , ('m','\181')+ , ('m','\956')+ , ('n','\957')+ , ('o','\959')+ , ('p','\960')+ , ('q','\952')+ , ('r','\961')+ , ('s','\963')+ , ('t','\964')+ , ('u','\965')+ , ('v','\982')+ , ('w','\969')+ , ('x','\958')+ , ('y','\968')+ , ('z','\950')+ , ('{','{')+ , ('|','|')+ , ('}','}')+ , ('~','\8764')+ , ('\160','\8364')+ , ('\161','\978')+ , ('\162','\8242')+ , ('\163','\8804')+ , ('\164','\8260')+ , ('\164','\8725')+ , ('\165','\8734')+ , ('\166','\402')+ , ('\167','\9827')+ , ('\168','\9830')+ , ('\169','\9829')+ , ('\170','\9824')+ , ('\171','\8596')+ , ('\172','\8592')+ , ('\173','\8593')+ , ('\174','\8594')+ , ('\175','\8595')+ , ('\176','\176')+ , ('\177','\177')+ , ('\178','\8243')+ , ('\179','\8805')+ , ('\180','\215')+ , ('\181','\8733')+ , ('\182','\8706')+ , ('\183','\8226')+ , ('\184','\247')+ , ('\185','\8800')+ , ('\186','\8801')+ , ('\187','\8776')+ , ('\188','\8230')+ , ('\189','\63718')+ , ('\190','\63719')+ , ('\191','\8629')+ , ('\192','\8501')+ , ('\193','\8465')+ , ('\194','\8476')+ , ('\195','\8472')+ , ('\196','\8855')+ , ('\197','\8853')+ , ('\198','\8709')+ , ('\199','\8745')+ , ('\200','\8746')+ , ('\201','\8835')+ , ('\202','\8839')+ , ('\203','\8836')+ , ('\204','\8834')+ , ('\205','\8838')+ , ('\206','\8712')+ , ('\207','\8713')+ , ('\208','\8736')+ , ('\209','\8711')+ , ('\210','\63194')+ , ('\211','\63193')+ , ('\212','\63195')+ , ('\213','\8719')+ , ('\214','\8730')+ , ('\215','\8901')+ , ('\216','\172')+ , ('\217','\8743')+ , ('\218','\8744')+ , ('\219','\8660')+ , ('\220','\8656')+ , ('\221','\8657')+ , ('\222','\8658')+ , ('\223','\8659')+ , ('\224','\9674')+ , ('\225','\9001')+ , ('\226','\63720')+ , ('\227','\63721')+ , ('\228','\63722')+ , ('\229','\8721')+ , ('\230','\63723')+ , ('\231','\63724')+ , ('\232','\63725')+ , ('\233','\63726')+ , ('\234','\63727')+ , ('\235','\63728')+ , ('\236','\63729')+ , ('\237','\63730')+ , ('\238','\63731')+ , ('\239','\63732')+ , ('\241','\9002')+ , ('\242','\8747')+ , ('\243','\8992')+ , ('\244','\63733')+ , ('\245','\8993')+ , ('\246','\63734')+ , ('\247','\63735')+ , ('\248','\63736')+ , ('\249','\63737')+ , ('\250','\63738')+ , ('\251','\63739')+ , ('\252','\63740')+ , ('\253','\63741')+ , ('\254','\63742')]
src/Text/TeXMath/Writers/OMML.hs view
@@ -30,6 +30,7 @@ writeOMML :: DisplayType -> [Exp] -> Element writeOMML dt = container . concatMap (showExp []) . everywhere (mkT $ handleDownup dt)+ . everywhere (mkT $ handleDownup' dt) where container = case dt of DisplayBlock -> \x -> mnode "oMathPara" [ mnode "oMathParaPr"@@ -133,12 +134,43 @@ | isNary x -> EGrouped [ESubsup x emptyGroup y, next] : rest ESubsup x y z | isNary x -> EGrouped [ESubsup x y z, next] : rest- _ -> exp' : next : rest+ _ -> exp' : xs where (next, rest) = case xs of (t:ts) -> (t,ts) [] -> (emptyGroup, []) emptyGroup = EGrouped [] handleDownup _ [] = []++-- TODO This duplication is ugly and inefficient. See #92.+handleDownup' :: DisplayType -> [InEDelimited] -> [InEDelimited]+handleDownup' dt ((Right exp') : xs) =+ case exp' of+ EOver convertible x y+ | isNary x ->+ Right (EGrouped [EUnderover convertible x emptyGroup y, next]) :+ rest+ | convertible && dt == DisplayInline -> Right (ESuper x y) : xs+ EUnder convertible x y+ | isNary x ->+ Right (EGrouped [EUnderover convertible x y emptyGroup, next]) :+ rest+ | convertible && dt == DisplayInline -> Right (ESub x y) : xs+ EUnderover convertible x y z+ | isNary x ->+ Right (EGrouped [EUnderover convertible x y z, next]) : rest+ | convertible && dt == DisplayInline -> Right (ESubsup x y z) : xs+ ESub x y+ | isNary x -> Right (EGrouped [ESubsup x y emptyGroup, next]) : rest+ ESuper x y+ | isNary x -> Right (EGrouped [ESubsup x emptyGroup y, next]) : rest+ ESubsup x y z+ | isNary x -> Right (EGrouped [ESubsup x y z, next]) : rest+ _ -> Right exp' : xs+ where (next, rest) = case xs of+ (Right t:ts) -> (t,ts)+ _ -> (emptyGroup, xs)+ emptyGroup = EGrouped []+handleDownup' _ xs = xs showExp :: [Element] -> Exp -> [Element] showExp props e =
+ tests/readers/mml/badTag1.error view
− tests/readers/mml/badTag1.native
@@ -1,1 +0,0 @@-[ESuper (ENumber "5") (EGrouped []),ESymbol Bin "+",ESuper (EGrouped []) (ENumber "5"),ESymbol Bin "+",EGrouped [ENumber "5",ENumber "5"],ESymbol Bin "+",EGrouped []]
+ tests/readers/mml/badTagPhantom2.error view
− tests/readers/mml/badTagPhantom2.native
@@ -1,1 +0,0 @@-[ENumber "2",ESymbol Bin "+",EPhantom (EGrouped [])]
+ tests/readers/mml/complex4.error view
− tests/readers/mml/complex4.native
@@ -1,1 +0,0 @@-[]
+ tests/readers/mml/nestedMath3.error view
− tests/readers/mml/nestedMath3.native
@@ -1,1 +0,0 @@-[]
+ tests/readers/tex/math-in-text.native view
@@ -0,0 +1,1 @@+[ESuper (EIdentifier "X") (ENumber "2"),ESymbol Rel "=",EIdentifier "y",EGrouped [EText TextNormal " under ",ESub (EIdentifier "H") (ENumber "0"),EText TextNormal " except when ",EGrouped [EIdentifier "x",EGrouped [EText TextBold " is less than ",EIdentifier "z",EText TextBold "."]]]]
+ tests/src/math-in-text.tex view
@@ -0,0 +1,1 @@+X^2 = y \text{ under $H_0$ except when $x \textbf{ is less than \(z\).}$}
tests/test-texmath.hs view
@@ -52,7 +52,7 @@ texs <- runRoundTrip "tex" writeTeX readTeX ommls <- runRoundTrip "omml" (ppTopElement . writeOMML DisplayBlock) readOMML- mathmls <- runRoundTrip "mmml"+ mathmls <- runRoundTrip "mml" (ppTopElement . writeMathML DisplayBlock) readMathML return $ texs ++ ommls ++ mathmls@@ -150,17 +150,32 @@ runReaderTest regen fn input output = do inp_t <- readFile' input let result = ensureFinalNewline <$> fn inp_t- when regen $- writeFile output (either (const "") id result)- out_t <- ensureFinalNewline <$> readFile' output- case result of- Left msg -> printError input output msg >>- return (Error input output)- Right r- | r == out_t -> printPass input output >>- return (Pass input output)- | otherwise -> printFail input (Right output) r >>- return (Fail input output)+ let errfile = dropExtension output ++ ".error"+ errorExpected <- doesFileExist errfile+ if errorExpected+ then+ case result of+ Left _ -> do+ printPass input errfile+ return (Pass input errfile)+ Right _ -> do+ printError input errfile "error expected but not raised"+ return (Error input errfile)+ else do+ when regen $+ writeFile output (either (const "") id result)+ out_t <- ensureFinalNewline <$> readFile' output+ case result of+ Left msg -> do+ printError input output msg+ return (Error input output)+ Right r+ | r == out_t -> do+ printPass input output+ return (Pass input output)+ | otherwise -> do+ printFail input (Right output) r+ return (Fail input output) runRoundTripTest :: String -> ([Exp] -> String)
tests/writers/complex1.omml view
@@ -137,22 +137,14 @@ <m:grow /> </m:dPr> <m:e>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>n</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>k</m:t> </m:r>@@ -162,21 +154,28 @@ <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>- <m:sSubSup>- <m:e>+ </m:sub>+ <m:sup> <m:r>- <m:t>a</m:t>+ <m:t>n</m:t> </m:r>+ </m:sup>+ <m:e>+ <m:sSubSup>+ <m:e>+ <m:r>+ <m:t>a</m:t>+ </m:r>+ </m:e>+ <m:sub>+ <m:r>+ <m:t>k</m:t>+ </m:r>+ </m:sub>+ <m:sup />+ </m:sSubSup> </m:e>- <m:sub>- <m:r>- <m:t>k</m:t>- </m:r>- </m:sub>- <m:sup />- </m:sSubSup>+ </m:nary> <m:sSubSup> <m:e> <m:r>@@ -210,22 +209,14 @@ <m:grow /> </m:dPr> <m:e>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>n</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>k</m:t> </m:r>@@ -235,25 +226,32 @@ <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>- <m:sSubSup>- <m:e>- <m:r>- <m:t>a</m:t>- </m:r>- </m:e>- <m:sub>- <m:r>- <m:t>k</m:t>- </m:r> </m:sub> <m:sup> <m:r>- <m:t>2</m:t>+ <m:t>n</m:t> </m:r> </m:sup>- </m:sSubSup>+ <m:e>+ <m:sSubSup>+ <m:e>+ <m:r>+ <m:t>a</m:t>+ </m:r>+ </m:e>+ <m:sub>+ <m:r>+ <m:t>k</m:t>+ </m:r>+ </m:sub>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ </m:sSubSup>+ </m:e>+ </m:nary> </m:e> </m:d> <m:d>@@ -263,22 +261,14 @@ <m:grow /> </m:dPr> <m:e>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>n</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>k</m:t> </m:r>@@ -288,25 +278,32 @@ <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>- <m:sSubSup>- <m:e>- <m:r>- <m:t>b</m:t>- </m:r>- </m:e>- <m:sub>- <m:r>- <m:t>k</m:t>- </m:r> </m:sub> <m:sup> <m:r>- <m:t>2</m:t>+ <m:t>n</m:t> </m:r> </m:sup>- </m:sSubSup>+ <m:e>+ <m:sSubSup>+ <m:e>+ <m:r>+ <m:t>b</m:t>+ </m:r>+ </m:e>+ <m:sub>+ <m:r>+ <m:t>k</m:t>+ </m:r>+ </m:sub>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ </m:sSubSup>+ </m:e>+ </m:nary> </m:e> </m:d> </m:e>
tests/writers/complex3.omml view
@@ -22747,27 +22747,25 @@ <m:r> <m:t>↑</m:t> </m:r>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>2</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>+ </m:sub>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ <m:e />+ </m:nary> </m:e> </m:d> </m:e>@@ -22824,27 +22822,25 @@ <m:r> <m:t>|</m:t> </m:r>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>2</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>+ </m:sub>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ <m:e />+ </m:nary> </m:e> </m:d> </m:e>@@ -22901,27 +22897,25 @@ <m:r> <m:t>|</m:t> </m:r>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>2</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>+ </m:sub>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ <m:e />+ </m:nary> </m:e> </m:d> </m:e>@@ -22988,27 +22982,25 @@ <m:r> <m:t>↕</m:t> </m:r>- <m:limLow>- <m:e>- <m:limUpp>- <m:e>- <m:r>- <m:t>∑</m:t>- </m:r>- </m:e>- <m:lim>- <m:r>- <m:t>2</m:t>- </m:r>- </m:lim>- </m:limUpp>- </m:e>- <m:lim>+ <m:nary>+ <m:naryPr>+ <m:chr m:val="∑" />+ <m:limLoc m:val="undOvr" />+ <m:subHide m:val="0" />+ <m:supHide m:val="0" />+ </m:naryPr>+ <m:sub> <m:r> <m:t>1</m:t> </m:r>- </m:lim>- </m:limLow>+ </m:sub>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ <m:e />+ </m:nary> </m:e> </m:d> <m:r>
+ tests/writers/math-in-text.mml view
@@ -0,0 +1,39 @@+<?xml version='1.0' ?>+<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">+ <mrow>+ <msup>+ <mi>X</mi>+ <mn>2</mn>+ </msup>+ <mo>=</mo>+ <mi>y</mi>+ <mrow>+ <mrow>+ <mspace width="0.333em" />+ <mtext mathvariant="normal"> under </mtext>+ <mspace width="0.333em" />+ </mrow>+ <msub>+ <mi>H</mi>+ <mn>0</mn>+ </msub>+ <mrow>+ <mspace width="0.333em" />+ <mtext mathvariant="normal"> except when </mtext>+ <mspace width="0.333em" />+ </mrow>+ <mrow>+ <mi>x</mi>+ <mrow>+ <mrow>+ <mspace width="0.333em" />+ <mtext mathvariant="bold"> 𝐢𝐬 𝐥𝐞𝐬𝐬 𝐭𝐡𝐚𝐧 </mtext>+ <mspace width="0.333em" />+ </mrow>+ <mi>z</mi>+ <mtext mathvariant="bold">.</mtext>+ </mrow>+ </mrow>+ </mrow>+ </mrow>+</math>
+ tests/writers/math-in-text.omml view
@@ -0,0 +1,68 @@+<?xml version='1.0' ?>+<m:oMathPara>+ <m:oMathParaPr>+ <m:jc m:val="center" />+ </m:oMathParaPr>+ <m:oMath>+ <m:sSup>+ <m:e>+ <m:r>+ <m:t>X</m:t>+ </m:r>+ </m:e>+ <m:sup>+ <m:r>+ <m:t>2</m:t>+ </m:r>+ </m:sup>+ </m:sSup>+ <m:r>+ <m:t>=</m:t>+ </m:r>+ <m:r>+ <m:t>y</m:t>+ </m:r>+ <m:r>+ <m:rPr>+ <m:sty m:val="p" />+ </m:rPr>+ <m:t> under </m:t>+ </m:r>+ <m:sSub>+ <m:e>+ <m:r>+ <m:t>H</m:t>+ </m:r>+ </m:e>+ <m:sub>+ <m:r>+ <m:t>0</m:t>+ </m:r>+ </m:sub>+ </m:sSub>+ <m:r>+ <m:rPr>+ <m:sty m:val="p" />+ </m:rPr>+ <m:t> except when </m:t>+ </m:r>+ <m:r>+ <m:t>x</m:t>+ </m:r>+ <m:r>+ <m:rPr>+ <m:sty m:val="b" />+ </m:rPr>+ <m:t> is less than </m:t>+ </m:r>+ <m:r>+ <m:t>z</m:t>+ </m:r>+ <m:r>+ <m:rPr>+ <m:sty m:val="b" />+ </m:rPr>+ <m:t>.</m:t>+ </m:r>+ </m:oMath>+</m:oMathPara>
+ tests/writers/math-in-text.tex view
@@ -0,0 +1,1 @@+X^{2} = y{\text{\ under\ }H_{0}\text{\ except\ when\ }{x{\textbf{\ is\ less\ than\ }z\textbf{.}}}}
texmath.cabal view
@@ -1,5 +1,5 @@ Name: texmath-Version: 0.8.6.7+Version: 0.9 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Conversion between formats used to represent mathematics.@@ -52,6 +52,7 @@ tests/src/*.tex tests/src/*.omml tests/readers/mml/*.native+ tests/readers/mml/*.error tests/readers/tex/*.native tests/readers/omml/*.native tests/writers/*.mml@@ -101,7 +102,8 @@ Text.TeXMath.Writers.TeX, Text.TeXMath.Unicode.ToUnicode, Text.TeXMath.Unicode.ToTeX,- Text.TeXMath.Unicode.ToASCII+ Text.TeXMath.Unicode.ToASCII,+ Text.TeXMath.Unicode.Fonts Other-modules: Text.TeXMath.Compat, Text.TeXMath.Shared, Text.TeXMath.TeX,