Skip to content
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

LatexWalker does not correctly parse $$ in $a$$b$ #43

Closed
xiejianping-0108 opened this issue Aug 10, 2020 · 3 comments
Closed

LatexWalker does not correctly parse $$ in $a$$b$ #43

xiejianping-0108 opened this issue Aug 10, 2020 · 3 comments

Comments

@xiejianping-0108
Copy link

Dear Philippe
Thanks for your work!
The lib help me a lot.
I have a question when I use LatexWalker module to parse a Latex String, it see all text to a LatexMathNode.For example, the following Latex code is part of article:

\author[$\dagger$$\ddagger$1]{Qinyuan REN} \author[1]{Ping LI} %\author[$\dagger$1]{Ping Li} \affil[1]{State Key Laboratory of Industrial Control Technology, Zhejiang University, Hangzhou 310027, China} \affil[2]{Department of Electrical and Computer Engineering, National University of Singapore, Singapore 117576, Singapore} \affil[3]{Zhejiang University of Science and Technology, Hangzhou 310023, China}

I don't kown is it reasonable, but it is a trouble for me with parse Latex code.
Thanks in advance!

@phfaist
Copy link
Owner

phfaist commented Aug 10, 2020

Hi, thanks for the report. I think I see what the bug is—the two consecutive dollar signs in $\dagger$$\dagger$ are being parsed as a display equation delimiter. The issue is that currently, the tokenizer does not know if we are currently in an inline-math or display-math mode to decide whether to parse two dollar signs as two $ tokens or a single $$ token. I'll look a bit deeper into this. As a workaround, if you know you are not parsing any display equations (it looks like you're parsing author/affiliations which probably will never have display equations), you can replace occurences of $$ by $ $ (ie with a space between the dollar signs).

@phfaist
Copy link
Owner

phfaist commented Aug 10, 2020

I pushed a fix, feel free to re-open this issue if the problem persists in the latest git version.

@xiejianping-0108
Copy link
Author

Hi, thanks for the report. I think I see what the bug is—the two consecutive dollar signs in $\dagger$$\dagger$ are being parsed as a display equation delimiter. The issue is that currently, the tokenizer does not know if we are currently in an inline-math or display-math mode to decide whether to parse two dollar signs as two $ tokens or a single $$ token. I'll look a bit deeper into this. As a workaround, if you know you are not parsing any display equations (it looks like you're parsing author/affiliations which probably will never have display equations), you can replace occurences of $$ by $ $ (ie with a space between the dollar signs).

thank you very much! I have do with you say.

@phfaist phfaist changed the title LatexMathNode is reasonable for '$****$$****$**' LatexWalker does not correctly parse $$ in $a$$b$ Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants