mplunitx.unit._unit_kw
- class _unit_kw(inter_unit_product='\\\\,', per_mode='power', per_symbol='/', bracket_unit_denominator=True, per_symbol_script_correction='\\\\!', sticky_per=False, parse_units=True, unit_font_command='\\\\mathrm')
Bases:
objectHandling of the options for the unit formatting.
This class is not intended to be used directly by the user. However, the user can change the options in sisetup.unit_kw by using the update method or setters.
- Attributes:
- inter_unit_product
python:str, default=r”\,” Character used to separate units.
- per_mode
python:str, default=”power” Mode for typesetting units with negative power. Must be one of
{"power", "fraction", "symbol", "single-symbol", "power-positive-first"}."power": Units are typeset with positive and negative powers."fraction": Units are typeset as a fraction using\frac."symbol": Units are typeset with a character between positive and negative powers (Default:"/", see per_symbol)."single-symbol": Units are typeset like"symbol"if there is only one unit with negative power. Otherwise powers are used."power-positive-first": Units are typeset like"power"but positive powers are typeset left of negative powers.- per_symbol
python:str, default=”/” Character between positive and negative powers when in
"symbol"or"single-symbol"mode.- bracket_unit_denominatorbool, default=True
If
Trueand in"symbol"mode encloses the units to the right of the symbol in brackets.- per_symbol_script_correction
python:str, default=r”\!” If the character before
per_symbolis a power, the space between the power and the symbol is corrected using the given string.- sticky_perbool, default=False
Not implemented yet.
- parse_unitsbool, default=True
If
Falsethe input string is returned as is.- unit_font_command
python:str, default=r”\mathrm” LaTeX command used to typeset units.
- inter_unit_product
Methods
update(kw)Update the unit_kw options with a dictionary.