Latex Module

You might read the user guide introduction of this module.

class maabara.latex.Table[source]

Generating Latex Tables

add_column(data, function=False, title='', dataformat='sigceil', precision=-1, exp='TRUE')[source]

Add a column to table

data : array_like
Data set
function : mixed

If False data will be added unchanged.

If String it sets instructions how to render data into each cell, e.g. example($0,1). $x will link to x. column of dataset.

Available functions:

num(value, deviation, dataformat, precision) : Number formating for Latex-output

num($0) – Format first column in data as number num($0,0.1) – Format numbers with constant uncertainty 0.1 num($0,$1) – Dynamic uncertainty from second column of data num($0,$1,{:L}) – Optional format for ufloat printing

``dataformat = ‘sigceil’ – will ceil the error and round the value on significant digits; default ``dataformat = ‘siground’ –will round the error and value on significant digits

``precision = int – can force the a significant digits
``precision == -1, default setting, significant digits will be computed
uc(ufloat, format) : Number formating alias
Like num function but with ufloat argument
lit(reference, value, deviation) : Compare to literature value, see literature_value()
lit(3.141, $0) – Compare with literature value of pi lit(3.141, $0,$1) – Compare including deviation
rnd(value, digits) : rounding
rnd($0,3) – round numbers in 3 digits

from uncertainty:

``ceiling(value, digit) same as math.round, but rounding to higher bound

from uncertainties:

uc.PDG_precision(value) uc.first_digit(value)

uc.PNG Note that num will be default if no function name was specified: $0,$1 will be interpreted as num($0,$1)

title : string, optional
Sets a column caption
c(data, function=False, title='')[source]

Alias of add_column()

dimensions(array_return=False)[source]

Returns a the dimensions of the current table data

array_return : boolean, optional
If True method will return and empty row and column array
out : mixed
By default method will return row and col count, if array_return two empty arrays with the corresponding dimensions are returned.
environment()[source]

Get Latex table environment markup

out : string header, string footer
Latex table environment header and footer
export(file)[source]

Saves Latex table markup to file

file : string
Filename
out : mixed
Latex \input command or False on failure
get_data()[source]

Get data

out : array
Data
latex(data=[])[source]

Get Latex table markup

data : array_like, optional
See set_data()
out : string
Latex table markup
no_environment()[source]

Disables Table environment. Export will result in table body only.

no_headline()[source]

Disables head row. Export won’t add headers to table columns.

reset()[source]

Clear all settings

out : boolean
True on success.
set_caption(caption)[source]

Set a Latex caption

set_cdot(boolean)[source]

set cdot instead of imes

set_data(data)[source]

Set data

data : array_like

out : boolean
True on success
set_label(label)[source]

Set a Latex label

set_mode(mode)[source]

Switch mode between rule and hline

set_placement(placement='[!htb]')[source]

Set a placement

placement : string, default [!htb]
Latex placement to align table.
out : boolean
True on success.