0

Here is a table using ltablex package. Can someone tell me how I can include caption and use threeparttable with this one. Fyi, when I used:

\begin{table} 
begin{tabularx} 
...
\end{tabularx} 
\end{table}` 

the page did not break for me. Suggestions would be extremely helpful. I want to include caption and footnotes as given in this example Table formatting.

\documentclass{article}
\usepackage{ltablex}
\usepackage{threeparttable}
\usepackage{booktabs}

\title{Document}
\begin{document}
\maketitle

\begin{tabularx}{\textwidth}{Xc}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{tabularx}

\end{document}
  • what do you mean by "break" (line breaking or page breaking)? tabularx doesnt break over a page. In any case please always provide a complete document showing al packages used, not a fragment that can't be processed on its own. – David Carlisle Mar 23 '14 at 12:28
  • Done editing. The following code in the presence of ltablex package does break over pages. – Sumit Mar 23 '14 at 12:45
  • Did you try the threeparttablex package? It allows using threeparttable in long tables. – Bernard Mar 23 '14 at 13:16
  • @Bernard I did try that, but it seems that it doesn't work with ltablex package, which I require to get tabularx features in long table. Any other solutions? – Sumit Mar 23 '14 at 13:22
  • @Sumit: look at my answer: it does seem OK. Or did I miss something? – Bernard Mar 23 '14 at 13:56
2

The threeparttablex seems to work for me: in the following, I inserted the table notes inside the long table, and also at the end. No problem for the caption either. You have to write the table notes just after \begin{ThreePartTable} and to compile twice.

        \documentclass{article}
        \usepackage{ltablex}
        \usepackage{threeparttablex}
        \usepackage{booktabs}
        \usepackage[bf,tablename=TABLE,labelsep=newline,aboveskip=0pt]{caption}

        \title{Document}
        \begin{document}
        \maketitle
        \begin{ThreePartTable}
        \begin{TableNotes}
        \item[a] \label{tn:a}1st lovely note.
        \item[b] \label{tn:b}2nd lovely note.
        \end{TableNotes}
        \begin{tabularx}{\textwidth}{Xc}
        \caption{A Fine Caption}\\
        \toprule\toprule
        Some random text & 1,75,650\\\midrule
        \multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
        Number of observations ...\tnote{tn:a} & 1,75,650\\
        Delete: ... & (78,420)\\
        Delete: ... & (7,104)\\
        Final sample & 90,126\\
        Delete: & (2,143)\\
        Delete: & (8,345)\\
        Final sample\tnote{tn:b} & 79,638\\\midrule
        \multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\\midrule
        Number of observations & 79,638\\
        Delete: & (39,540)\\
        Delete: & (7,979) \\
        Final sample & 32,119 \\\midrule
        \insertTableNotes\\[12pt]\midrule
        \multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\\midrule
        Number of observations  & 1,75,650\\
        Delete: & (78,420)\\
        Delete: & (47,136)\\
        Delete: & (7,178)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Final sample & 42,884\\\midrule
        \multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\\midrule
        Number of observations  & 1,75,650\\
        Delete: & (78,420)\\
        Delete: & (47,136)\\
        Delete: & (7,178)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Number of observations  & 1,75,650\\
        Delete: & (78,420)\\
        Delete: & (47,136)\\
        Delete: & (7,178)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Delete: & (32)\\
        Final sample & 42,884\\\midrule\bottomrule
        \insertTableNotes
        \end{tabularx}
        \end{ThreePartTable}

        \end{document} 

enter image description here

  • Thanks for the information. I was using \begin{threeparttable}, but it seems that for threeparttablex, the correct env. is in capital letter. Very cool. Thanks. – Sumit Mar 23 '14 at 13:59
1

Try this:

\documentclass{article}
\usepackage{ltablex}
\usepackage{threeparttablex}
\usepackage{booktabs}
\usepackage{caption}
\title{Document}
\begin{document}
\maketitle
\captionof{table}{TITLE}
\begin{ThreePartTable}
\begin{tabularx}{\textwidth}{Xc}
\toprule\toprule
Some random text\tnote{a} & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{tabularx}
\begin{tablenotes}
\item[a]  TEXT-TEXT   
\end{tablenotes}
\end{ThreePartTable}
\end{document}

Try this with longtabu environment:

\documentclass[a4,12pt]{article}
\usepackage{caption}
\usepackage{longtable}   
\usepackage{tabu}
\usepackage{threeparttablex} 
\title{Document}
\begin{document}
\maketitle
Text-Text
\captionof{table}{TITLE.}
\begin{ThreePartTable}
\begin{longtabu}{cc}
\tabucline[2pt]{-}
Some random text\tnote{a} & 1,75,650\\
\tabucline[1pt]{-}
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\
\tabucline[1pt]{-}
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\
%\tabucline[1pt]{-}
\multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\
\tabucline[1pt]{-}
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\
\tabucline[1pt]{-}
\multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\
\tabucline[1pt]{-}
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\
\tabucline[1pt]{-}
\multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\
\tabucline[1pt]{-}
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\
\tabucline[2pt]{-}
\end{longtabu}
\begin{tablenotes}
\item[a]  TEXT-TEXT   
\end{tablenotes}
\end{ThreePartTable}
\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.