LaTeX tools
Tools for LaTeX formatting
This module contains functions for formatting numbers, isotopes, etc.
It can be imported as ltx as following:
delta_iso(iso1, iso2, full=False)
Return LaTeX formatted string for delta notation of two isotopes.
Full label is, e.g., d(30Si/28Si). Short version is d30Si28.
Note: For short version (default) of the return it is assumed that all the both elements are the same.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iso1
|
str
|
Nominator isotope, e.g., "Si-30" |
required |
iso2
|
str
|
Denominator isotope, e.g., "Si-28" |
required |
full
|
Do you want a full label? Otherwise, short version used. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
LaTeX formatted label for delta value. Unit not included. |
Source code in src/rttools/latex.py
error_formatting(value, unc, prec)
Take a value and its uncertainty and express is as a formatted LaTeX string.
Scientific notation is assumed. As an example, if value is 0.0002153 and uncertainty is 0.00002, at a precision of 3 the formatted string would be: \((2.15 \pm 0.20) \times 10^{-4}\)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
Value to be given |
required |
unc
|
float
|
Uncertainty of the value |
required |
prec
|
int
|
Significant digits. |
required |
Returns:
| Type | Description |
|---|---|
str
|
LaTeX formatted string, see example above. |
Source code in src/rttools/latex.py
exp_notation(num, prec=2)
Take a number and return it in LaTeX exponential notation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num
|
float
|
Number itself. |
required |
prec
|
int
|
Precision. |
2
|
Returns:
| Type | Description |
|---|---|
str
|
LaTeX formatted string. |
Source code in src/rttools/latex.py
iso_transformer(iso)
Transform isotope from 46Ti notation to Ti-46 notation and vice verse.
Transformation direction is automatically determined by input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iso
|
str
|
Isotope as string |
required |
Returns:
| Type | Description |
|---|---|
|
iso, but in transformed notation |
Source code in src/rttools/latex.py
ratio_iso(iso1, iso2)
Return LaTeX formatted string for ratio of two isotopes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iso1
|
str
|
Nominator isotope, e.g., "Si-30" |
required |
iso2
|
str
|
Denominator isotope, e.g., "Si-28" |
required |
Returns:
| Type | Description |
|---|---|
str
|
LaTeX formatted label for isototope ratio. |
Source code in src/rttools/latex.py
split_iso(iso)
Split isotope string into element name and mass number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iso
|
str
|
Isotope name, e.g., "Si-28" |
required |
Returns:
| Type | Description |
|---|---|
Tuple[str, Union[int, str]]
|
Isotope name, mass number (as int if possible) |