The most fancy way to write 2D array

I have something like

What's the best way to do it? I tried this method but it doesn't work.

\begin{array}{r}[[0.86455156], \\ [-0.82104237], \\ [4.12186079]]\end{array}


Getting,

• Is this code in math mode? Sep 30, 2020 at 21:06
• Yes, it's in math mode, I added the result in the answer Sep 30, 2020 at 21:11
• The error come from the fact that, in an array,\\ can take an optional argument. Replace it with \\{} Sep 30, 2020 at 21:32

1 Answer

Something like this?

This solution works in both text mode and math mode.

\documentclass{article} % or some other suitable document class
\usepackage{array}
\begin{document}
\begin{tabular}{@{} >{\ttfamily}r @{}}
[[ 0.86455156], \\ \relax
[-0.82104237], \\ \relax
[ 4.12186079]]
\end{tabular}
\end{document}