Skip to content

Commit 22abed5

Browse files
committed
OMML writer: use m:eqArr rather than m:m...
for arrays with alternating right, left alignments. (In other writers, TeX and MathML, we presume that these are aligned equations.) Closes #209.
1 parent b3ee360 commit 22abed5

File tree

2 files changed

+512
-525
lines changed

2 files changed

+512
-525
lines changed

src/Text/TeXMath/Writers/OMML.hs

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ where
2626

2727
import Text.XML.Light
2828
import Text.TeXMath.Types
29-
import Text.TeXMath.Shared (isUppercaseGreek)
29+
import Text.TeXMath.Shared (isUppercaseGreek, isRLSequence)
3030
import Data.Generics (everywhere, mkT)
3131
import Data.Char (isSymbol, isPunctuation)
3232
import Data.Either (lefts, isLeft, rights)
3333
import qualified Data.Text as T
3434
import Data.List.Split (splitWhen)
35+
import Data.List (intercalate)
3536

3637
-- | Transforms an expression tree to an OMML XML Tree
3738
writeOMML :: DisplayType -> [Exp] -> Element
@@ -84,12 +85,17 @@ maximum' [] = 0
8485
maximum' xs = maximum xs
8586

8687
makeArray :: [Element] -> [Alignment] -> [ArrayLine] -> Element
88+
makeArray props as rs
89+
| isRLSequence as = mnode "eqArr" $ map toE rs
90+
where toE r = mnode "e" (intercalate ampersand
91+
(map (concatMap (showExp props)) r))
92+
ampersand = [mnode "r" [ mnode "t" ("&" :: String) ]]
8793
makeArray props as rs = mnode "m" $ mProps : map toMr rs
8894
where mProps = mnode "mPr"
8995
[ mnodeA "baseJc" "center" ()
9096
, mnodeA "plcHide" "on" ()
9197
, mnode "mcs" $ map toMc as' ]
92-
as' = take (maximum' $ map length rs) $ as ++ cycle [AlignCenter]
98+
as' = take (maximum' $ map length rs) $ as ++ repeat AlignCenter
9399
toMr r = mnode "mr" $ map (mnode "e" . concatMap (showExp props)) r
94100
toMc a = mnode "mc" $ mnode "mcPr"
95101
[ mnodeA "mcJc" (toAlign a) ()

0 commit comments

Comments
 (0)