2

Using the answer from prosseek here:

Making table width fit into text width

I was able to shrink my table to the textwidth. Unfortunately when I do this the lines between the column headers are no longer aligned with the lines below them?

How can I fix this?

\documentclass{report}
\usepackage{tabulary}

\begin{document}

I want a table that is the same width as the text I'm using tabulary and that has shrunk the table however the lines between the column headers are no longer properly aligned with the lines below then between the columns.


\renewcommand{\baselinestretch}{1.0}\normalsize
\begin{table}[!h]
\footnotesize
\centering
\begin{tabulary}{1.0\textwidth}{CCCC|C|CCCC|CC}
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 1 and 2} \\
\cline{1-11}
A     & L_{t-1} & S_{t-1} & C_{t-1}  & $\mu$ & Q&L_{t}& S_{t}  & C_{t}  & $\lambda$ & H   \\
\hline
L_t   & 1.031    & 0    & 0    & 6.02 & L_t  & 0.077  & 0      & 0      &  0.123&  0.017\\
  & ()       &      &      & ()   &      &(0.021) &        &        &(0.005)& (0.002)\\
S_t   & 0    & 0.910    & 0    & -0.02& S_t  & 0      & 0.720  & 0      &       &\\
  &      & 0.037)   &      & ()   &      &        & (0.059)&        &       & \\
C_t   & 0    & 0    & 0.681    & 0.28 &C_t   & 0      &  0     &  2.130 &       & \\
  &      &      & (0.070)  & ()   &      &        &        & (0.107)&       & \\
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 2 and 3} \\
\cline{1-11}
A     & L_{t-1} & S_{t-1} & C_{t-1}  & $\mu$ & Q&L_{t}& S_{t}  & C_{t}  & $\lambda$ & H   \\
\hline
L_t   & 1.031    & 0    & 0    & 6.02 & L_t  & 0.077  & 0      & 0      &  0.123&  0.017\\
  & ()       &      &      & ()   &      &(0.021) &        &        &(0.005)& (0.002)\\
S_t   & 0    & 0.910    & 0    & -0.02& S_t  & 0      & 0.720  & 0      &       &\\
  &      & 0.037)   &      & ()   &      &        & (0.059)&        &       & \\
C_t   & 0    & 0    & 0.681    & 0.28 &C_t   & 0      &  0     &  2.130 &       & \\
  &      &      & (0.070)  & ()   &      &        &        & (0.107)&       & \\
\hline
\end{tabulary}
\caption{Results of the Maximum Likelihood Estimation for splits 1-4}
\label{table:param3}
\end{table}  
\renewcommand{\baselinestretch}{1.50}\normalsize


\end{document}
  • 1
    You have used the _ like (S_t) every where without math mode (i.e., $..$). Please enclose all of them with dollars $ so that we need not do that job. – user11232 Sep 26 '15 at 13:35
1

I was lazy to put all those $s so I created a new column. But you have to use $ when you write L_t etc.

\documentclass{report}
\usepackage{tabulary}
\newcolumntype{M}{>{$}C<{$}}

\begin{document}

I want a table that is the same width as the text I'm using tabulary and that has shrunk the table however the lines between the column headers are no longer properly aligned with the lines below then between the columns.


\renewcommand{\baselinestretch}{1.0}\normalsize
\begin{table}[!h]
\footnotesize
\centering
\begin{tabulary}{1.0\textwidth}{MMMM|M|MMMM|MM}
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 1 and 2} \\
\cline{1-11}
A     & L_{t-1} & S_{t-1} & C_{t-1}  & \mu & Q&L_{t}& S_{t}  & C_{t}  & \lambda & H   \\
\hline
L_t   & 1.031    & 0    & 0    & 6.02 & L_t  & 0.077  & 0      & 0      &  0.123&  0.017\\
  & ()       &      &      & ()   &      &(0.021) &        &        &(0.005)& (0.002)\\
S_t   & 0    & 0.910    & 0    & -0.02& S_t  & 0      & 0.720  & 0      &       &\\
  &      & 0.037)   &      & ()   &      &        & (0.059)&        &       & \\
C_t   & 0    & 0    & 0.681    & 0.28 &C_t   & 0      &  0     &  2.130 &       & \\
  &      &      & (0.070)  & ()   &      &        &        & (0.107)&       & \\
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 2 and 3} \\
\cline{1-11}
A     & L_{t-1} & S_{t-1} & C_{t-1}  & \mu & Q&L_{t}& S_{t}  & C_{t}  & \lambda & H   \\
\hline
L_t   & 1.031    & 0    & 0    & 6.02 & L_t  & 0.077  & 0      & 0      &  0.123&  0.017\\
  & ()       &      &      & ()   &      &(0.021) &        &        &(0.005)& (0.002)\\
S_t   & 0    & 0.910    & 0    & -0.02& S_t  & 0      & 0.720  & 0      &       &\\
  &      & 0.037)   &      & ()   &      &        & (0.059)&        &       & \\
C_t   & 0    & 0    & 0.681    & 0.28 &C_t   & 0      &  0     &  2.130 &       & \\
  &      &      & (0.070)  & ()   &      &        &        & (0.107)&       & \\
\hline
\end{tabulary}
\caption{Results of the Maximum Likelihood Estimation for splits 1-4}
\label{table:param3}
\end{table}
\renewcommand{\baselinestretch}{1.50}\normalsize


\end{document}

enter image description here

1

You could employ a basic tabular* environment to get the job done, as there seems to be no need for the line-wrapping capabilities of the tabulary environment. The column type C is set to render its contents in math mode automatically.

By the way, it's not a very good idea to manipulate the low-level macro \baselinestretch directly. Instead, consider loading the \setspace package and issuing the instruction \setstretch{1.5} (or some other desired value). If nothing else, this method will relieve you from having to remember to set and reset the \baselinestretch macro before and after each table environment.

enter image description here

\documentclass{article}
\usepackage{array,setspace,booktabs}
\newcolumntype{C}{>{$}c<{$}}  % math-mode center-set column
\begin{document}

\setstretch{1.5}  % don't modify the low-level parameter '\baselinestretch' directly

I was able to shrink my table to the textwidth. Unfortunately when I do this the lines between the column headers are no longer aligned with the lines below them?

\begin{table}[!ht]
\footnotesize
\setlength\tabcolsep{0pt}  % let "tabular*" env. determine the intercolumn widths
\begin{tabular*}{\textwidth}{C@{\extracolsep{\fill}}CCC|C|CCCC|CC}
\hline
\addlinespace
\multicolumn{11}{l}{Parameter Estimates Subset 1 and 2} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & \mu & Q &L_{t}& S_{t} & C_{t} & \lambda & H \\
\hline
L_t   & 1.031    & 0    & 0    & 6.02 & L_t  & 0.077  & 0      & 0      &  0.123&  0.017\\
  & ()       &      &      & ()   &      &(0.021) &        &        &(0.005)& (0.002)\\
S_t   & 0    & 0.910    & 0    & -0.02& S_t  & 0      & 0.720  & 0      &       &\\
  &      & (0.037)   &      & ()   &      &        & (0.059)&        &       & \\
C_t   & 0    & 0    & 0.681    & 0.28 &C_t   & 0      &  0     &  2.130 &       & \\
  &      &      & (0.070)  & ()   &      &        &        & (0.107)&       & \\
\hline
\addlinespace
\multicolumn{11}{l}{Parameter Estimates Subset 2 and 3} \\
\cline{1-11}
A     & L_{t-1} & S_{t-1} & C_{t-1}  & \mu & Q&L_{t}& S_{t}  & C_{t}  & \lambda & H   \\
\hline
L_t   & 1.031    & 0    & 0    & 6.02 & L_t  & 0.077  & 0      & 0 &  0.123&  0.017\\
  & ()       &      &      & ()   &      &(0.021) &        &        &(0.005)& (0.002)\\
S_t   & 0    & 0.910    & 0    & -0.02& S_t  & 0      & 0.720  & 0      &       &\\
  &      & (0.037)   &      & ()   &      &        & (0.059)&        &       & \\
C_t   & 0    & 0    & 0.681    & 0.28 &C_t   & 0      &  0     &  2.130 &       & \\
  &      &      & (0.070)  & ()   &      &        &        & (0.107)&       & \\
\hline
\end{tabular*}
\caption{Results of the Maximum Likelihood Estimation for splits 1--4}
\label{table:param3}
\end{table}  

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.