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

Issue with absolute values #16

Open
asmeurer opened this issue Oct 26, 2019 · 6 comments
Open

Issue with absolute values #16

asmeurer opened this issue Oct 26, 2019 · 6 comments

Comments

@asmeurer
Copy link
Member

The math $|y| \geq |x^e|$ produces an error

WARNING: Inline substitution_reference start-string without end-string.

Changing the transformer priority to lower than that of substitutions doesn't seem to fix it. http://docutils.sourceforge.net/docs/ref/transforms.html

@asmeurer
Copy link
Member Author

This happens at the parser level. I think the node level that we are currently working at is too late in the process. Even if we could reconstruct it from the node, the warning will already be omitted. So I think we need to modify the extension to work at the parser level. The node level may also be necessary to prevent math from being used inside of code blocks.

@asmeurer
Copy link
Member Author

I guess we can make a parser subclass and register it. https://www.sphinx-doc.org/en/master/extdev/parserapi.html

@asmeurer
Copy link
Member Author

I don't know how easy this will be to fix. For now, if you get a warning like this from using dollar math, you should just use the :math: role as a workaround.

@webknjaz
Copy link

webknjaz commented Aug 2, 2020

$|y| \geq |x^e|$

Have you tried it like this $\ |y| \geq |x^e|\ $?

@asmeurer
Copy link
Member Author

asmeurer commented Aug 3, 2020

That doesn't work. The problem is that Sphinx parses out the |y| and |x^e| as substitutions before the sphinx-math-dollar extension parsers the dollar signs as math. The substitution parsing happens very early in the RST parser, even earlier than the creation of the AST.

@sylee957
Copy link
Member

I think that it is possible to make a workaround like ${ | y | \geq | x^e | }$ where

  1. You add extra spacing before and after every vertical bars |
  2. Wrap the whole LaTeX with braces {}

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