LaTeX works on math Forums but not others. Does it work for you here?

  • Context: LaTeX 
  • Thread starter Thread starter Keith_McClary
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the functionality of LaTeX in forum posts, particularly focusing on issues with the preview feature not rendering LaTeX correctly in certain situations. Participants explore the implications of this behavior across different types of threads, including math-related discussions.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes that the preview function shows the source code instead of rendered LaTeX unless there is an earlier post with LaTeX in the thread.
  • Another participant explains that this issue is due to the lazy-loading of MathJax, which can be circumvented by following specific steps to ensure LaTeX is rendered in the preview.
  • A proposed workaround involves writing random LaTeX code to trigger the loading of the MathJax parser before posting or previewing.
  • Concerns are raised about the potential for LaTeX to become gibberish if the page is refreshed or if drafts are saved improperly, particularly when using complex expressions.
  • Suggestions are made for a possible solution that would allow users to manually load LaTeX when it is not automatically rendered, including the idea of a button to trigger this loading.

Areas of Agreement / Disagreement

Participants generally agree on the existence of the issue with LaTeX rendering in previews, but there are differing opinions on the best workaround and potential solutions. The discussion remains unresolved regarding the implementation of a more user-friendly loading mechanism for LaTeX.

Contextual Notes

Limitations include the dependence on the presence of LaTeX in earlier posts for proper rendering and the potential for errors when drafts are saved or pages are refreshed.

Keith_McClary
Messages
752
Reaction score
1,506
When I click Preview i just see the source for this:

##\omega##

\omega

Edit: OK, when I actually post it , it works!
 
Physics news on Phys.org
That's a known issue with the preview function if there is no earlier post with LaTeX in the thread - it doesn't load the parser in that case. It works the same in all forums, but math threads are more likely to have formulas in earlier posts.
 
  • Like
  • Love
Likes   Reactions: PeroK and Keith_McClary
Yeah, I posted about this issue about two months time back, and as mfb has said, it is due to the lazy-loading of MathJax. The workaround is to do the following:

Case 1: If you are replying to a thread that does not have LaTeX before your post in the page:

1. Write some random LaTeX in the reply box, like ##a## test.
2. Make sure the draft is saved (green dot adjacent to floppy icon; or save it by clicking on the floppy icon → Save draft).
3. Refresh the page.
4. Now, hit preview. LaTeX will be rendered normally. Delete what you had written earlier and start typing what you want.

Case 2: If you are creating a new thread:

1. LaTeX will obviously not be loaded. Write some random LaTeX code.
2. Save the draft.
3. Refresh the page.
4. Now, you will see that LaTeX has rendered in the message box. Delete the rendered LaTeX and start typing what you want. Preview will now work.

Note that in case 2, if you type something and then refresh the page, or save the draft, leave the page and come back later, LaTeX will always get rendered in the box, so whatever you have written will become gibberish, especially if you have fractions, integrals, differentiation operators, etc. This is a bug. If you are starting a new thread, it is probably better to write it out somewhere else and then copy and paste here.

Maybe Greg can keep the LaTeX to load lazily, but design a button somewhere on each page that will be displayed only if the MathJax resource is not loaded on that page. Clicking that button will load LaTeX for that user, and it will stay until the user refreshes the page.
 
Last edited:
  • Like
Likes   Reactions: FactChecker
Wrichik Basu said:
Maybe Greg can keep the LaTeX to load lazily, but design a button somewhere on each page that will be displayed only if the MathJax resource is not loaded on that page. Clicking that button will load LaTeX for that user, and it will stay until the user refreshes the page.
Yeah I need to have it dynamically add once the preview button is pushed.
 
  • Like
Likes   Reactions: Keith_McClary and Wrichik Basu

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 23 ·
Replies
23
Views
4K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K