1

I am having trouble getting the last column of my Latex table to fit in landscape orientation. This is my setup and code for the relevant table -

\documentclass[12 pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{lscape}
\usepackage{graphicx}
\usepackage{titling}
\usepackage{geometry}

\newgeometry{left=1cm,top=1cm}
\begin{landscape}
\begin{table}[!t]
\scriptsize
\caption{Block Group-Level Bivariate Correlations}
\vspace{0.1 cm}
\label{tab:my-table}
%\setlength{\tabcolsep}{6 pt}
\begin{tabular}{@{}lcccccccccl@{}}
\midrule 
 &
  OD &
  PB &
  PA &
  PI &
  PH &
  PD &
  MHI &
  PCI &
  RD &
  TC\\\midrule
Outage Density          & 1.0000*   &          &          &          &          &          &          &        &        &        \\
Perc.Black           & 0.0998*   & 1.0000*   &          &          &          &          &        &        &        &        \\
Perc.Asian           & -0.0235  & -0.1256* & 1.0000*   &          &          &          &        &        &        &        \\
Perc.Indian         & -0.0014 & -0.0611* & -0.0532 & 1.0000*   &          &          &        &        &        &        \\
Perc.Hispanic        & 0.1454*   & -0.2851* & -0.3419* & 0.0924*  & 1.0000*   &          &        &        &        &        \\
Pop. Density      & 0.6311*  & -0.0246  & 0.0662*  & -0.0133  & 0.1910*  & 1.0000*   &        &        &        &        \\
MHI & -0.1993* & -0.3522* & 0.2080*  & -0.0472*  & -0.5208* & -0.2086* & 1.0000* &        &        &        \\
PCI       & -0.0703*  & -0.3080* & 0.2240* & -0.0439* & -0.5808* & -0.1494* & 0.8648 & 1.0000* &        &        \\
Road Distance       & -0.1592* & -0.0408  & -0.0146  & 0.0329   & -0.1430* & -0.0886* & 0.1221* & 0.0255 & 1.0000*        & \\
Tree Cover        & -0.3583* & 0.0063 & -0.0725* & 0.0149 & -0.2040* & -0.3180* & 0.1519* & 0.1002* & 0.2777* & 1.0000* \\ \bottomrule
\end{tabular}
\end{table}

I wish to add a column titled AOD after the first column titled OD, and a row similarly after the first row. The additional row is not the problem, the column is. When I do this, the last column TC gets automatically moved to the next row. I have tried restricting table width to text width, and I have tried changing the font to tiny, but neither worked. It seemed as if the last column always got shifted even when there was so much space at the top (which is the right of the table, in landscape). I then tried changing the margins, as seen in the code above. That didn't help.

Problematic Table

6
  • Welcome to TeX.SE. If you add a column in the body of the tabular environment, you need to add add a column-type specifier in the argument of \begin{tabular}.
    – Mico
    Commented Apr 25, 2020 at 5:41
  • Off-topic: It looks like you're trying to display a table of correlation coefficients, with asterisks denoting correlations that are significantly different from 0. If that's the case, please replace all instances of 1.0000* with just 1. All variables (and even constants!) are always perfectly correlated with themselves. It is meaningless to assign a statistical significance to a correlation of 1.
    – Mico
    Commented Apr 25, 2020 at 5:46
  • @AkshayKalyan did you see the answer
    – js bibra
    Commented Apr 25, 2020 at 6:30
  • Thank you @jsbibra for your answer. It worked for me. Commented Apr 26, 2020 at 5:34
  • @Mico, thanks for your responses too. Very helpful! Commented Apr 26, 2020 at 5:37

1 Answer 1

0

I have added the column only since that was the problem part -- see if it meets the requirement - please revert if there is a problem

enter image description here

\documentclass[12 pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{lscape}
\usepackage{graphicx}
\usepackage{titling}
\usepackage{geometry}

\newgeometry{left=1cm,top=1cm}


\begin{document}


\begin{landscape}
\begin{table}[!t]
\scriptsize
\caption{Block Group-Level Bivariate Correlations}
\vspace{0.1 cm}
\label{tab:my-table}
%\setlength{\tabcolsep}{6 pt}
\begin{tabular}{@{}lccccccccccl@{}}
\midrule 
 &  OD & AOD& PB &   PA &  PI &  PH &   PD &   MHI &   PCI &  RD &  TC\\\midrule
Outage Density          & 1.0000*& X  &          &          &          &          &          &          &        &        &        \\
Perc.Black           & 0.0998*   & X&1.0000*   &          &          &          &          &        &        &        &        \\
Perc.Asian           & -0.0235  & X&-0.1256* & 1.0000*   &          &          &          &        &        &        &        \\
Perc.Indian         & -0.0014 & X&-0.0611* & -0.0532 & 1.0000*   &          &          &        &        &        &        \\
Perc.Hispanic        & 0.1454*   &X& -0.2851* & -0.3419* & 0.0924*  & 1.0000*   &          &        &        &        &        \\
Pop. Density      & 0.6311*  &X &-0.0246  & 0.0662*  & -0.0133  & 0.1910*  & 1.0000*   &        &        &        &        \\
MHI & -0.1993* &X &-0.3522* & 0.2080*  & -0.0472*  & -0.5208* & -0.2086* & 1.0000* &        &        &        \\
PCI       & -0.0703*  &X &-0.3080* & 0.2240* & -0.0439* & -0.5808* & -0.1494* & 0.8648 & 1.0000* &        &        \\
Road Distance       & -0.1592* &X& -0.0408  & -0.0146  & 0.0329   & -0.1430* & -0.0886* & 0.1221* & 0.0255 & 1.0000*        & \\
Tree Cover        & -0.3583* &X&     0.0063 & -0.0725* & 0.0149 & -0.2040* & -0.3180* & 0.1519* & 0.1002* & 0.2777* & 1.0000* \\ \bottomrule
\end{tabular}
\end{table}
\end{landscape}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .