5

I have a table that is currently too large for my page which is why I want to reduce the column width. At the same time I also want to align the values at the decimal point. I have been trying with the siunitx package but somehow I can't get it right. I don't necessarily have to use this package but I want the table to stay the way it is (except for the column widths). I would like to adjust each column width individually to overall make the table the same width as the text I have in my document.

This is my table:

\documentclass[12pt, a4paper]{article}  
\usepackage[format=hang,font={small,it},labelfont={bf,it},labelsep=space]{caption} 
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs}

\begin{document}

\begin{table}[!htb]
    \caption{Sample caption \label{tab:example}}
      \begin{tabular}{rlSllSl}
      \toprule
      & TEXTEXTEXT & AR & t-stat & Firms & AR & t-stat \\ 
      \midrule
      & X TEXTEXTEXT & & & & \\
      \midrule
      1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\ 
      2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\ 
      3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\ 
      4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\ 
      5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\ 
      6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\ 
      7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\ 
      8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\ 
      9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\ 
      10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\ 
      11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\ 
      12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\ 
      13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\ 
      14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\ 
      \midrule
      & Y TEXTEXTEXT & & & & \\
      \midrule
      1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\ 
      2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\ 
      3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\ 
      4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\ 
      5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\ 
      6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\ 
      7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\ 
      8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\ 
      9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\ 
      10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\ 
      11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\ 
      12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\ 
      13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\ 
      14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\ 
      15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\ 
      16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\ 
      17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\ 
      18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\ 
      19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\ 
      20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\ 
      21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\ 
      22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\ 
       \bottomrule
    \end{tabular}

    {\raggedright \footnotesize{One-tailed t-statistics in parantheses

         Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01} \par}
    \end{table}

\end{document}

Appreciate any help with this!

  • 1
    Welcome to TeX.SX! Could you please turn your code fragment into a compilable minimal working example (MWE) by adding the documentclass as well as the relevant packages? Currently, your table is not compilable as its column specifiers are completely missing. – leandriis Jul 26 at 15:48
  • @leandriis Of course, sorry about that! I edited the example accordingly. – User2010S Jul 26 at 15:58
  • Thanks for the update. However, in your previous code, the second and fifth column was a bit shorter than it is now. What is closer to the table in your real document? – leandriis Jul 26 at 16:02
  • @leandriis you can disregard the first example, this is closer to the real document as the columns make the table wider than the text. – User2010S Jul 26 at 16:04
  • Some more suggestions/questions: a) Would it be okay to introduce linebreaks in the second and fifth column? b) Are you willing to change the document's margins (for example with the geometry package? c) Could you rotate the table to a landscape page? – leandriis Jul 26 at 16:09
1

To have something fill to one page using the MWE, perhaps using the \usepackage{fullpage} would be helpful in achieving that goal.

\documentclass[12pt, a4paper]{article}  
\usepackage[format=hang,font={small,it},labelfont={bf,it},labelsep=space]{caption} 
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs}

\usepackage{dcolumn}

\newcolumntype{L}{D{.}{.}{2,5}}

\usepackage{fullpage}

\begin{document}

    \begin{table}[!htb]
        \caption{Sample caption \label{tab:example}}
        \begin{tabular}{rlSllSl}
            \toprule
            & TEXTEXTEXT & AR & t-stat & Firms & AR & t-stat \\ 
            \midrule
            & X TEXTEXTEXT & & & & \\
            \midrule
            1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\ 
            2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\ 
            3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\ 
            4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\ 
            5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\ 
            6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\ 
            7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\ 
            8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\ 
            9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\ 
            10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\ 
            11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\ 
            12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\ 
            13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\ 
            14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\ 
            \midrule
            & Y TEXTEXTEXT & & & & \\
            \midrule
            1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\ 
            2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\ 
            3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\ 
            4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\ 
            5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\ 
            6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\ 
            7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\ 
            8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\ 
            9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\ 
            10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\ 
            11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\ 
            12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\ 
            13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\ 
            14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\ 
            15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\ 
            16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\ 
            17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\ 
            18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\ 
            19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\ 
            20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\ 
            21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\ 
            22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\ 
            \bottomrule
        \end{tabular}

        {\raggedright \footnotesize{One-tailed t-statistics in parantheses

                Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01} \par}
    \end{table}

\end{document}
  • Unfortunately, I would like to stick with booktabs if possible. I updated the code with the packages currently used. – User2010S Jul 26 at 16:12
  • Now that I saw your updated example, if you insert \usepackage{fullpage}, it might work with fitting everything on one page. – Jennifer Jul 26 at 16:14
  • I edited my answer with an MWE using the booktabs. – Jennifer Jul 26 at 16:18
  • Awesome, thank you very much for you help! – User2010S Jul 26 at 16:24
  • Doesn't the use of the fullpage package contradict the OP's statement "I also need the margins to stay the same"? – leandriis Jul 26 at 17:22
4

Here are three more possibilities:

Since your table is too tall to fit into the textblock and you specified that you didn't want to chang the margins, I'd suggest the use of longtable. This might especially come in handy if your caption gets longer than a single line or if you decide to add more rows to your table.

enter image description here

In the second example, I have allowed linebreaks in column 2 and 5 and used a larger font size for the table.

enter image description here

In the third example, I have reduced the font size to \footnotesize. With this, the table can fit into a single page even with a caption that has more than one or two lines.

enter image description here

All tables use the siunitx package in order to align the nubers with respect to the decimal marker.

 \documentclass[12pt, a4paper]{article}  

\usepackage[format=hang,font={small,it},labelfont={bf,it},labelsep=space]{caption} 
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs}

\sisetup{table-align-text-pre  = false,
    table-align-text-post      = false,   
    input-open-uncertainty     = ,
    input-close-uncertainty    = ,}


\usepackage{longtable} % Used for table 1
\usepackage{xltabular} % Used for table 2



\begin{document}


{\setlength{\tabcolsep}{3.25pt} \small
  \begin{longtable}{@{}rlS[table-format=-1.4]SlS[table-format=-1.4]S@{}}
  \caption{Sample caption that might be longer than a single line Sample caption that might be longer than a single line Sample caption that might be longer than a single line Sample caption that might be longer than a single line \label{tab:example}}\\
  \toprule
      & TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\ 
      \midrule
  \endhead
  \multicolumn{7}{l}{\footnotesize One-tailed t-statistics in parantheses}\\
  \multicolumn{7}{l}{\footnotesize Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01}
  \endlastfoot
        & \multicolumn{2}{l}{X TEXTEXTEXT} \\
      \midrule
      1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\ 
      2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\ 
      3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\ 
      4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\ 
      5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\ 
      6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\ 
      7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\ 
      8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\ 
      9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\ 
      10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\ 
      11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\ 
      12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\ 
      13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\ 
      14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\ 
      \midrule
      & \multicolumn{2}{l}{Y TEXTEXTEXT}\\
      \midrule
      1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\ 
      2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\ 
      3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\ 
      4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\ 
      5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\ 
      6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\ 
      7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\ 
      8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\ 
      9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\ 
      10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\ 
      11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\ 
      12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\ 
      13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\ 
      14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\ 
      15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\ 
      16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\ 
      17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\ 
      18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\ 
      19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\ 
      20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\ 
      21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\ 
      22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\ 
   \bottomrule
\end{longtable}
}
\newpage



{\small
  \begin{xltabular}{\textwidth}{@{}r 
                                >{\raggedright\arraybackslash}X
                                S[table-format=-1.4]
                                S
                                >{\raggedright\arraybackslash}XS[table-format=-1.4]
                                S@{}}
  \caption{Sample caption \label{tab:example2}}\\
  \toprule
      & TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\ 
      \midrule
  \endhead
  \multicolumn{7}{l}{\footnotesize One-tailed t-statistics in parantheses}\\
  \multicolumn{7}{l}{\footnotesize Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01}
  \endlastfoot
      & \multicolumn{3}{l}{X TEXTEXTEXT} \\
      \midrule
      1 & TEXTEX TEXT & 0.0056 & (0.46) & TEXTEX TEXT & 0.0046 & (0.37) \\ 
      2 & TEXTEX TEXT & -0.0067 & (-0.45) & TEXTEX TEXT & 0.0062 & (0.63) \\ 
      3 & TEXTEX TEXT & 0.0006 & (0.07) & TEXTEX TEXT & -0.0036 & (-0.31) \\ 
      4 & TEXTEX TEXT & -0.0005 & (-0.05) & TEXTEX TEXT & 0.0054 & (0.35) \\ 
      5 & TEXTEX TEXT & 0.0029 & (0.34) & TEXTEX TEXT & 0.0046 & (0.39) \\ 
      6 & TEXTEX TEXT & 0.0034 & (0.30) & TEXTEX TEXT & 0.0103 & (1.12) \\ 
      7 & TEXTEX TEXT & 0.0063 & (0.38) & & & \\ 
      8 & TEXTEX TEXT & -0.0006 & (-0.07) & & & \\ 
      9 & TEXTEX TEXT & -0.0037 & (-0.29) & & & \\ 
      10 & TEXTEX TEXT & -0.0017 & (-0.19) & & & \\ 
      11 & TEXTEX TEXT & -0.0005 & (-0.06) & & & \\ 
      12 & TEXTEX TEXT & 0.0048 & (0.57) & & & \\ 
      13 & TEXTEX TEXT & 0.0054 & (0.52) & & & \\ 
      14 & TEXTEX TEXT & 0.0026 & (0.25) & & & \\ 
      \midrule
      & \multicolumn{3}{l}{Y TEXTEXTEXT} \\*
      \midrule
      1 & TEXTEX TEXT & 0.0001 & (0.01) & ATEXTEX TEXT & 0.0137 & (1.59)* \\ 
      2 & TEXTEX TEXT & -0.0014 & (-0.12) & TEXTEX TEXT & 0.0105 & (1.15) \\ 
      3 & TEXTEX TEXT & 0.0107 & (1.48)* & TEXTEX TEXT & 0.0061 & (0.55) \\ 
      4 & TEXTEX TEXT & 0.0040 & (0.32) & TEXTEX TEXT & 0.0109 & (0.88) \\ 
      5 & TEXTEX TEXT & 0.0091 & (1.16) & TEXTEX TEXT & 0.0044 & (0.47) \\ 
      6 & TEXTEX TEXT & 0.0034 & (0.41) & TEXTEX TEXT & -0.0021 & (-0.13) \\ 
      7 & TEXTEX TEXT & -0.0014 & (-0.13) & TEXTEX TEXT & -0.0045 & (-0.35) \\ 
      8 & TEXTEX TEXT & 0.0019 & (0.13) & TEXTEX TEXT & 0.0143 & (1.18) \\ 
      9 & TEXTEX TEXT & 0.0001 & (0.01) & TEXTEX TEXT & -0.0160 & (-1.53)* \\ 
      10 & TEXTEX TEXT & 0.0086 & (1.15) & TEXTEX TEXT & -0.0046 & (-0.15) \\ 
      11 & TEXTEX TEXT & -0.0103 & (-0.98) & TEXTEX TEXT & 0.0004 & (0.04) \\ 
      12 & TEXTEX TEXT & -0.0008 & (-0.08) & TEXTEX TEXT & -0.0015 & (-0.10) \\ 
      13 & TEXTEX TEXT & -0.0078 & (-0.68) & TEXTEX TEXT & -0.0100 & (-0.44) \\ 
      14 & TEXTEX TEXT & -0.0023 & (-0.14) & TEXTEX TEXT & 0.0054 & (0.65) \\ 
      15 & TEXTEX TEXT & -0.0065 & (-0.51) & TEXTEX TEXT & 0.0018 & (0.14) \\ 
      16 & TEXTEX TEXT & 0.0020 & (0.29) & TEXTEX TEXT & -0.0195 & (-0.91) \\ 
      17 & TEXTEX TEXT & 0.0083 & (0.82) & & \\ 
      18 & TEXTEX TEXT & 0.0009 & (0.11) & & & \\ 
      19 & TEXTEX TEXT & -0.0101 & (-0.90) & & & \\ 
      20 & TEXTEX TEXT & 0.0043 & (0.51) & & & \\ 
      21 & TEXTEX TEXT & 0.0072 & (0.75) & & & \\ 
      22 & TEXTEX TEXT & -0.0211 & (-0.94) & & & \\ 
   \bottomrule
\end{xltabular}
}

\newpage


\begin{table}[ht]
\caption{Sample caption \label{tab:example3}}
\centering
 \footnotesize
  \begin{tabular}{@{}rlS[table-format=-1.4]SlS[table-format=-1.4]S@{}}
  \toprule
      & TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\ 
      \midrule
      & \multicolumn{2}{l}{X TEXTEXTEXT} \\
      \midrule
      1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\ 
      2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\ 
      3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\ 
      4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\ 
      5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\ 
      6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\ 
      7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\ 
      8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\ 
      9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\ 
      10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\ 
      11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\ 
      12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\ 
      13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\ 
      14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\ 
      \midrule
      & \multicolumn{2}{l}{Y TEXTEXTEXT}\\
      \midrule
      1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\ 
      2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\ 
      3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\ 
      4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\ 
      5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\ 
      6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\ 
      7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\ 
      8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\ 
      9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\ 
      10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\ 
      11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\ 
      12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\ 
      13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\ 
      14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\ 
      15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\ 
      16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\ 
      17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\ 
      18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\ 
      19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\ 
      20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\ 
      21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\ 
      22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\ 
   \bottomrule
   \multicolumn{7}{l}{\footnotesize One-tailed t-statistics in parantheses}\\
  \multicolumn{7}{l}{\footnotesize Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01}
\end{tabular}
\end{table}

\end{document}
  • +1 for \sisetup. It works quite unexpected well. I need to make some more tests how to use it. – Zarko Jul 26 at 18:33
4

with siunitx and tabularx (that table is fit into text area):

\documentclass[12pt, a4paper]{article}
\usepackage[format=hang,
            font={small,it},
            labelfont={bf,it},
            labelsep=space]{caption}
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}

\usepackage{booktabs, tabularx}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}[ht]
    \small
\caption{Sample caption}
\label{tab:example}
%
\sisetup{parse-numbers=false,
         table-format=-2.4} % integer part had to have
                            % one digit more than normally needed
                            % otherwise decimal point is overwritten
     \begin{tabularx}{\linewidth}{@{} rXSSXSS @{}}
      \toprule
      & TEXTEXTEXT & {AR} & {t-stat} &  Firms  & {AR} & {t-stat} \\
      \midrule
      & \multicolumn{6}{l}{X TEXTEXTEXT}    \\
      \midrule
      1 & TEXTEXTEXT &  0.0056 &  (0.46) & TEXTEXTEXT &  0.0046 &  (0.37) \\
      2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT &  0.0062 &  (0.63) \\
      3 & TEXTEXTEXT &  0.0006 &  (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\
      4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT &  0.0054 &  (0.35) \\
      5 & TEXTEXTEXT &  0.0029 &  (0.34) & TEXTEXTEXT &  0.0046 &  (0.39) \\
      6 & TEXTEXTEXT &  0.0034 &  (0.30) & TEXTEXTEXT &  0.0103 &  (1.12) \\
      7 & TEXTEXTEXT &  0.0063 &  (0.38) & & & \\
      8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\
      9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\
     10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\
     11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\
     12 & TEXTEXTEXT &  0.0048 &  (0.57) & & & \\
     13 & TEXTEXTEXT &  0.0054 &  (0.52) & & & \\
     14 & TEXTEXTEXT &  0.0026 &  (0.25) & & & \\
      \midrule
      & \multicolumn{6}{l}{Y TEXTEXTEXT}    \\
      \midrule
      1 & TEXTEXTEXT &  0.0001 &  (0.01)  & TEXTEXTEXT &  0.0137 &  (1.59)* \\
      2 & TEXTEXTEXT & -0.0014 & (-0.12)  & TEXTEXTEXT &  0.0105 &  (1.15)  \\
      3 & TEXTEXTEXT &  0.0107 &  (1.48)* & TEXTEXTEXT &  0.0061 &  (0.55)  \\
      4 & TEXTEXTEXT &  0.0040 &  (0.32)  & TEXTEXTEXT &  0.0109 &  (0.88)  \\
      5 & TEXTEXTEXT &  0.0091 &  (1.16)  & TEXTEXTEXT &  0.0044 &  (0.47)  \\
      6 & TEXTEXTEXT &  0.0034 &  (0.41)  & TEXTEXTEXT & -0.0021 & (-0.13)  \\
      7 & TEXTEXTEXT & -0.0014 & (-0.13)  & TEXTEXTEXT & -0.0045 & (-0.35)  \\
      8 & TEXTEXTEXT &  0.0019 &  (0.13)  & TEXTEXTEXT &  0.0143 &  (1.18)  \\
      9 & TEXTEXTEXT &  0.0001 &  (0.01)  & TEXTEXTEXT & -0.0160 & (-1.53)* \\
     10 & TEXTEXTEXT &  0.0086 &  (1.15)  & TEXTEXTEXT & -0.0046 & (-0.15)  \\
     11 & TEXTEXTEXT & -0.0103 & (-0.98)  & TEXTEXTEXT &  0.0004 &  (0.04)  \\
     12 & TEXTEXTEXT & -0.0008 & (-0.08)  & TEXTEXTEXT & -0.0015 & (-0.10)  \\
     13 & TEXTEXTEXT & -0.0078 & (-0.68)  & TEXTEXTEXT & -0.0100 & (-0.44)  \\
     14 & TEXTEXTEXT & -0.0023 & (-0.14)  & TEXTEXTEXT &  0.0054 &  (0.65)  \\
     15 & TEXTEXTEXT & -0.0065 & (-0.51)  & TEXTEXTEXT &  0.0018 &  (0.14)  \\
     16 & TEXTEXTEXT &  0.0020 &  (0.29)  & TEXTEXTEXT & -0.0195 & (-0.91)  \\
     17 & TEXTEXTEXT &  0.0083 &  (0.82)  & & & \\
     18 & TEXTEXTEXT &  0.0009 &  (0.11)  & & & \\
     19 & TEXTEXTEXT & -0.0101 & (-0.90)  & & & \\
     20 & TEXTEXTEXT &  0.0043 &  (0.51)  & & & \\
     21 & TEXTEXTEXT &  0.0072 &  (0.75)  & & & \\
     22 & TEXTEXTEXT & -0.0211 & (-0.94)  & & & \\
       \bottomrule
    \end{tabularx}
    \raggedright\footnotesize

    One-tailed t-statistics in parantheses

    Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01
    \end{table}

\end{document}

enter image description here

(red lines indicate page layout)

Note: your table is to tall that can be fit in text area. This you can solve but defined bigger \textheight (by help of the package geometry} or using smaller font (for example \footnotesize}

Addendum: Inspired by \sisetup used in @leandris answer:

   \begin{table}[ht]
   \footnotesize
\caption{Sample caption}
\label{tab:example}
%
\sisetup{table-space-text-pre={(},
         table-align-text-pre=false,
         table-space-text-post={)*},
         table-align-text-post=false,
         input-open-uncertainty = ,
         input-close-uncertainty = ,
        }
     \begin{tabularx}{\linewidth}{@{} r*{2}{XS[table-format=-1.4]
                                             S[table-format=-1.2]}
                                  @{}}
 % table body
     \end{table}

gives better control over S columns formatting. Using footnotesize font size gives:

enter image description here

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.