LaTeX Do Latex diagrams work in the preview mode?

  • Thread starter Thread starter Stephen Tashi
  • Start date Start date
  • Tags Tags
    Diagrams Latex
Click For Summary
SUMMARY

LaTeX diagrams do not consistently display in the preview mode of the message editor due to the implementation of MathJax, which loads lazily. Users have reported that while some LaTeX code works, others fail to render, necessitating a page refresh for proper display. Specifically, the commutative diagram example using the array environment functions correctly, while other examples may not. To ensure LaTeX renders in preview mode, users should include LaTeX in their posts and refresh the page if it does not display initially.

PREREQUISITES
  • Familiarity with LaTeX syntax, particularly the array environment.
  • Understanding of MathJax and its role in rendering LaTeX on web pages.
  • Basic knowledge of web browsers, specifically Chrome, and their handling of JavaScript.
  • Experience with message editors that support LaTeX input.
NEXT STEPS
  • Research "MathJax configuration for LaTeX rendering" to understand its settings and optimizations.
  • Explore "LaTeX array environment" for advanced diagram creation techniques.
  • Investigate "troubleshooting LaTeX in web applications" for common issues and fixes.
  • Learn about "browser developer tools" to debug rendering issues in real-time.
USEFUL FOR

This discussion is beneficial for LaTeX users, web developers implementing LaTeX in forums, and anyone troubleshooting rendering issues in message editors.

Stephen Tashi
Science Advisor
Homework Helper
Education Advisor
Messages
7,864
Reaction score
1,602
I pasted examples (taken from old threads) of doing commutative diagrams in LaTex into the message editor and tried them in the preview mode. They didn't display. Should a correct example work in the preview mode?

I'll paste a couple in this message and see if they show up in the final post.

##\begin{array}{ccccc} ~ & ~ & f & ~ & ~ \\ ~ & A & \longrightarrow & B & ~ \\ g & \downarrow & ~ & \downarrow & h \\ ~ & C & \longrightarrow & D & ~ \\ ~ & ~ & k & ~ & ~ \end{array}##

##
\documentclass{article}
\usepackage{graphics}
\begin{document}
\begin{figure}
\includegraphics{sin}
\caption{\label{sin}The sine function.}
\end{figure}
\end{document}
##
 
Physics news on Phys.org
Stephen Tashi said:
I pasted examples (taken from old threads) of doing commutative diagrams in LaTex into the message editor and tried them in the preview mode. They didn't display. Should a correct example work in the preview mode?

I'll paste a couple in this message and see if they show up in the final post.

##\begin{array}{ccccc} ~ & ~ & f & ~ & ~ \\ ~ & A & \longrightarrow & B & ~ \\ g & \downarrow & ~ & \downarrow & h \\ ~ & C & \longrightarrow & D & ~ \\ ~ & ~ & k & ~ & ~ \end{array}##

##
\documentclass{article}
\usepackage{graphics}
\begin{document}
\begin{figure}
\includegraphics{sin}
\caption{\label{sin}The sine function.}
\end{figure}
\end{document}
##
This one worked for me in preview mode (Win 11, Chrome).

##\begin{array}{ccccc} ~ & ~ & f & ~ & ~ \\ ~ & A & \longrightarrow & B & ~ \\ g & \downarrow & ~ & \downarrow & h \\ ~ & C & \longrightarrow & D & ~ \\ ~ & ~ & k & ~ & ~ \end{array}##

The other one gives me the same error.
 
Compare the underlying Latex and you'll see why one works and the other does not - our MathJax implementation has some idiosyncracies. A second confounding factor is that MathJax is loaded lazily so that sometimes the Latex won't be processed at all (neither the typesetting you expected nor an error) until the page is refreshed.
 
Are there hints for getting Latex to work reliably in the message editor's preview mode?
 
Stephen Tashi said:
Are there hints for getting Latex to work reliably in the message editor's preview mode?
If you are starting a new thread, no, you're stuck. Try laying out your post as a reply to something then cut and paste it to your new thread.

If you are replying the put some LaTeX in your post and preview it. If there's already LaTeX in the page it should render. If not, it won't render. In that case, refresh the page while still in preview mode. Preview again and the LaTeX should render.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 11 ·
Replies
11
Views
8K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K