DRMF / texvcjs

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

Preserve whitespace in math mode #49

Open notjagan opened 8 years ago

notjagan commented 8 years ago

As of now, whitespace (under the _ rule) is consumed in its entirety. However, newlines in math mode should be preserved. I'm not really certain how to make this change.

HowardCohl commented 8 years ago

@physikerwelt Do you have any idea about this? Carriage returns are getting eaten. How should we preserve them?

Example

x=a+b+c
+d+\sum_{n=0}^\infty a_n

becomes

x=a+b+c+d+\sum_{n=0}^\infty a_n

The carriage returns should be preserved.

physikerwelt commented 8 years ago

I don't get the context. texvc does not allow equation https://en.wikipedia.org/wiki/User:Physikerwelt/cases

HowardCohl commented 8 years ago

@physikerwelt Ok. I changed the above example.

The carriage returns are important.

physikerwelt commented 8 years ago

@HowardCohl the example you give still does not render for me.

HowardCohl commented 8 years ago

@physikerwelt I don't know what happened. I changed the markup, but the change did not appear.

I have updated the math source and also edited https://en.wikipedia.org/wiki/User:Physikerwelt/cases to demonstrate.

HowardCohl commented 8 years ago

Of course, I know a way to fix the issue, but I don't know if you would be happy with this. Everytime you have a carriage return, you could insert a special string such as <_> and after texvcjs has processed the code, every time you find a <_> you then replace it with a carriage return.

physikerwelt commented 8 years ago

I'm not sure about the problem. Both expression look the same for me on my userpage. What's the significance of the the newline. And why do you want to preserve the newline.

Let me guess:

You want to present the string that was processed by texvc to a human being?

HowardCohl commented 8 years ago

@physikerwelt I think we've had this discussion along the lines of conversations with Bruce in one of our GitHub issues regarding LaTeXML (I might be able to find the discussion if I was able to search for GitHub issues I've participated in a certain GitHub repo).

Of course, the rendered result is the same.

The formatting (with return characters) is a good thing, and has been chosen carefully by a human so that it is easier to read (as a human). We do not want to lose that information.

HowardCohl commented 8 years ago

@physikerwelt I don't remember the name of the Deyan's GitHub repo for LaTeXML servers that we had that long discussion about line breaking. I thought it was something like tlxpgsi or something like that.