@@ -112,7 +112,7 @@ makeText a s = case (leadingSp, trailingSp) of
112
112
makeArray :: Maybe TextType -> [Alignment ] -> [ArrayLine ] -> Element
113
113
makeArray tt as ls = unode " mtable" $
114
114
map (unode " mtr" .
115
- zipWith (\ a -> setAlignment a . unode " mtd" . map (showExp tt) ) as') ls
115
+ zipWith (\ a -> setAlignment a . unode " mtd" . showExps tt ) as') ls
116
116
-- see #205 on the need for style attributes:
117
117
where setAlignment AlignLeft =
118
118
withAttribute " columnalign" " left" .
@@ -148,6 +148,17 @@ showExp' tt e =
148
148
in withAttribute " accent" isaccent $ tunode " mo" x
149
149
_ -> showExp tt e
150
150
151
+ showExps :: Maybe TextType -> [Exp ] -> [Element ]
152
+ showExps tt = map (showExp tt) . insertFunctionApps
153
+
154
+ insertFunctionApps :: [Exp ] -> [Exp ]
155
+ insertFunctionApps [] = []
156
+ insertFunctionApps (e@ EMathOperator {} : ESymbol _ " \x2061 " : es) =
157
+ e : ESymbol Pun " \x2061 " : insertFunctionApps es
158
+ insertFunctionApps (e@ EMathOperator {} : es) =
159
+ e : ESymbol Pun " \x2061 " : insertFunctionApps es
160
+ insertFunctionApps (e: es) = e : insertFunctionApps es
161
+
151
162
showExp :: Maybe TextType -> Exp -> Element
152
163
showExp tt e =
153
164
let toUnicodeMaybe :: TextType -> T. Text -> Maybe T. Text
@@ -173,30 +184,32 @@ showExp tt e =
173
184
in case e of
174
185
ENumber x -> vnode " mn" x
175
186
EGrouped [x] -> showExp tt x
176
- EGrouped xs -> mrow $ map (showExp tt) xs
187
+ EGrouped xs -> mrow $ showExps tt xs
177
188
EDelimited start end xs -> mrow $
178
189
[ makeStretchy FPrefix (vnode " mo" start) | not (T. null start) ] ++
179
190
map (either (makeStretchy FInfix . vnode " mo" ) (showExp tt)) xs ++
180
191
[ makeStretchy FPostfix (vnode " mo" end)
181
192
| not (T. null end) ]
182
193
EIdentifier x -> vnode " mi" x
183
- EMathOperator x -> vnode " mo " x
194
+ EMathOperator x -> vnode " mi " x -- see #257
184
195
ESymbol Open x -> makeFence FPrefix $ vnode " mo" x
185
196
ESymbol Close x -> makeFence FPostfix $ vnode " mo" x
186
- ESymbol Ord x -> vnode " mi" x
197
+ ESymbol Ord x
198
+ | x == " \x2061 " -> vnode " mo" x
199
+ | otherwise -> vnode " mi" x
187
200
ESymbol _ x -> vnode " mo" x
188
201
ESpace x -> spaceWidth x
189
202
EFraction ft x y -> showFraction tt ft x y
190
- ESub x y -> unode " msub" $ map (showExp tt) [x, y]
191
- ESuper x y -> unode " msup" $ map (showExp tt) [x, y]
192
- ESubsup x y z -> unode " msubsup" $ map (showExp tt) [x, y, z]
193
- EUnder _ x y -> unode " munder" [showExp tt x, showExp' tt y]
203
+ ESub x y -> unode " msub" $ showExps tt [x, y]
204
+ ESuper x y -> unode " msup" $ showExps tt [x, y]
205
+ ESubsup x y z -> unode " msubsup" $ showExps tt [x, y, z]
206
+ EUnder _ x y -> unode " munder" $ showExps tt [x] ++ [ showExp' tt y]
194
207
EOver _ x (ESymbol Accent " \8407" ) -- see #218, gives better rendering for vectors
195
- -> unode " mover" [showExp tt x, showExp' tt (ESymbol Accent " \8594" )]
196
- EOver _ x y -> unode " mover" [showExp tt x, showExp' tt y]
197
- EUnderover _ x y z -> unode " munderover"
198
- [showExp tt x, showExp' tt y, showExp' tt z]
199
- EPhantom x -> unode " mphantom" $ showExp tt x
208
+ -> unode " mover" $ showExps tt [x] ++ [ showExp' tt (ESymbol Accent " \8594" )]
209
+ EOver _ x y -> unode " mover" $ showExps tt [x] ++ [ showExp' tt y]
210
+ EUnderover _ x y z -> unode " munderover" $
211
+ showExps tt [x] ++ [ showExp' tt y, showExp' tt z]
212
+ EPhantom x -> unode " mphantom" $ showExps tt [x]
200
213
EBoxed x -> withAttribute " notation" " box" .
201
214
unode " menclose" $ showExp tt x
202
215
ESqrt x -> unode " msqrt" $ showExp tt x
0 commit comments