1

I am generating a long table. I want to put the table note right after the caption. For this purpose, I placed the table note in the caption. Howeer, caption and table note appear in the same line. If i put \\ after the caption both caption and table notes are left aligned. However, only table note should be left aligned and caption should remain centrally aligned. Moreover, I also want to make the line after the p-value disappear in the last row of the table. The MWE is given below:

     \documentclass[12pt, a4paper, twoside]{article}
     \usepackage[para]{threeparttable}
     \usepackage{booktabs,longtable,tabularx}
     \usepackage{caption}
     \setlength{\LTcapwidth}{7in}
     \usepackage{ltablex}
     \usepackage{siunitx}
     \usepackage[flushleft]{threeparttablex}
     \begin{document}

     \begin{longtable}{l*{4}{S}} \caption[Ordinary Least Square Estimations]         {Ordinary Least Square Estimations\vspace{1ex} \\
             Note: This table provides the results of OLS. Four models are estimated here. Models details are provided in the main body of the document. 
     }
             \label{tab:te3}\\
             \toprule
             {\bfseries{}}  &{\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)} \\%
             \endfirsthead
             \caption{-- continued from previous page}\\
             \toprule
             & {\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)}\\
             \midrule
             \endhead
             \bottomrule
             \addlinespace
             \multicolumn{5}{r}{\footnotesize Continued on next page} \\
             \endfoot
             \bottomrule
             \addlinespace
             \insertTableNotes\\
             \endlastfoot %
             \midrule
             A   & 0.022*** & 0.019*** & 0.021*** & 0.020*** \\
             B    & -0.002 & -0.008** & -0.010*** & -0.010** \\
             C  & 0.024 & -0.007 & -0.004 & -0.015 \\
            D    & -0.217*** & -0.314*** & -0.275*** & -0.262*** \\
             E   & -0.133 & -0.068 & -0.071 & -0.026 \\
             F   & 0.023 & 0.003 & 0.022 & 0.019 \\
             G    & -0.003*** & -0.003*** & -0.002** & -0.002** \\
             H    & -0.015 & -0.021** & -0.041*** & -0.045*** \\
             I   & -0.005** & -0.006*** & -0.006*** & -0.007*** \\
             J   & 0.184 & 0.346*** & 0.129 & 0.051 \\
             K & -0.006* & -0.007** & -0.007** & -0.009*** \\
             L & -0.014 & -0.022* & -0.021* & -0.023** \\
             M  & -0.006 & -0.001 & -0.004 & -0.002 \\
             N    & 0.001 & 0.004 & 0.009 & 0.003 \\
             O  & 0.01  & 0.017 & -0.003 & 0.003 \\
             P  & -0.077 & -0.146*** & -0.103** & -0.093** \\
             Q  & -0.022*** & -0.002 & -0.004 & -0.007 \\
             R   & 0.028*** & 0.035*** & 0.032*** & 0.027*** \\
             S    & 0.006 & 0.035*** & 0.026*** & 0.025*** \\
             T   & 0.0003 & -0.007 & 0.005 & -0.009 \\
             U   & -0.149** & -0.052 & 0.055 & 0.077 \\
             V   & -0.017* & -0.020** & -0.016* & -0.014* \\
             W     & -0.006 & -0.005 & 0.002 & -0.0004 \\
             Z    & -0.006 & -0.003 & -0.003 & -0.006 \\
             AB  & 0.004*** & 0.005*** & 0.005*** & 0.004*** \\
             AC  & -0.056** & -0.058** & -0.045* & -0.028 \\
             AD   & 1.985** & 0.856 & 0.178 & 0.306 \\
             AE    &       & -0.028*** & -0.012* & -0.012 \\
             AF   &       & 0.043*** & 0.044*** & 0.042*** \\
             AG    &       & -0.043*** & -0.037*** & -0.036*** \\
             AH   &       & -0.007 & -0.004 & -0.008 \\
             AI    &       & -0.003 & -0.004 & -0.003 \\
             AJ    &       & -0.014 & -0.003 & 0.004 \\
             BA  &       &       & -0.030*** & -0.031*** \\
             BC  &       &       & -0.038*** & -0.039*** \\
             BD  &       &       & -0.042*** & -0.044*** \\
             BE  &       &       & -0.025*** & -0.028*** \\
             BF  &       &       & -0.032*** & -0.036*** \\
             BH  &       &       & -0.034*** & -0.058*** \\
             BJ  &       &       & 0.006 & -0.013 \\
             BI  &       &       & -0.027*** & -0.048*** \\
             BL  &       &       & -0.028*** & -0.051*** \\
             BM  &       &       & 0.030*** & 0.012 \\
             BL * FC &       &       &       & -0.0005 \\
             BM * FC &       &       &       & 0.009** \\
             BC * FC &       &       &       & 0.013 \\
             BO * FC &       &       &       & 0.052*** \\
             BP * FC &       &       &       & -0.036** \\
             Constant & 0.131* & 0.039 & -0.032 & -0.03 \\
             \midrule
             Observations & 1,210 & 1,210 & 1,210 & 1,210 \\
             $R^2$    & 0.126 & 0.187 & 0.28  & 0.301 \\
             Adjusted $R^2$ & 0.106 & 0.164 & 0.254 & 0.272 \\
             Residual Std. Error & 0.003 & 0.003 & 0.002 & 0.002 \\
             $F$ Statistic & 6.325*** & 8.204*** & 10.552***  & 0.417*** \\
             \bottomrule
             \multicolumn{5}{c}{*p<0.1; **p<0.05; ***p<0.01} \\
             \end{longtable}%

             \end{document}

2 Answers 2

2

For the table to fit within the margins, useltablex and an X column. Additionally, fix thetableèformat of S columns to the exact number of digits, and ThhreePartTablex package for the table note:

\documentclass[12pt, a4paper, twoside]{article}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.3pt}

 \usepackage{booktabs}
\usepackage{caption}%
 \usepackage{longtable, tabularx, ltablex}
\usepackage{siunitx} %
\usepackage[flushleft, online]{threeparttablex} %

\begin{document}

\begin{ThreePartTable}
  \sisetup{table-format=-2.3, table-space-text-post=***, table-number-alignment=center}
\keepXColumns
\begin{TableNotes}\footnotesize
 \item[\hspace{-\fontdimen2\font}]\emph{Note:} This table provides the results of OLS. Four models are estimated
 here. Models details are provided in the main body of the document.
\end{TableNotes}
\begin{tabularx}{\textwidth}{X@{}S[table-format =-1.4]*{2}{S}S[table-format =-1.4]}
 \caption{Ordinary Least Square Estimations}\label{tab:te3}\\
\insertTableNotes\\
\addlinespace%
%\toprule
% &{\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)} \\%
 \endfirsthead
 \caption[]{-- continued from previous page}\\
 \toprule
 & {\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)}\\
 \midrule
 \endhead
 \bottomrule
 \addlinespace
 \multicolumn{5}{r}{\footnotesize Continued on next page} \\
 \endfoot
 \bottomrule
 \addlinespace
 %\insertTableNotes\\
 \endlastfoot %
  \midrule
 A & 0.022*** & 0.019*** & 0.021*** & 0.020*** \\
 B & -0.002 & -0.008** & -0.010*** & -0.010** \\
 C & 0.024 & -0.007 & -0.004 & -0.015 \\
 D & -0.217*** & -0.314*** & -0.275*** & -0.262*** \\
 E & -0.133 & -0.068 & -0.071 & -0.026 \\
 F & 0.023 & 0.003 & 0.022 & 0.019 \\
 G & -0.003*** & -0.003*** & -0.002** & -0.002** \\
 H & -0.015 & -0.021** & -0.041*** & -0.045*** \\
 I & -0.005** & -0.006*** & -0.006*** & -0.007*** \\
 J & 0.184 & 0.346*** & 0.129 & 0.051 \\
 K & -0.006* & -0.007** & -0.007** & -0.009*** \\
 L & -0.014 & -0.022* & -0.021* & -0.023** \\
 M & -0.006 & -0.001 & -0.004 & -0.002 \\
 N & 0.001 & 0.004 & 0.009 & 0.003 \\
 O & 0.01 & 0.017 & -0.003 & 0.003 \\
 P & -0.077 & -0.146*** & -0.103** & -0.093** \\
 Q & -0.022*** & -0.002 & -0.004 & -0.007 \\
 R & 0.028*** & 0.035*** & 0.032*** & 0.027*** \\
 T & 0.0003 & -0.007 & 0.005 & -0.009 \\
 U & -0.149** & -0.052 & 0.055 & 0.077 \\
 V & -0.017* & -0.020** & -0.016* & -0.014* \\
 W & -0.006 & -0.005 & 0.002 & -0.0004 \\
 Z & -0.006 & -0.003 & -0.003 & -0.006 \\
 AB & 0.004*** & 0.005*** & 0.005*** & 0.004*** \\
 AC & -0.056** & -0.058** & -0.045* & -0.028 \\
 AD & 1.985** & 0.856 & 0.178 & 0.306 \\
 AE & & -0.028*** & -0.012* & -0.012 \\
 AF & & 0.043*** & 0.044*** & 0.042*** \\
 AG & & -0.043*** & -0.037*** & -0.036*** \\
 AH & & -0.007 & -0.004 & -0.008 \\
 AI & & -0.003 & -0.004 & -0.003 \\
 AJ & & -0.014 & -0.003 & 0.004 \\
 BA & & & -0.030*** & -0.031*** \\
 BC & & & -0.038*** & -0.039*** \\
 BD & & & -0.042*** & -0.044*** \\
 BE & & & -0.025*** & -0.028*** \\
 BF & & & -0.032*** & -0.036*** \\
 BH & & & -0.034*** & -0.058*** \\
 BJ & & & 0.006 & -0.013 \\
 BI & & & -0.027*** & -0.048*** \\
 BL & & & -0.028*** & -0.051*** \\
 BM & & & 0.030*** & 0.012 \\
 BL * FC & & & & -0.0005 \\
 BM * FC & & & & 0.009** \\
 BC * FC & & & & 0.013 \\
 BO * FC & & & & 0.052*** \\
 BP * FC & & & & -0.036** \\
 Constant & 0.131* & 0.039 & -0.032 & -0.03 \\
 \midrule
 Observations & 1,210 & 1,210 & 1,210 & 1,210 \\
 $R^2$ & 0.126 & 0.187 & 0.28 & 0.301 \\
 Adjusted $R^2$ & 0.106 & 0.164 & 0.254 & 0.272 \\
Residual\cr Std. Error & 0.003 & 0.003 & 0.002 & 0.002 \\
 $F$ Statistic & 6.325*** & 8.204*** & 10.552*** & 0.417*** \\
  \bottomrule
\addlinespace
 \multicolumn{5}{c}{* $ p<0.1 $; ** $ p<0.05 $; *** $ p<0.01 $} \\
\end{tabularx}%
\end{ThreePartTable}

\end{document}

enter image description here enter image description here

4
  • All S columns can have common table-format as defined in \sisetup{...} and also table-space-text-post=***. Two exception of numbers with four decimal digital can protrude in space reserved for stars. Considering this the table can begin with \begin{tabularx}{\textwidth}{X@{}*{4}{S}}. With this will table looks more nice (to my opinion, of course). +1 for nice answer.
    – Zarko
    Dec 10, 2016 at 4:00
  • @Zarko: For table-format, I first used a common value for the four S columns. That produced 3 overfull \hbox, so I opted for two different values. Not sure this was the best choice, though.
    – Bernard
    Dec 10, 2016 at 10:52
  • @Bernard Thank you. The table format is completely disturbs when I place the actual names of variables in the table that are bit longer but I cannot post variable names here. However, I can make the column width adjusted to text.
    – Ahmed Arif
    Dec 10, 2016 at 16:11
  • Can't you write variable names over two lines? You also can play with fontsize inside the table, and with the value of \tabcolsep. But of course it all depends on the actual variable names.
    – Bernard
    Dec 10, 2016 at 16:17
1

Use \caption* for the note:

\documentclass[12pt, a4paper, twoside]{article}
\usepackage[para]{threeparttable}
\usepackage{booktabs,longtable,tabularx}
\usepackage{caption}
\setlength{\LTcapwidth}{7in}
\usepackage{ltablex}
\usepackage{siunitx}
\usepackage[flushleft]{threeparttablex}
\begin{document}

\begin{longtable}{l*{4}{S}} 
  \caption{Ordinary Least Square Estimations}\label{tab:te3}\\
  \caption*{%
    Note: This table provides the results of OLS. Four models are estimated
    here. Models details are provided in the main body of the document.
  }\\
  \toprule
  {\bfseries{}}  &{\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)} \\%
  \endfirsthead
  \caption[]{-- continued from previous page}\\
  \toprule
  & {\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)}\\
  \midrule
  \endhead
  \bottomrule
  \addlinespace
  \multicolumn{5}{r}{\footnotesize Continued on next page} \\
  \endfoot
  \bottomrule
  \addlinespace
  \insertTableNotes\\
  \endlastfoot %
  \midrule
  A   & 0.022*** & 0.019*** & 0.021*** & 0.020*** \\
  B    & -0.002 & -0.008** & -0.010*** & -0.010** \\
  C  & 0.024 & -0.007 & -0.004 & -0.015 \\
  D    & -0.217*** & -0.314*** & -0.275*** & -0.262*** \\
  E   & -0.133 & -0.068 & -0.071 & -0.026 \\
  F   & 0.023 & 0.003 & 0.022 & 0.019 \\
  G    & -0.003*** & -0.003*** & -0.002** & -0.002** \\
  H    & -0.015 & -0.021** & -0.041*** & -0.045*** \\
  I   & -0.005** & -0.006*** & -0.006*** & -0.007*** \\
  J   & 0.184 & 0.346*** & 0.129 & 0.051 \\
  K & -0.006* & -0.007** & -0.007** & -0.009*** \\
  L & -0.014 & -0.022* & -0.021* & -0.023** \\
  M  & -0.006 & -0.001 & -0.004 & -0.002 \\
  N    & 0.001 & 0.004 & 0.009 & 0.003 \\
  O  & 0.01  & 0.017 & -0.003 & 0.003 \\
  P  & -0.077 & -0.146*** & -0.103** & -0.093** \\
  Q  & -0.022*** & -0.002 & -0.004 & -0.007 \\
  R   & 0.028*** & 0.035*** & 0.032*** & 0.027*** \\
  S    & 0.006 & 0.035*** & 0.026*** & 0.025*** \\
  T   & 0.0003 & -0.007 & 0.005 & -0.009 \\
  U   & -0.149** & -0.052 & 0.055 & 0.077 \\
  V   & -0.017* & -0.020** & -0.016* & -0.014* \\
  W     & -0.006 & -0.005 & 0.002 & -0.0004 \\
  Z    & -0.006 & -0.003 & -0.003 & -0.006 \\
  AB  & 0.004*** & 0.005*** & 0.005*** & 0.004*** \\
  AC  & -0.056** & -0.058** & -0.045* & -0.028 \\
  AD   & 1.985** & 0.856 & 0.178 & 0.306 \\
  AE    &       & -0.028*** & -0.012* & -0.012 \\
  AF   &       & 0.043*** & 0.044*** & 0.042*** \\
  AG    &       & -0.043*** & -0.037*** & -0.036*** \\
  AH   &       & -0.007 & -0.004 & -0.008 \\
  AI    &       & -0.003 & -0.004 & -0.003 \\
  AJ    &       & -0.014 & -0.003 & 0.004 \\
  BA  &       &       & -0.030*** & -0.031*** \\
  BC  &       &       & -0.038*** & -0.039*** \\
  BD  &       &       & -0.042*** & -0.044*** \\
  BE  &       &       & -0.025*** & -0.028*** \\
  BF  &       &       & -0.032*** & -0.036*** \\
  BH  &       &       & -0.034*** & -0.058*** \\
  BJ  &       &       & 0.006 & -0.013 \\
  BI  &       &       & -0.027*** & -0.048*** \\
  BL  &       &       & -0.028*** & -0.051*** \\
  BM  &       &       & 0.030*** & 0.012 \\
  BL * FC &       &       &       & -0.0005 \\
  BM * FC &       &       &       & 0.009** \\
  BC * FC &       &       &       & 0.013 \\
  BO * FC &       &       &       & 0.052*** \\
  BP * FC &       &       &       & -0.036** \\
  Constant & 0.131* & 0.039 & -0.032 & -0.03 \\
  \midrule
  Observations & 1,210 & 1,210 & 1,210 & 1,210 \\
  $R^2$    & 0.126 & 0.187 & 0.28  & 0.301 \\
  Adjusted $R^2$ & 0.106 & 0.164 & 0.254 & 0.272 \\
  Residual Std. Error & 0.003 & 0.003 & 0.002 & 0.002 \\
  $F$ Statistic & 6.325*** & 8.204*** & 10.552***  & 0.417*** \\
  \bottomrule
  \multicolumn{5}{c}{*p<0.1; **p<0.05; ***p<0.01} \\
\end{longtable}%

\end{document}
1
  • Thank you. But there is still one problem. Table note goes out of the margins of the table. However, I can keep it within the margins of the table.
    – Ahmed Arif
    Dec 9, 2016 at 18:08

You must log in to answer this question.

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