arpes.plotting.utils.latex_escape

arpes.plotting.utils.latex_escape(text: str, force: bool = False) str[source]

Conditionally escapes a string based on the matplotlib settings.

If you need the escaped string even if you are not using matplotlib with LaTeX support, you can pass force=True.

Adjusted from suggestions at: https://stackoverflow.com/questions/16259923/how-can-i-escape-latex-special-characters-inside-django-templates

Parameters
  • text – The contents which should be escaped

  • force – Whether we should perform escaping even if matplotlib is not being used with LaTeX support.

Returns

The escaped string which should appear in LaTeX with the same contents as the original.