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])

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_headingsNone, dict

optional dictionary of custom table headings

col_headings_formattedlist

formatted column headings

rowslist of lists of cell-strings

Data in the table, pre-formatted

specdict

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

datastring

string representation of cell content

labelstring

optional cell label, used for tooltips

specdict

options for the formatters

Returns

string

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

Convert a python list to latex tabular column.

Parameters

llist

list to convert into latex. sub-items pre formatted

specsdictionary

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

vnumpy array

1D array to convert into latex.

specsdictionary

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

mnumpy array

2D array to convert into latex.

specsdictionary

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

elfloat or complex

Value to convert into latex.

specsdictionary

Dictionary of user-specified and default parameters to formatting

mathmodebool, 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

txtstring

value to escape

specsdictionary

Dictionary of user-specified and default parameters to formatting

Returns

string