qnet.printing.latexprinter module

Routines for rendering expressions to LaTeX

Summary

Classes:

QnetLatexPrinter Printer for a LaTeX representation.

Functions:

render_latex_sub_super Assemble a string from the primary name and the given sub- and superscripts.

Reference

class qnet.printing.latexprinter.QnetLatexPrinter(cache=None, settings=None)[source]

Bases: qnet.printing.asciiprinter.QnetAsciiPrinter

Printer for a LaTeX representation.

See qnet.printing.latex() for documentation of settings.

sympy_printer_cls

alias of qnet.printing.sympy.SympyLatexPrinter

printmethod = '_latex'
qnet.printing.latexprinter.render_latex_sub_super(name, subs=None, supers=None, translate_symbols=True, sep=', ')[source]

Assemble a string from the primary name and the given sub- and superscripts:

>>> render_latex_sub_super(name='alpha', subs=['mu', 'nu'], supers=[2])
'\\alpha_{\\mu,\\nu}^{2}'

>>> render_latex_sub_super(
...     name='alpha', subs=['1', '2'], supers=['(1)'], sep='')
'\\alpha_{12}^{(1)}'
Parameters:
  • name (str) – the string without the subscript/superscript
  • subs (list or None) – list of subscripts
  • supers (list or None) – list of superscripts
  • translate_symbols (bool) – If True, try to translate (Greek) symbols in name, `subs, and supers to unicode
  • sep (str) – Separator to use if there are multiple subscripts/superscripts