smpl.latex.si

smpl.latex.si(s, u='', fmt='{}')[source]

Get number with uncertainty and unit in si format for latex.

Parameters

sufloat

number to be returned in a latex compatible format.

ustr

unit of that number.

fmtstr

format string for the numbers.

Returns

str

latex SI string of the number with it’s uncertainty and unit.

Examples

>>> import uncertainties as unc
>>> from smpl import io
>>> si(unc.ufloat(2000,0.1))
'\\SI{2000.00+-0.10}{}'
>>> si(unc.ufloat(2000,0.1),"\\meter")
'\\SI{2000.00+-0.10}{\\meter}'
>>> si(unc.ufloat(2000,0.1),"\\meter", io.gf(2))
'\\SI{2.0+-0.0e+03}{\\meter}'
Parameters:
  • u (str) –

  • fmt (str) –