smpl.latex
Simplified latex.
|
Get number with uncertainty and unit in |
|
Get array |
|
Get arrays of (uncertainty) numbers in a latex table compatible form. |
|
Transposed |
Functions
- smpl.latex.si(s, u='', fmt='{}')[source]
Get number with uncertainty and unit in
siformat 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}'
- smpl.latex.si_line(a, skip=0, fmt='{}')[source]
Get array
ain the format of a line of a latex table.Examples
>>> si_line([1,2,3,]) '\\SI{1}{}&\\SI{2}{}&\\SI{3}{}\\\\\n'
- smpl.latex.si_tab(tab, skip=0, fmt='{}')[source]
Get arrays of (uncertainty) numbers in a latex table compatible form.
- Parameters
- tabarray_like
Array containing the values of the table
- skipnumber
Skip this many table lines
- fmtstr
format string for the numbers
- Returns
- str
Examples
>>> si_tab([[1,2],[3,4]]) '\\SI{1}{}&\\SI{2}{}\\\\\n\\SI{3}{}&\\SI{4}{}\\\\\n'
- smpl.latex.si_ttab(tab, skip=0, fmt='{}')[source]
Transposed
si_tab().- Parameters
- tabarray_like
Array containing the values of the table
- skipnumber
Skip this many table lines
- fmtstr
format string for the numbers
- Returns
- tabstrstr
table latex string
Examples
>>> si_ttab([[1,2],[3,4]]) '\\SI{1}{}&\\SI{3}{}\\\\\n\\SI{2}{}&\\SI{4}{}\\\\\n'