texfrag can be used for rendering TeX fragments in stackexchange pages (e.g., https://math.stackexchange.com) presented with sx. It uses the AucTeX preview package for the job. Therefore, you need a working AucTeX preview (inclusive a working LaTeX).
Several other major modes are supported, e.g., html-mode
for MathJax fragments in html pages and prog-mode
for formulas in doxygen comments.
In the comments you asked me to demonstrate texfrag-mode
for the text
For all positive integers {n} one has \displaystyle \frac{1}{n+1} \leq \frac{1}{n}
in the scratch buffer.
The major mode of *scratch*
is lisp-interaction-mode
which is derived from prog-mode
. Texfrag recognizes doxygen style formulas in comments in major modes derived from prog-mode
by default. Therefore your line should be contained in a comment and the formulas in your line should be delimited by the doxygen equation delimiters \f$
.
;; For all positive integers \f$n\f$ one has \f$\displaystyle \frac{1}{n+1} \leq \frac{1}{n}\f$
There is a recent bugfix of texfrag-mode
that avoids an infinite iteration when the buffer ends in a comment. If you don't have that corrected version please make sure that the comment is not the last thing in the buffer. (Just add a newline.)
Note, that you need some identification of TeX-formulas. For an instance MathJax formulas usually are identified by the boundaries \(\)
or $ $
.
texfrag-mode
is quite flexible. You can add your own setup for a given major-mode to texfrag-setup-alist
.
\(...\)
or$...$
.\(...\)
or$...$
.