pygsti.report.latex

Routines for converting python objects to latex.

Parallel rountines as html.py has for HTML conversion.

Module Contents

Functions

table(custom_headings, col_headings_formatted, rows, spec)

Create a LaTeX table

cell(data, label, spec)

Format the cell of a latex table

list(l, specs)

Convert a python list to latex tabular column.

vector(v, specs)

Convert a 1D numpy array to latex.

matrix(m, specs)

Convert a 2D numpy array to latex.

value(el, specs, mathmode=False)

Convert a floating point or complex value to latex.

escaped(txt, specs)

Escape txt so it is latex safe.

pygsti.report.latex.table(custom_headings, col_headings_formatted, rows, spec)

Create a LaTeX table

Parameters
  • custom_headings (None, dict) – optional dictionary of custom table headings

  • col_headings_formatted (list) – formatted column headings

  • rows (list of lists of cell-strings) – Data in the table, pre-formatted

  • spec (dict) – options for the formatter

Returns

dict (contains key ‘latex’, which corresponds to a latex string representing the table)

pygsti.report.latex.cell(data, label, spec)

Format the cell of a latex table

Parameters
  • data (string) – string representation of cell content

  • label (string) – optional cell label, used for tooltips

  • spec (dict) – options for the formatters

Returns

string

pygsti.report.latex.list(l, specs)

Convert a python list to latex tabular column.

Parameters
  • l (list) – list to convert into latex. sub-items pre formatted

  • specs (dictionary) – Dictionary of user-specified and default parameters to formatting

Returns

string – latex string for l.

pygsti.report.latex.vector(v, specs)

Convert a 1D numpy array to latex.

Parameters
  • v (numpy array) – 1D array to convert into latex.

  • specs (dictionary) – Dictionary of user-specified and default parameters to formatting

Returns

string – latex string for v.

pygsti.report.latex.matrix(m, specs)

Convert a 2D numpy array to latex.

Parameters
  • m (numpy array) – 2D array to convert into latex.

  • specs (dictionary) – Dictionary of user-specified and default parameters to formatting

Returns

string – latex string for m.

pygsti.report.latex.value(el, specs, mathmode=False)

Convert a floating point or complex value to latex.

Parameters
  • el (float or complex) – Value to convert into latex.

  • specs (dictionary) – Dictionary of user-specified and default parameters to formatting

  • mathmode (bool, optional) – Whether this routine should assume that math-mode is already enabled and output is free to contain math-mode instructions. When False, whenever math-mode instructions are needed the output is wrapped in an ‘ensuremath’ block.

Returns

string – latex string for el.

pygsti.report.latex.escaped(txt, specs)

Escape txt so it is latex safe.

Parameters
  • txt (string) – value to escape

  • specs (dictionary) – Dictionary of user-specified and default parameters to formatting

Returns

string