sympy / sympy

A computer algebra system written in pure Python
https://sympy.org/
Other
12.84k stars 4.4k forks source link

Add a guard against people using * in LaTeX in the docs #17803

Open asmeurer opened 4 years ago

asmeurer commented 4 years ago

If a LaTeX expression in the docs contains *, it is almost certainly wrong, meaning the person is writing the LaTeX as SymPy/Python code instead of proper LaTeX. It doesn't help that single backticks currently produce math in the docs (https://github.com/sympy/sympy/issues/13519).

We should make the docs build fail if * is contained in a LaTeX expression. This will probably require using the Sphinx extension API. For the very rare cases where a * is actually desired, we can allow {*} to pass without an error.

CC @sympy/gsod

sylee957 commented 4 years ago

I agree that it is a bad idea for multiplication operation, but what about convolution operations? I think that this type of mistake often comes up with the misuse of single backticks. so if people are able to distinguish both, then there would be less problem for this as well. I'm not sure that going against some standard is a good idea.

asmeurer commented 4 years ago

My idea is that it's rare enough that we can warn on it. {} will produce the exact same thing as so it can be used to silence the warning.

Maybe it won't be necessary once we drop the backtick thing. In my experience, though, people use * even when they know it is LaTeX, because they forget what they are doing and fallback to using Python syntax (I do it myself sometimes on accident).

moorepants commented 4 years ago

LaTeX doesn't check for this issue itself, so I don't think we need to do it here. We are leaning into the "autocorrect" type of software design and we know how that is a mixture of good and bad results on smartphone typing.