2

I have a table that has a 11 columns. I have one word in the top column with a subscript that seems to be going out of its box. is there any way to fix it?

i tried to use \tiny with the subscript, use tabularx and supertabular environments but nothing seems to be working yet. it still spills out of the cell.

\documentclass{article}
\usepackage{latexsym}

\begin{document}
\begin{table}[htbp]
\begin{scriptsize}
\begin{center}
\begin{tabular}{p{1.5cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}}
\hline
& 
(1)& (2)& (3)& (4)& (5)& (6)& (7)& (8)& (9)& (10) \\
\hline
 & 
\multicolumn{5}{|p{222pt}|}{\textbf{Historical stock market development from 1913 to 1960 [col. (1) to (5)]}} & 
\multicolumn{5}{|p{220pt}|}{\textbf{Recent stock market development from 1991 to 2007 [col. (6) to (10)]}} \\
\hline
Dep. Var. $=$ stock market capitalization to GDP (\textit{MCY})& 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1913-1960}$;$_{\, }\Delta $\textit{State} is from 51-1900 & 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1913-\, 1960}$;$_{\, }\Delta $\textit{State} is from 501-1900 & 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1913-\, 1960}$;$_{\, }\Delta $\textit{State} is from 1001-1900 & 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1913-\, 1960}$;$_{\, }\Delta $\textit{State} is from 1501-1900 & 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1913-\, 1960}$;$_{\, }\Delta $\textit{State} is from 1851-1900 & 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1991-2007}$;$_{\, }\Delta $\textit{State} is from 51-1950& 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1991-2007}$;$_{\, }\Delta $\textit{State} is from 501-1950& 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1991-2007}$;$_{\, }\Delta $\textit{State} is from 1001-1950& 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1991-2007}$;$_{\, }\Delta $\textit{State} is from 1501-1950& 
Dep. Var. $= \quad \Delta $\textit{MCY}$_{1991-2007}$;$_{\, }\Delta $\textit{State} is from 1901-1950 \\
\hline
$\Delta $\textit{State}& 
-0.223 \newline
 (-0.125)& 
3.178 \newline
(1.456)& 
5.650 \newline
(1.656)& & & & & & & &
\hline
\end{tabular}
\label{tab1}
\end{center}
\end{scriptsize}
\end{table}
\end{document}
2
  • Please add used \documentclass{...} and preamble relating to your table.
    – Zarko
    Feb 23, 2017 at 4:03
  • your table is far to wide that it can be fit on page. You really need to reconsider about table design. Most of content are repeating and can be part of table caption or common for group of columns. It seems that some of text in cells can be explained in table footnotes, i.e. see if threeparttable can help you in this. Sorry, but table as is in present form is not readable at all.
    – Zarko
    Feb 23, 2017 at 4:41

1 Answer 1

2

I suggest to redesign your table in something like this:

Edit: AsMico pointed in his comment below,. the determination of \multicolumn with in the first version of answer with \newcommand\mcx[1]{\multicolumn{5}{>{\hsize=6\hsize}C}{\bfseries#1}} is bit mysterious ... The following changes of code (hopefully) is more consistent and also gives better result:

\newlength\lengthx % basic column width
\setlength{\lengthx}{\dimexpr0.091\textwidth-2\tabcolsep-1.25\arrayrulewidth\relax}
\newlength\lengtha % width of five-columm multicolumn
\setlength{\lengtha}{\dimexpr5\lengthx+10\tabcolsep+5\arrayrulewidth\relax}
\newcommand\mcx[1]{\multicolumn{5}{@{}>{\centering\arraybackslash}p{\lengtha}@{}}{\bfseries#1}}

In this change are defined two new lengths: \lengthx, which is the width of one column without tabcolsep and part of arrayrulewidth, and \lengtha which determine width of 5 columns. This, on the first sight complicated solution, is necessary that p{\lengtha} can exploit for its cell contents all available space of five C (or X) type columns.

Considering this changes, the table become

enter image description here

\documentclass{article}
\usepackage[margin=25mm]{geometry}

\usepackage{booktabs, multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newlength\lengthx % basic column width
\setlength{\lengthx}{\dimexpr0.091\textwidth-2\tabcolsep-1.25\arrayrulewidth\relax}
\newlength\lengtha % width of five-columm multicolumn
\setlength{\lengtha}{\dimexpr5\lengthx+10\tabcolsep+5\arrayrulewidth\relax}
\newcommand\mcx[1]{\multicolumn{5}{@{}>{\centering\arraybackslash}p{\lengtha}@{}}{\bfseries#1}}

\usepackage{showframe}% only for showing page layout, in the real application had to be removed
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}
    \begin{table}%[htbp]
\caption{Dep. Var. $=$ stock market capitalization to GDP (\textit{MCY})}
\label{tab1}
    \small
    \centering
\begin{tabularx}{\textwidth}{@{}X *{10}{C}@{}}
    \toprule
    & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) & (10)    \\
    \cmidrule(r){2-6}\cmidrule(l){7-11}
    & \mcx{Historical stock market development from 1913 to 1960 [col. (1) to (5)]\newline\normalfont
    Dep. Var. $= \Delta \textit{MCY}_{1913-1960}$;%\newline
    $_{\, }\Delta $\textit{State} is from years:}
        & \mcx{Recent stock market development from 1991 to 2007 [col. (6) to (10)] \newline\normalfont
        Dep. Var. $= \Delta $\textit{MCY}$_{1991-2007}$;%\newline
        $_{\, }\Delta $\textit{State} is from years:} \\
    \cmidrule(r){2-6}\cmidrule(l){7-11}
    & 51   -- 1900 
    & 501  -- 1900 
    & 1001 -- 1900 
    & 1501 -- 1900 
    & 1851 -- 1900 
    & 51   -- 1950
    & 501  -- 1950
%
    & 1001 -- 1950
    & 1501 -- 1950
    & 1901 -- 1950 \\
    \midrule
\multirow{2}*{$\Delta$ \textit{State}}
    &   ~~$-0.223$ $(-0.125)$
    &   3.178  (1.456)
    &   5.650  (1.656)
    & & & & & & &   \\ 
    \bottomrule
\end{tabularx}
    \end{table}
\end{document}
6
  • 1
    @Mico, yes, it is very mysterious ... unfortunately your suggestion doesn't work. Right solution is : calculate width of X column without tabcolsep, define this as new length and than use it inp{...}. About this I had while ago discussion with some one ... but now I cannot remember exactly when and whom .(
    – Zarko
    Feb 23, 2017 at 10:04
  • @Mico, I found our discussion about this problem: tex.stackexchange.com/questions/342350. I edit my answer in spirit of finding there.
    – Zarko
    Feb 23, 2017 at 11:14
  • Good memory! (I had completely forgotten about this posting...)
    – Mico
    Feb 23, 2017 at 11:46
  • @Mico, oh, about memory ... as people in my place like to say (literally translated): "My memory is like Swiss cheese: a lot of hols ... " . but some times I have bright moments :-)
    – Zarko
    Feb 23, 2017 at 12:00
  • those little dashes in the table are all hyphens, except for the ones in the subscripts. they should really be en-dashes for spans, and minus signs for values. the ones in the subscripts look okay, but they are minus signs although they should really be en-dashes. (apologies for being such a fussbudget.) Feb 23, 2017 at 15:58

You must log in to answer this question.

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