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

latex2text is removing macroname from the latext- text #12

Closed
chetankabra opened this issue Mar 21, 2018 · 2 comments
Closed

latex2text is removing macroname from the latext- text #12

chetankabra opened this issue Mar 21, 2018 · 2 comments

Comments

@chetankabra
Copy link

encoder = LatexNodes2Text(keep_inline_math=True, keep_comments=True)
print encoder.latex_to_text(r'Global well-posedness for the mass-critical stochastic nonlinear Schr\"{o}dinger equation on $\mathbb{R}$: small initial data')
I have used above code to decode Latex command and I only want the latex accent command to be converted to plain text.

but Latex is removing latex macro from the output.
Output:
Global well-posedness for the mass-critical stochastic nonlinear Schrödinger equation on $R$: small initial data

Expected output:
Global well-posedness for the mass-critical stochastic nonlinear Schrödinger equation on $\mathbb{R}$: small initial data

@furutaka
Copy link

furutaka commented Jun 1, 2018

I think you can get what you want by doing:
encoder = LatexNodes2Text(keep_inline_math=True, keep_comments=True)
print encoder.latex_to_text(r'Global well-posedness for the mass-critical stochastic nonlinear Schr\"{o}dinger equation on $\mathbb{R}$: small initial data',keep_inline_math=True)

@phfaist
Copy link
Owner

phfaist commented Aug 22, 2018

@furutaka's comment is indeed the correct way to go (thanks for replying!). I'm closing this issue, reopen if there are any further problems.

@phfaist phfaist closed this as completed Aug 22, 2018
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

3 participants