'How to position LaTeX table in Overleaf

I have a correlation matrix output in R, when I paste it Overleaf the table is too far to the right and some values are missing. I have the same issue with other tables as well, how can I fix this? The code for this matrix is the following

\begin{table}[ht]
\centering
\begin{tabular}{rllllllllllllll}
  \hline
 & avsumarwinsorized & FE & dispstd & winsorizedNetOptLM & roa & roastd & RETURN & MV & beta & BTM & lognoa & winsmin & winsmax & winsmean \\ 
  \hline
avsumarwinsorized &  1.000  & -0.017*  & -0.018*  &  0.068*** & -0.005  & -0.011  &  0.002  & -0.014  & -0.017*  & -0.008  & -0.010  &  0.019*  &  0.003  &  0.019*  \\ 
  FE & -0.026*** &  1.000  &  0.582*** & -0.205*** & -0.298*** &  0.290*** & -0.205*** & -0.351*** &  0.186*** &  0.358*** & -0.243*** & -0.089*** & -0.050*** & -0.091*** \\ 
  dispstd & -0.025**  &  0.557*** &  1.000  & -0.282*** & -0.444*** &  0.314*** & -0.338*** & -0.347*** &  0.230*** &  0.466*** & -0.153*** & -0.104*** & -0.057*** & -0.100*** \\ 
  winsorizedNetOptLM &  0.073*** & -0.067*** & -0.050*** &  1.000  &  0.285*** & -0.090*** &  0.246*** &  0.072*** & -0.021**  & -0.251*** &  0.032*** &  0.046*** & -0.092*** &  0.005  \\ 
  roa & -0.017*  & -0.068*** & -0.056*** &  0.160*** &  1.000  & -0.023**  &  0.284*** &  0.284*** & -0.145*** & -0.522*** &  0.177*** &  0.064*** &  0.022**  &  0.053*** \\ 
  roastd &  0.003  &  0.048*** &  0.034*** & -0.074*** & -0.359*** &  1.000  & -0.092*** & -0.263*** &  0.098*** & -0.064*** & -0.102*** & -0.103*** & -0.075*** & -0.118*** \\ 
  RETURN & -0.007  & -0.062*** & -0.049*** &  0.143*** &  0.156*** & -0.007  &  1.000  &  0.185*** &  0.065*** & -0.365*** &  0.029*** &  0.024**  &  0.027*** &  0.018*  \\ 
  MV & -0.014  & -0.020**  & -0.015*  &  0.003  &  0.077*** & -0.055*** &  0.001  &  1.000  & -0.207*** & -0.346*** &  0.672*** &  0.067*** &  0.177*** &  0.117*** \\ 
  beta & -0.019*  &  0.068*** &  0.038*** & -0.045*** & -0.054*** &  0.055*** &  0.131*** & -0.121*** &  1.000  &  0.150*** & -0.096*** & -0.036*** & -0.040*** & -0.042*** \\ 
  BTM & -0.015  & -0.075*** & -0.015  & -0.128*** & -0.107*** &  0.024**  & -0.134*** & -0.056*** &  0.081*** &  1.000  & -0.238*** & -0.100*** & -0.061*** & -0.088*** \\ 
  lognoa & -0.013  & -0.063*** & -0.028*** &  0.052*** &  0.096*** & -0.076*** & -0.023**  &  0.313*** & -0.093*** & -0.091*** &  1.000  &  0.048*** &  0.152*** &  0.093*** \\ 
  winsmin &  0.009  & -0.035*** & -0.023**  &  0.038*** &  0.036*** & -0.048*** &  0.006  & -0.012  & -0.038*** & -0.056*** &  0.060*** &  1.000  &  0.357*** &  0.925*** \\ 
  winsmax &  0.001  & -0.031*** & -0.011  & -0.087*** &  0.028*** & -0.016*  & -0.001  &  0.081*** & -0.052*** & -0.018*  &  0.152*** &  0.288*** &  1.000  &  0.550*** \\ 
  winsmean &  0.010  & -0.036*** & -0.024**  &  0.008  &  0.044*** & -0.056*** & -0.005  &  0.028*** & -0.049*** & -0.052*** &  0.104*** &  0.889*** &  0.513*** &  1.000  \\ 
   \hline
\end{tabular}
\end{table}

Screenshot of the table in Overleaf



Solution 1:[1]

No way a table this large will reasonable fit onto a page. Even with

  • abbreviating some of the verrrrrrrrry long variable names
  • reducing the margins of the paper
  • using a landscape paper

it will still need an unreadable small size to fit on the page:

\documentclass{article}

\usepackage[landscape,hmargin=1cm]{geometry}

\begin{document}

\begin{table}[ht]
\centering
\tiny
\begin{tabular}{rllllllllllllll}
  \hline
 & avs. & FE & dispstd & win. & roa & roastd & RETURN & MV & beta & BTM & lognoa & winsmin & winsmax & winsmean \\ 
  \hline
avs. &  1.000  & -0.017*  & -0.018*  &  0.068*** & -0.005  & -0.011  &  0.002  & -0.014  & -0.017*  & -0.008  & -0.010  &  0.019*  &  0.003  &  0.019*  \\ 
  FE & -0.026*** &  1.000  &  0.582*** & -0.205*** & -0.298*** &  0.290*** & -0.205*** & -0.351*** &  0.186*** &  0.358*** & -0.243*** & -0.089*** & -0.050*** & -0.091*** \\ 
  dispstd & -0.025**  &  0.557*** &  1.000  & -0.282*** & -0.444*** &  0.314*** & -0.338*** & -0.347*** &  0.230*** &  0.466*** & -0.153*** & -0.104*** & -0.057*** & -0.100*** \\ 
  win. &  0.073*** & -0.067*** & -0.050*** &  1.000  &  0.285*** & -0.090*** &  0.246*** &  0.072*** & -0.021**  & -0.251*** &  0.032*** &  0.046*** & -0.092*** &  0.005  \\ 
  roa & -0.017*  & -0.068*** & -0.056*** &  0.160*** &  1.000  & -0.023**  &  0.284*** &  0.284*** & -0.145*** & -0.522*** &  0.177*** &  0.064*** &  0.022**  &  0.053*** \\ 
  roastd &  0.003  &  0.048*** &  0.034*** & -0.074*** & -0.359*** &  1.000  & -0.092*** & -0.263*** &  0.098*** & -0.064*** & -0.102*** & -0.103*** & -0.075*** & -0.118*** \\ 
  RETURN & -0.007  & -0.062*** & -0.049*** &  0.143*** &  0.156*** & -0.007  &  1.000  &  0.185*** &  0.065*** & -0.365*** &  0.029*** &  0.024**  &  0.027*** &  0.018*  \\ 
  MV & -0.014  & -0.020**  & -0.015*  &  0.003  &  0.077*** & -0.055*** &  0.001  &  1.000  & -0.207*** & -0.346*** &  0.672*** &  0.067*** &  0.177*** &  0.117*** \\ 
  beta & -0.019*  &  0.068*** &  0.038*** & -0.045*** & -0.054*** &  0.055*** &  0.131*** & -0.121*** &  1.000  &  0.150*** & -0.096*** & -0.036*** & -0.040*** & -0.042*** \\ 
  BTM & -0.015  & -0.075*** & -0.015  & -0.128*** & -0.107*** &  0.024**  & -0.134*** & -0.056*** &  0.081*** &  1.000  & -0.238*** & -0.100*** & -0.061*** & -0.088*** \\ 
  lognoa & -0.013  & -0.063*** & -0.028*** &  0.052*** &  0.096*** & -0.076*** & -0.023**  &  0.313*** & -0.093*** & -0.091*** &  1.000  &  0.048*** &  0.152*** &  0.093*** \\ 
  winsmin &  0.009  & -0.035*** & -0.023**  &  0.038*** &  0.036*** & -0.048*** &  0.006  & -0.012  & -0.038*** & -0.056*** &  0.060*** &  1.000  &  0.357*** &  0.925*** \\ 
  winsmax &  0.001  & -0.031*** & -0.011  & -0.087*** &  0.028*** & -0.016*  & -0.001  &  0.081*** & -0.052*** & -0.018*  &  0.152*** &  0.288*** &  1.000  &  0.550*** \\ 
  winsmean &  0.010  & -0.036*** & -0.024**  &  0.008  &  0.044*** & -0.056*** & -0.005  &  0.028*** & -0.049*** & -0.052*** &  0.104*** &  0.889*** &  0.513*** &  1.000  \\ 
   \hline
\end{tabular}
\end{table}

\end{document}

Solution 2:[2]

There is two ways for such a large table

  1. Change the format to landscape
  2. User scalebox to reduce the size (everything will be small, doesn't worth as a solution)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 samcarter_is_at_topanswers.xyz
Solution 2 El-houcine Brahim