-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MathML -> Tex conversion, mfenced element: ( | #177
Comments
It took me a while to figure out why the parser was doing this!
(here we get the correct parentheses for open and close), but when we embed this in the outer mfenced:
Now we get The reason, it seems, is that the MathML reader stores the attributes of outer elements in state and uses them when parsing children in some cases. The relevant code is here (Text.TeXMath.Readers.MathML, line 599): findAttrQ :: String -> Element -> MML (Maybe T.Text)
findAttrQ s e = do
inherit <- asks (lookupAttrQ s . attrs)
return $ fmap T.pack $
findAttr (QName s Nothing Nothing) e
<|> inherit So what's happening here is that the inner This code was added long ago by @mpickering - I wonder if he can remember why we have this |
When I change this inheritance so it doesn't accumulate attributes from parents, I see a number of test failures, e.g. in munder5.mml <munder accentunder="false">
<mi>x</mi>
<mo> ˜</mo>
</munder> we get |
Looking at the spec, it seems that many attributes inherit, but these don't. |
Cool, thanks a lot @jgm for the answer and solution! Works for me. |
Yeah, there may be other problems of this kind, but I couldn't find a handy table of which attributes inherit and which don't -- and I didn't have time to comb through the whole spec exhaustively. |
Hello texmath-team,
this issue is about converting the -Element from MathML to Tex.
I have the following example:
which is represented in MathML as:
When I convert this MathML to tex in https://johnmacfarlane.net/texmath.html, I get as result:
\left( A \middle| B \right)\left| {C\left| D \middle| E \right|} \right|
which looks like
The parentheses () around D and E have been transformed in the end to vertical lines ||. But expected is that the formula looks like the initial version.
Is this a bug in the texmath lib?
Best greetings,
Felix
The text was updated successfully, but these errors were encountered: