0

I have created the following table following the suggestion here. I followed that link because I wanted to handle the variable names in the columns.

I want to insert some footnotes but sadly what I get is this:

enter image description here

The problem arises because of the long note at the bottom of the table. When I remove this note all are very nice. Like below:

enter image description here

So my question is how I can make a good table like the one shown above, but preserving a flexible length for footnotes as well as have the ability to use long names for each column.

Here is the MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{booktabs,tabularx,ragged2e,dcolumn,caption} 
\newcolumntype{C}{>{\Centering\arraybackslash \hspace{0pt}}X}
\newcolumntype{d}[1]{D{.}{,}{#1}}
% handy shortcut macros
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\MC[1]{\multicolumn{1}{C}{#1}}

\begin{document}
\begin{table}[H]
    \footnotesize
    \caption{Pension Fund Investments and Domestic Public Debt} \label{tab:paralela}
    \begin{tabularx}{\textwidth}{@{} l *{4}{d{2.4}} @{}}
        \toprule
        & \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} \\ 
        & \MC{Gov. Bond Investments (\% Total)} 
        & \MC{Gov. Bond Investments (\% GDP)} 
        & \MC{Value of Pension Funds Investments (\% GDP)} 
        & \MC{Domestic Public Debt (\% Total)} \\
        \midrule

AUT & 16.57 & 0.99  & 5.83   & 23.35 \\ 
GBR & 14.38 & 14.72 & 101.66 & 69.13 \\ 
HUN & 56.40 & 1.64  & 3.01   & 44.67 \\ 
ISL & 38.58 & 63.26 & 165.56 & 80.53 \\ 
LUX & 21.85 & 0.60  & 2.73   & 57.41 \\ 
NLD & 16.38 & 24.77 & 151.04 & 45.43 \\ 
PRT & 25.70 & 1.90  & 7.49   & 38.92 \\ 
SVK & 35.65 & 2.04  & 5.77   & 55.27 \\ 
SWE & 4.18  & 3.70  & 88.63  & 70.29 \\ 
USA & 13.14 & 16.80 & 128.17 & 63.91 \\ 
\hline
 Average & 24.28 & 13.04 & 65.99 & 54.9 \\
        \bottomrule
        \addlinespace
        \multicolumn{4}{@{}l}{\tiny Source: OECD Pension Statistics. OECD Data are sample averages from 2010 onwards.} \\ 
        \multicolumn{4}{@{}l}{\tiny Note 2 .............}
    \end{tabularx}
\end{table}
\end{document}
1
  • 1
    It is probably better to write a short name for each of those headers and explain/give the long name in a note, this makes it a lot easier to read. You might want to use the threeparttable package for table notes instead of this method. Also don't generally use the H specifier.
    – daleif
    Jan 3, 2018 at 12:52

2 Answers 2

1

if you chane note below table to:

    \bottomrule
    \addlinespace
    \multicolumn{5}{@{}p{\linewidth}}{\scriptsize 
    Source: OECD Pension Statistics. OECD Data are sample averages from 2010 onwards.\par
    Note 2 .............}

and reduce \tabcolsep to 3pt (with \setlength\tabcolsep{3pt}) you will obtain:

enter image description here

1

Here is a solution using the threeparttable package

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{threeparttable}
\usepackage{booktabs,tabularx,ragged2e,dcolumn,caption}
\usepackage{makecell} 
\newcolumntype{C}{>{\Centering\arraybackslash \hspace{0pt}}X}
\newcolumntype{d}[1]{D{.}{,}{#1}}
% handy shortcut macros
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\MC[1]{\multicolumn{1}{C}{#1}}

\begin{document}
\begin{table}
\begin{threeparttable}[b]
\caption{Pension Fund Investments and Domestic Public Debt} \label{tab:paralela}
    \begin{tabularx}{\textwidth}{@{} l *{4}{d{2.4}} @{}}
        \toprule
        & \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} \\ 
        & \MC{Gov. Bond Investments (\% Total)} 
        & \MC{Gov. Bond Investments (\% GDP)} 
        & \MC{Value of Pension Funds Investments (\% GDP)} 
        & \MC{Domestic Public Debt (\% Total)} \\
        \midrule
AUT & 16.57 & 0.99  & 5.83   & 23.35 \\ 
GBR & 14.38 & 14.72 & 101.66 & 69.13 \\ 
HUN & 56.40 & 1.64  & 3.01   & 44.67 \\ 
ISL & 38.58 & 63.26 & 165.56 & 80.53 \\ 
LUX & 21.85 & 0.60  & 2.73   & 57.41 \\ 
NLD & 16.38 & 24.77 & 151.04 & 45.43 \\ 
PRT & 25.70 & 1.90  & 7.49   & 38.92 \\ 
SVK & 35.65 & 2.04  & 5.77   & 55.27 \\ 
SWE & 4.18  & 3.70  & 88.63  & 70.29 \\ 
USA & 13.14 & 16.80 & 128.17 & 63.91 \\ 
\midrule
 Average & 24.28 & 13.04 & 65.99 & 54.9 \\
\bottomrule
    \end{tabularx}
\begin{tablenotes}
\item Source: OECD Pension Statistics. OECD Data are sample averages from 2010 onwards.
\item Note 2 .............
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

enter image description here

To remove the indentation of the table notes, you can add the option flushleft to the threeparttablepackage.

You must log in to answer this question.

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