MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / units2TeX

Function units2TeX

SLiCAP/SLiCAPmath.py:2401–2420  ·  view source on GitHub ↗

Returns units in LaTeX format, without opening and closing '$'. :param units: String representing an expression with units :type units: str :return: LaTeX code of 'units' without opening or closing tags. :rtype: str

(units)

Source from the content-addressed store, hash-verified

2399 return integratedResult
2400
2401def units2TeX(units):
2402 """
2403 Returns units in LaTeX format, without opening and closing '$'.
2404
2405 :param units: String representing an expression with units
2406 :type units: str
2407
2408 :return: LaTeX code of 'units' without opening or closing tags.
2409 :rtype: str
2410 """
2411 tex = " "
2412 if type(units) == str and units != '':
2413 replacements = {}
2414 replacements['Ohm'] = 'Omega'
2415 for key in replacements.keys():
2416 units = units.replace(key, replacements[key])
2417 for unitpart in units.split():
2418 tex += py2tex(unitpart, print_latex=False,
2419 print_formula=False, simplify_output=False)[2:-2] + " "
2420 return tex[:-1]
2421
2422def filterFunc(f_char, f_type, f_order, f_low=None, f_high=None, ripple=1):
2423 """

Callers 11

eqnMethod · 0.90
exprMethod · 0.90
eqnInlineMethod · 0.90
_TEXcreateCSVtableFunction · 0.90
expr2htmlFunction · 0.90
eqn2htmlFunction · 0.90
eqnMethod · 0.90
exprMethod · 0.90
eqnInlineMethod · 0.90
_RSTcreateCSVtableFunction · 0.90
_htmlLineMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected