The LaTeX
pane enables rendering LaTeX equations as HTML using either the KaTeX or MathJax renderer.
You must load the desired renderer manually (e.g., pn.extension('katex')
or pn.extension('mathjax')
). If both are loaded, KaTeX is used by default.
Please note that both KaTeX and MathJax support only a subset of the features available in a full LaTeX renderer. For detailed information on supported features, refer to their respective documentation.
Parameters:
For details on additional options for customizing the component, refer to the layout and styling how-to guides.
object
(str or object): A string containing LaTeX code, an object with a_repr_latex_
method, or a SymPy expression.renderer
(object): The current renderer; must be one of the available options.styles
(dict): A dictionary specifying CSS styles.
A LaTeX
pane will render any object with a _repr_latex_
method, SymPy expressions, or any string containing LaTeX. Any LaTeX content should be wrapped in $...$
or \(...\)
delimiters, for example:
Its important to prefix your LaTeX strings with an r
to make the string a raw string and not escape the \ character.
The LaTeX
pane can be updated like other panes:
Lets change it back:
If both renderers have been loaded we can override the default renderer:
And can also be composed like any other pane:
Controls
The LaTeX
pane exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:
Sympy
Panels LaTeX pane can render Sympy expressions as shown below: