LaTeX text overlays

Can anyone tell me how to render text in LaTeX format using ViewportOverlays?

Currently using painter.drawText() to render text labels but want them to be formatted using LaTeX so I can display equations.

I’m afraid using LaTeX in the text string is not possible. However, you do have the option to apply some formatting through HTML markup elements and CSS attributes.
https://www.ovito.org/docs/current/reference/viewports/layers/text_label_layer.html#viewport-layers-text-label-text-formatting
https://doc.qt.io/qt-6/richtext-html-subset.html

Okay, thank you.

We have developed a Python viewport layer to render LaTex formatted text in OVITO Pro. It can be found on GitHub or installed directly.

ovitos -m pip install --user git+https://github.com/ovito-org/LaTeXTextOverlay

  • Other Python interpreters or Conda environments:
pip install git+https://github.com/ovito-org/LaTeXTextOverlay

Here is an example image: