DRMF / texvcjs

A LaTeX validator/translator for TeX strings embedded in wikitext
0 stars 2 forks source link

Issue with texvcjs replacements on some characters #32

Closed poortho closed 8 years ago

poortho commented 8 years ago

For example:

$

becomes

\$
HowardCohl commented 8 years ago

@physikerwelt @ClaudeZou

Isn't it the case that texvc assumes that the input is in math mode? If this is the case, then $ as a command which switches to math mode, does not really make sense in this situation. Right?

physikerwelt commented 8 years ago

Yes, this replacement was basically done for security reasons, when LaTeX was actually used to render the expression. Otherwise people could leave the the math mode and get access to the server... https://www.explainxkcd.com/wiki/index.php/327:_Exploits_of_a_Mom

HowardCohl commented 8 years ago

So Claude, you basically need to parse a LaTeX file and determine if you are in math mode or not.

If you are in math mode then you should search for replacements. Otherwise, you should not.

Determining whether you are in math mode or not might be tricky, since there are many ways to get in and out of math mode in LaTeX. Right Moritz?

physikerwelt commented 8 years ago

@HowardCohl ... we are almost always in math mode. So we do not want to support to leave the math mode via $ in texvcjs, because texvcjs is a parser it knows if it's inside a \text{ or another boxed mode

HowardCohl commented 8 years ago

@HowardCohl ... we are almost always in math mode.

This is not true. Claude is now working on writing a program to parse, for instance, the KLS and KLSadd datasets. And these are not almost always in math mode. One needs to check if they are.

So we do not want to support to leave the math mode via $ in texvcjs, because texvcjs is a parser it knows if it's inside a \text{ or another boxed mode

Yes, Claude is not using texvcjs to do this. He is writing a program which calls texvcjs.

physikerwelt commented 8 years ago

Seems like claude is re-inventing LaTeXML?

HowardCohl commented 8 years ago

Oh I see. Claude, this requires something different than what we are thinking. We should parse Wikitext. In this case, it will be much easier to determine if we are in math mode or not.

physikerwelt commented 8 years ago

This is the expected behavior. I think @pkra does not mind that I copied his label.