---
title: array_to_latex (v1.0)
description: API reference for qiskit.visualization.array_to_latex in qiskit v1.0
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/1.0/qiskit.visualization.array_to_latex
---

# qiskit.visualization.array\_to\_latex

`qiskit.visualization.array_to_latex(array, precision=10, prefix='', source=False, max_size=8)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.0/qiskit/visualization/array.py#L146-L204)

Latex representation of a complex numpy array (with dimension 1 or 2)

**Parameters**

- **array** (*ndarray*) – The array to be converted to latex, must have dimension 1 or 2 and contain only numerical data.

- **precision** ([*int*](https://docs.python.org/3/library/functions.html#int)) – For numbers not close to integers or common terms, the number of decimal places to round to.

- **prefix** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – Latex string to be prepended to the latex, intended for labels.

- **source** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If `False`, will return IPython.display.Latex object. If display is `True`, will instead return the LaTeX source string.

- **max\_size** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*(*[*int*](https://docs.python.org/3/library/functions.html#int)*) or* [*int*](https://docs.python.org/3/library/functions.html#int)) –

  The maximum size of the output Latex array.

  - If list(`int`), then the 0th element of the list specifies the maximum width (including dots characters) and the 1st specifies the maximum height (also inc. dots characters).
  - If a single `int` then this value sets the maximum width \_and\_ maximum height.

**Returns**

**If `source` is `True`, a `str` of the LaTeX**

representation of the array, else an `IPython.display.Latex` representation of the array.

**Return type**

[str](https://docs.python.org/3/library/stdtypes.html#str) or IPython.display.Latex

**Raises**

- [**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError) – If array can not be interpreted as a numerical numpy array.
- [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError) – If the dimension of array is not 1 or 2.
- [**MissingOptionalLibraryError**](/docs/api/qiskit/1.0/exceptions#qiskit.exceptions.MissingOptionalLibraryError "qiskit.exceptions.MissingOptionalLibraryError") – If `source` is `False` and `IPython.display.Latex` cannot be imported.
