Skip to main content
`Ctrl`+`K`

# Latex

class astropy.units.format.Latex(*args, **kwargs)

  Bases: `Console`

  Output LaTeX to display the unit based on IAU style guidelines.

  Attempts to follow the IAU Style Manual.

  Attributes Summary

  `name` |

  Methods Summary

  `to_string`(unit[, fraction]) | Convert a unit to its string representation.

  Attributes Documentation

  name = 'latex'

  Methods Documentation

  classmethod to_string(unit, fraction='multiline')

    Convert a unit to its string representation.

    Implementation for `to_string`.

    Parameters:
      unit|Unit|

        The unit to convert.

      fraction{False|True|’inline’|’multiline’}, optional

        Options are as follows:

        - `False` : display unit bases with negative powers as they are (e.g., `km s-1`);

        - ‘inline’ or `True` : use a single-line fraction (e.g., `km / s`);

        - ‘multiline’ : use a multiline fraction if possible (available for the `latex`, `console` and `unicode` formats; e.g., `$\mathrm{\frac{km}{s}}$`). If not possible, use ‘inline’.

    Raises:
      `ValueError`

        If `fraction` is not recognized.