[Tex/LaTex] How to represent this data as a table

tables

I am trying to put this in a table inside my LaTeX document. How can I get this? CtrlK does it here but not sure how to do it in LaTeX.

               Left      Right     Bottom        Top   Diagonal
Left      0.1303394  0.1084274  0.2158028  0.1050394 -0.2093420
Right     0.1084274  0.1632741  0.2841319  0.1299967 -0.2404701
Bottom    0.2158028  0.2841319  2.0868781  0.1645389 -1.0369962
Top       0.1050394  0.1299967  0.1645389  0.6447234 -0.5496148
Diagonal -0.2093420 -0.2404701 -1.0369962 -0.5496148  1.3277163

Best Answer

I would use the siunitx package for its ability to align numbers on their decimal points and display minus signs correctly and the booktabs package for its ability to draw well-spaced horizontal rules.

I would also examine the rationale for show seven [7!] digits for all numbers. Rounding to four digits after the decimal marker should really be more than enough, right? Happily, the siunitx package can perform automatic rounding, as is demonstrated in the second table below.

enter image description here

\documentclass{article}
\usepackage{siunitx,booktabs}
\sisetup{group-digits=false}
\begin{document}
\begin{table}
\centering
\caption{This is my table}
\begin{tabular}{@{} l *{5}{S[table-format=-1.7]} @{}} 
\toprule
& {Left} & {Right} & {Bottom} & {Top} & {Diagonal}\\ % center-set header entries
\midrule
Left    &  0.1303394  & 0.1084274 &  0.2158028 &  0.1050394 & -0.2093420\\
Right   &  0.1084274  & 0.1632741 &  0.2841319 &  0.1299967 & -0.2404701\\
Bottom  &  0.2158028  & 0.2841319 &  2.0868781 &  0.1645389 & -1.0369962\\
Top     &  0.1050394  & 0.1299967 &  0.1645389 &  0.6447234 & -0.5496148\\
Diagonal& -0.2093420  &-0.2404701 & -1.0369962 & -0.5496148 &  1.3277163\\
\bottomrule
\end{tabular}

\bigskip

\sisetup{round-mode=places,round-precision=4} % switch on rounding
\caption{This is my table, this time with rounded numbers}
\begin{tabular}{@{} l *{5}{S[table-format=-1.4]} @{}} 
\toprule
& {Left} & {Right} & {Bottom} & {Top} & {Diagonal}\\ % center-set header entries
\midrule
Left    &  0.1303394  & 0.1084274 &  0.2158028 &  0.1050394 & -0.2093420\\
Right   &  0.1084274  & 0.1632741 &  0.2841319 &  0.1299967 & -0.2404701\\
Bottom  &  0.2158028  & 0.2841319 &  2.0868781 &  0.1645389 & -1.0369962\\
Top     &  0.1050394  & 0.1299967 &  0.1645389 &  0.6447234 & -0.5496148\\
Diagonal& -0.2093420  &-0.2404701 & -1.0369962 & -0.5496148 &  1.3277163\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Related Question