Hi Nicolas,

Thanks for getting back to me on this. With regard to
> I think you can preview \ce{...} just fine, with appropriate LaTeX headers.

I'm entirely likely to be missing something, however from a minimal test in a document I'm unable to get org-latex-preview to do anything with the following:
#+LATEX_HEADER: \usepackage{mhchem}
\ce{CO2} @@latex:\ce{CO2}@@
> This should not be possible. Org cannot recognize all LaTeX syntax. If
> you cannot preview it, Org does not understand it. IOW, it would be
> a poor experience if you preview something that doesn't exist, e.g.,
> upon exporting the document.
in a doc
My thoughts were that perhaps what works for \( ... \) and \[ ... \] (in terms of org-latex-preview) could be extended to other forms of inline LaTeX as well?
Given your response I'm guessing there are technical challenges with this?
FYI it seems to work fine for exporting (see image below), I'd just quite like to benefit from the visual tidiness achieved by the current LaTeX maths fragment rendering.
Oh, it just comes to mind that you may be referring to non-TeX-based output formats, where I can see that this could be a huge hassle.

Once again, (at this point in time) I am very loosely familiar with the innards of org (I've just stumbled around loking for specifics with C-h f / C-h v),
so if I look like I'm making any strange/outragous statements, please apply a substantial pinch of salt :D

Timothy
On May 19 2020, at 3:26 pm, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Hello, Timothy writes: > This time, I'm wanting to be able to use the lovely org latex preview functionality for more than just the default blocks. > For instance, I'm interested in applying it to mhchem \ce{ … } > fragments, as well as siunitx \SI{ … }{ … }. I think you can preview \ce{...} just fine, with appropriate LaTeX headers. > I thought modifying org-latex-regexps may do the trick, yet despite > trying a few different things, I was confused when unable to get it to > work. It looks like I'm being confounded by the fact that > org-format-latex doesn't even reference org-latex-regexps, and instead > uses it's own hard-coded regexps. > Hopefully it may be possible to tweak this so that once can preview > more than just the defaults hardcoded into org-format-latex. This should not be possible. Org cannot recognize all LaTeX syntax. If you cannot preview it, Org does not understand it. IOW, it would be a poor experience if you preview something that doesn't exist, e.g., upon exporting the document. OTOH, nothing prevents an external library to allow previewing any LaTeX code (probably re-using AucTeX facilities). Regards, -- Nicolas Goaziou