-
-
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
overline and bar are mixed up in pandoc 2.9.1.1 #152
Comments
texmath does distinguish these in parsing, but the distinction apparently gets collapsed when rendering to OMML.
|
Oh, thx. Is this will be handled in the next version of pandoc? or next version of texmath? |
I have tried it texmath demo [here](https://johnmacfarlane.net/texmath.html. LaTeX convert to MathML and then convert back works fine. |
Yes - texmath's tex parsing and MathML rendering do distinguish these things. But its OMML rendering (Word equation) does not. |
I think word equation also distinguish these things. This is a example: The first one is input as \overline(A)[sp]\overline(B)[sp]\overline(C)[sp] under math mode. [sp] means press space key. The second one is input as A\bar[sp]B\bar[sp]C\bar[sp] under math mode. Example files: |
I unzip demo2.docx as a zip. Then the first A looks like: The second A looks like |
Then I convert demo2.docx to demo2.tex, they are mixed up. I put demo2.tex in here. demo2.zip |
So I think there maybe some problem with the translation between mathml and word. |
texmath doesn't go via a MathML intermediary. It uses a Haskell data structure. But yes, the problem lies there, in the translation from our equation structure to omml. |
Thank you for the xml samples, which show the output we should be getting. |
To recap, overline is parsed as
and bar as
We want to use m:bar in the first case and m:acc in the second. |
thx for reply. |
With this patch diff --git a/src/Text/TeXMath/Writers/OMML.hs b/src/Text/TeXMath/Writers/OMML.hs
index 342d95fa..23a7b555 100644
--- a/src/Text/TeXMath/Writers/OMML.hs
+++ b/src/Text/TeXMath/Writers/OMML.hs
@@ -221,11 +221,11 @@ showExp props e =
| n > 1.8 -> [str props "\x2001\x2001"]
| otherwise -> [str props "\x200B"]
-- this is how the xslt sheet handles all spaces
- EUnder _ x (ESymbol _ (T.unpack -> [c])) | isBarChar c ->
+ EUnder _ x (ESymbol TUnder t) | T.all isBarChar t ->
[mnode "bar" [ mnode "barPr" $
mnodeA "pos" "bot" ()
, mnode "e" $ showExp props x ]]
- EOver _ x (ESymbol _ (T.unpack -> [c])) | isBarChar c ->
+ EOver _ x (ESymbol TOver t) | T.all isBarChar t ->
[mnode "bar" [ mnode "barPr" $
mnodeA "pos" "top" ()
, mnode "e" $ showExp props x ]] we get the following output:
which looks right I think. However, this induces a number of failures in our automated tests, which I'll need to go through and look at before committing. |
I don't know whether or not this is a bug. I use pandoc 2.9.1.1.$\overline{ABC}$ .
This is a very simple demo latex:
\documentclass{article}
\begin{document}
This is overline:
This is bar:$\bar{ABC}$ .
\end{document}
The correct result looks like this:
But if I run convert it to MS word by command:
pandoc demo.tex -o demo.docx
I get:
All files are in the attached zip file.demo.zip
The text was updated successfully, but these errors were encountered: