get_formatted_el

emmet.core.featurization.robocrys.util.get_formatted_el(element, sym_label, use_oxi_state=True, use_sym_label=True, fmt='raw')

Formats an element string.

Performs a variety of functions, including:

  • Changing “Sn+0” to “Sn”.

  • Inserting the symmetry label between the element and oxidation state, if

    required.

  • Removing the oxidation state if required.

  • Latexifying the element and oxidation state.

  • Unicodeifying the element and oxidation state.

  • Converting the element and oxidation state to html.

Args:
element: The element string (possibly including the oxidation state.

E.g. “Sn” or “Sn2+”.

sym_label: The symmetry label. E.g. “(1)” use_oxi_state: Whether to include the oxidation state, if present. use_sym_label: Whether to use the symmetry label. fmt: How to format the element strings. Options are:

  • “raw” (default): Don’t apply special formatting (e.g. “SnO2”).

  • “unicode”: Format super/subscripts using unicode characters (e.g. SnO₂).

  • “latex”: Use LaTeX markup for formatting (e.g. “SnO$_2$”).

  • “html”: Use html markup for formatting (e.g. “SnO<sub>2</sub>”).

Returns:

The formatted element string.

Parameters:
  • element (str)

  • sym_label (str)

  • use_oxi_state (bool)

  • use_sym_label (bool)

  • fmt (str)