Bug '\epsilon < 8' renders as a "Misplaced &" error

  • Thread starter Thread starter pasmith
  • Start date Start date
AI Thread Summary
The discussion highlights a known bug in the forum's LaTeX rendering, where the less-than symbol (<) is replaced by its HTML entity (&lt;) before rendering, causing errors in previews. Users express frustration with the preview function, which does not handle LaTeX environments like "align*" correctly, leading to the loss of formatting and incorrect display of equations. The Mathjax plugin is used for rendering, but issues arise when switching between preview and post modes, necessitating a refresh each time. Suggestions include improving the preview functionality to match the post rendering or reverting to a previous version of the forum software. Overall, the current system complicates the process of writing and editing mathematical content.
pasmith
Science Advisor
Homework Helper
Messages
3,336
Reaction score
1,877
Physics news on Phys.org
pasmith said:
[itex]\epsilon < 8[/itex] renders as ϵ<8.

Originally discovered in my post at https://www.physicsforums.com/threa...tion-using-epsilon-delta.1081023/post-7267512.

Looking at the preview of this post (with LaTeX not being rendered due to a known bug) suggests that < is being replaced by &lt; before LaTeX rendering occurs.

We use the Mathjax plugin for Latex rendering and it uses either double $ or double # to bracket expressions instead of itex or tex tags.

Using double #: # # \epsilon < 8 # # without spaces between the #


ϵ<8
or using $$: $ $ \epsilon < 8 $ $ without spaces between the $.

ϵ<8
 
jedishrfu said:
We use the Mathjax plugin for Latex rendering and it uses either double $ or double # to bracket expressions instead of itex or tex tags.
itex and tex are both valid and only those work in preview, the shorthand does not
 
  • Informative
  • Like
Likes berkeman and jedishrfu
pasmith said:
[itex]\epsilon < 8[/itex] renders as \epsilon &lt; 8.

Originally discovered in my post at https://www.physicsforums.com/threa...tion-using-epsilon-delta.1081023/post-7267512.

Looking at the preview of this post (with LaTeX not being rendered due to a known bug) suggests that < is being replaced by &lt; before LaTeX rendering occurs.
I have the same difficulty with the ampersand. It "sees" the backslash and turns & into amp;

This is a pity since my favorite environment for typing equations is "align*". It also needs additional math tags for "preview", which it does not need for "post reply".

It only concerns the preview function, which is currently not really working. The posts themselves are not affected, except that you have to refresh the page every time to enforce the rendering.

I'm currently using the procedure "post + refresh + edit" as long as necessary.
 
fresh_42 said:
I have the same difficulty with the ampersand. It "sees" the backslash and turns & into amp;
Does this happen on preview?
 
Greg Bernhardt said:
Does this happen on preview?
Yes. I normally use the setup
Code:
\begin{align*}
\ldots &= \ldots \\
&= \ldots \\
\ldots
&= \ldots
\end{align*}
to align equations. It also has the advantage that it is automatically rendered as math code without having to use math tags.

The preview, however, does not handle the carriage returns and the ampersand very well, plus I have to insert math tags that I have to remove again before posting.

Example: The perfectly correct code for "Post reply"
Code:
\begin{align*}
A&=\begin{pmatrix}1&1\\0&-1\end{pmatrix}
\end{align*}

led to

1751294390330.webp


in the preview section. So I have to tell it that the align environment is math, and remove it before posting, since the forum software knows this. I could not repeat my previous example that had led to the "amp;" notation. I think it was a failed attempt to trick the editor into reading it by typing \& instead. Anyway, turning back to edit mode eliminated the ampersands and carriage returns in the matrix, and the matrix has completely gone:

Code:
\begin{align*}
A&=(110−1)
\end{align*}

The preview is primarily for checking parentheses hierarchies, forgotten or too many sharp characters, forgotten backslashes, too long lines, and similar typos. But since it destroys the text when turning back, it is useless.

If I had to write a specification paper (or whatever the English term for "Pflichtenheft" is), I would require that the same functionality that is initiated by the "post reply" button would have to be used, just inside the edit window (or if not possible, in a new tab as in WP) instead of actually appending it to the thread. Same black-box, and no additional code lines as an attempt to repair the "preview" button.

I wonder if a rollback would be an option?
 
Last edited:
Also, a downside of the new Xenforo version: once a post is submitted, we have to refresh the page every time, and also after editing something. Always, a refresh is necessary. Before the update, we had to do this at most once when entering a thread, and not all the time.

It is a bit like using the vi editor, where you constantly have to hit ESC to make sure you're in the correct mode.
 
  • #10
Code:
\begin{align*}
X&=\begin{pmatrix}1&1\\0&-1\end{pmatrix}\\[6pt]
Y&=\begin{pmatrix}1&0\\-1&-1\end{pmatrix}
\end{align*}

Preview:
1751301954450.webp


Code on return:
Code:
\begin{align*}
X&=(110−1)\[6pt]
Y&=(10−1−1)
\end{align*}

Code:
##\varepsilon < 8##

Preview:
1751302262889.webp

Code on Return:
Code:
ε<8
Only editable in BB toggle OFF mode.

Code:
[itex] \varepsilon < 8 [/itex]

Preview:
1751302479090.webp

Code on Return:
Code:
[itex] \varepsilon < 8 [/itex]

Yes, it works. But only this simple example, and only with written-out tags.

I don't think that fighting from example to example is a good strategy. LaTeX is way too complex to succeed by that strategy. I still think a) emulate "post + refresh" would be better, or b) an entire rollback to the previous version.
 
  • #11
A typical post of mine is more like that:
Code:
I think that there are nice possibilities to get rid of the ##\operatorname{arcsin}.##

I used
\begin{align*}
I&=2\int_{0}^a \operatorname{arcsin} \sqrt{f(\alpha)f(-\alpha)}\,d\alpha=2\int_{0}^a\int_0^1 \sqrt{\dfrac{f(\alpha)f(-\alpha)}{1-f(\alpha)f(-\alpha)t^2}}\,dt\,d\alpha \\
&=2\int_{0}^a\int_0^1 \dfrac{1}{\sqrt{\left(f(\alpha)f(-\alpha)\right)^{-1}-t^2}}\,dt\,d\alpha\\
&=2\int_{0}^a\int_0^1\dfrac{1}{\sqrt{\dfrac{32(y+1)}{(y^2+2y-7)(y^2+7)}-t^2}}\,dt\,d\alpha
\end{align*}
where ##a=\operatorname{arcsin}(1/\sqrt{8})\, , \,y^2=9-16 x\, , \,x=\sin^2(\alpha)## and
$$
f(\alpha)f(-\alpha)=\dfrac{1}{32}\dfrac{(y^2+2y-7)(y^2+7)}{y+1}
$$
However, Fubini or not, it leads me directly into the same complicated - now polynomial - integrations as dealt with on MSE.

I have found another funny formula on Wikipedia that at least provide the additional ##\pi## and the logarithm which is apparently part of the deal:
$$
\operatorname{arcsin}R(x) = \int_0^1 \dfrac{1}{\pi \,t}\log\left(\dfrac{t^2+2R(x)t+1}{t^2-2R(x)t+1}\right) \;dt
$$

Looking at the math on MSE shows that there is no easy way to deal with the integrations, even without the trig function.

No way I would risk destroying all these formulas by a broken preview or even write this without carriage returns.
 
  • #12
fresh_42 said:
b) an entire rollback to the previous version.
This is not an option
fresh_42 said:
No way I would risk destroying all these formulas by a broken preview or even write this without carriage returns.
Can you test carriage returns? That should be fixed too.
 
  • #13
Works with
Code:
[tex] 
\operatorname{arcsin}(x)
[/tex]

Edit: Except that it isn't centered as usual. It is on the left of the line.
 
  • Like
Likes Greg Bernhardt
  • #14
testing ...
<br /> \operatorname{arcsin}(x)<br />
... end of test

The code had been:
Code:
testing ...
[tex] 
\operatorname{arcsin}(x)
[/tex]
... end of test

I am not the typical user. I have a Tex editor open almost all the time, so I type long formulas there and only have to change $ into ## for inline statements. The rest translates one by one, i.e., on post/refresh functionality, not on preview.
 
Last edited:

Similar threads

Replies
3
Views
1K
Replies
3
Views
2K
Replies
26
Views
3K
Replies
48
Views
5K
Replies
163
Views
26K
Replies
1
Views
3K
Back
Top