6

I have a very long table and want to split it into two pages, and I want the first page to say something like "to be continued" and the second one "continued from the last table." I know I have to use the \endhead and \endfirsthead codes somewhere, but I do not know where.


\documentclass[12pt,twoside]{report}

\usepackage{tabularx, booktabs,multirow,adjustbox,caption,float,subcaption, longtable}

\begin{document}

{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{spacing}{1.03}
\begin{longtable}{l*{1}{c}} 
\caption{Executive Constraints by Regime Type} \label{Tab:Tab 2}\\
\hline\hline\endfirsthead\hline\endhead\hline\endfoot\endlastfoot
                    &\multicolumn{1}{c}{(1)}\\
                    &\multicolumn{1}{c}{mean(sd)}\\
\hline
\textbf{Civilian Dictatorship}            &                     \\
Legislative constraints on the executive index&       0.300         \\
                    &     (0.240)         \\

Judicial constraints on the executive index&       0.364         \\
                    &     (0.246)         \\

Range of consultation&     -0.0467         \\
                    &     (1.034)         \\

Party institutionalization index&       0.502         \\
                    &     (0.223)         \\

Freedom of Expression and Alternative Sources of Information index&       0.367         \\
                    &     (0.258)         \\

Relative Experience of Core Cabinet Members          &       1.029         \\
                    &     (1.119)        
\\\hline
%
\textbf{Democracy}           &                     \\
Legislative constraints on the executive index&       0.749         \\
                    &     (0.213)         \\

Judicial constraints on the executive index&       0.770         \\
                    &     (0.205)         \\

Range of consultation&       1.560         \\
                    &     (1.020)         \\

Party institutionalization index&       0.736         \\
                    &     (0.223)         \\

Freedom of Expression and Alternative Sources of Information index&       0.850         \\
                    &     (0.136)         \\

Relative Experience of Core Cabinet Members             &       1.413         \\
                    &     (1.123)         \\
\hline
\textbf{Military Dictatorship}            &                     \\
Legislative constraints on the executive index&       0.202         \\
                    &     (0.184)         \\

Judicial constraints on the executive index&       0.270         \\
                    &     (0.201)         \\

Range of consultation&      -0.619         \\
                    &     (1.041)         \\

Party institutionalization index&       0.431         \\
                    &     (0.201)         \\

Freedom of Expression and Alternative Sources of Information index&       0.279         \\
                    &     (0.222)         \\

Relative Experience of Core Cabinet Members            &       0.843         \\
                    &     (0.866)         \\
\hline
\textbf{Royal Dictatorship}               &                     \\
Legislative constraints on the executive index&       0.287         \\
                    &     (0.254)         \\

Judicial constraints on the executive index&       0.410         \\
                    &     (0.224)         \\

Range of consultation&      -0.174         \\
                    &     (0.923)         \\

Party institutionalization index&       0.158         \\
                    &     (0.170)         \\

Freedom of Expression and Alternative Sources of Information index&       0.268         \\
                    &     (0.199)         \\

Relative Experience of Core Cabinet Members             &       0.981         \\
                    &     (1.355)         \\
\hline

\hline\hline
\multicolumn{2}{l}{\footnotesize mean coefficients; sd in parentheses}\\
\end{longtable}
\end{spacing}
}

\end{document}```

5 Answers 5

2
\documentclass[12pt,twoside]{report}

\usepackage{tabularx, booktabs,multirow,adjustbox,caption,float,subcaption, longtable}

\begin{document}

{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
%\begin{spacing}{1.03} %commented as not defined in the code
\begin{longtable}{l*{1}{c}} 
\caption{Executive Constraints by Regime Type} \label{Tab:Tab 2}\\
\hline
                    &\multicolumn{1}{c}{(1)}\\
                    &\multicolumn{1}{c}{mean(sd)}\\
\hline
\endfirsthead

\multicolumn{2}{c}{continued from the last table}\\
\hline
                    &\multicolumn{1}{c}{(1)}\\
                    &\multicolumn{1}{c}{mean(sd)}\\
\hline
\endhead

\hline\hline\multicolumn{2}{l}{\footnotesize mean coefficients; sd in parentheses}\\
\multicolumn{2}{r}{{to be continued}}
\endfoot

\hline\hline\multicolumn{2}{l}{\footnotesize mean coefficients; sd in parentheses}
\endlastfoot

\textbf{Civilian Dictatorship}            &                     \\
Legislative constraints on the executive index&       0.300         \\
                    &     (0.240)         \\

Judicial constraints on the executive index&       0.364         \\
                    &     (0.246)         \\

Range of consultation&     -0.0467         \\
                    &     (1.034)         \\

Party institutionalization index&       0.502         \\
                    &     (0.223)         \\

Freedom of Expression and Alternative Sources of Information index&       0.367         \\
                    &     (0.258)         \\

Relative Experience of Core Cabinet Members          &       1.029         \\
                    &     (1.119)        
\\\hline
%
\textbf{Democracy}           &                     \\
Legislative constraints on the executive index&       0.749         \\
                    &     (0.213)         \\

Judicial constraints on the executive index&       0.770         \\
                    &     (0.205)         \\

Range of consultation&       1.560         \\
                    &     (1.020)         \\

Party institutionalization index&       0.736         \\
                    &     (0.223)         \\

Freedom of Expression and Alternative Sources of Information index&       0.850         \\
                    &     (0.136)         \\

Relative Experience of Core Cabinet Members             &       1.413         \\
                    &     (1.123)         \\
\hline
\textbf{Military Dictatorship}            &                     \\
Legislative constraints on the executive index&       0.202         \\
                    &     (0.184)         \\

Judicial constraints on the executive index&       0.270         \\
                    &     (0.201)         \\

Range of consultation&      -0.619         \\
                    &     (1.041)         \\

Party institutionalization index&       0.431         \\
                    &     (0.201)         \\

Freedom of Expression and Alternative Sources of Information index&       0.279         \\
                    &     (0.222)         \\

Relative Experience of Core Cabinet Members            &       0.843         \\
                    &     (0.866)         \\
\hline
\textbf{Royal Dictatorship}               &                     \\
Legislative constraints on the executive index&       0.287         \\
                    &     (0.254)         \\

Judicial constraints on the executive index&       0.410         \\
                    &     (0.224)         \\

Range of consultation&      -0.174         \\
                    &     (0.923)         \\

Party institutionalization index&       0.158         \\
                    &     (0.170)         \\

Freedom of Expression and Alternative Sources of Information index&       0.268         \\
                    &     (0.199)         \\

Relative Experience of Core Cabinet Members             &       0.981         \\
                    &     (1.355)         \\
\hline
\end{longtable}
%\end{spacing}
}

\end{document}

enter image description here

enter image description here

1
3

Although not exactly what you asked for, but you can quite easily fit the entire table onto a single page if you redesign it a little bit:

enter image description here

\documentclass[12pt,twoside]{report}

\usepackage{booktabs}
\usepackage{caption}
\usepackage{xltabular}
\usepackage{siunitx}
\begin{document}

\begin{table}
\caption{Executive Constraints by Regime Type}
\label{Tab:Tab 2}
\begin{tabularx}{\linewidth}{>{\small}XS[table-format=-1.4]c} 
\toprule
                    & \multicolumn{2}{c}{(1)}\\
\cmidrule{2-3}
                    & {mean} & {(sd)} \\
\midrule

\multicolumn{3}{@{}l}{\textbf{Civilian Dictatorship}}                                  \\
Legislative constraints on the executive index                     &  0.300  & (0.240) \\
Judicial constraints on the executive index                        &  0.364  & (0.246) \\
Range of consultation                                              & -0.0467 & (1.034) \\
Party institutionalization index                                   &  0.502  & (0.223) \\
Freedom of Expression and Alternative Sources of Information index &  0.367  & (0.258) \\
Relative Experience of Core Cabinet Members                        &  1.029  & (1.119) \\
\midrule
\multicolumn{3}{@{}l}{\textbf{Democracy}}                                              \\
Legislative constraints on the executive index                     &  0.749  & (0.213) \\
Judicial constraints on the executive index                        &  0.770  & (0.205) \\
Range of consultation                                              &  1.560  & (1.020) \\
Party institutionalization index                                   &  0.736  & (0.223) \\
Freedom of Expression and Alternative Sources of Information index &  0.850  & (0.136) \\
Relative Experience of Core Cabinet Members                        &  1.413  & (1.123) \\
\midrule
\multicolumn{3}{@{}l}{\textbf{Military Dictatorship}}                                  \\
Legislative constraints on the executive index                     &  0.202  & (0.184) \\
Judicial constraints on the executive index                        &  0.270  & (0.201) \\
Range of consultation                                              & -0.619  & (1.041) \\
Party institutionalization index                                   &  0.431  & (0.201) \\
Freedom of Expression and Alternative Sources of Information index &  0.279  & (0.222) \\
Relative Experience of Core Cabinet Members                        &  0.843  & (0.866) \\
\midrule
\multicolumn{3}{@{}l}{\textbf{Royal Dictatorship}}                                     \\
Legislative constraints on the executive index                     &  0.287  & (0.254) \\
Judicial constraints on the executive index                        &  0.410  & (0.224) \\
Range of consultation                                              & -0.174  & (0.923) \\
Party institutionalization index                                   &  0.158  & (0.170) \\
Freedom of Expression and Alternative Sources of Information index &  0.268  & (0.199) \\
Relative Experience of Core Cabinet Members                        &  0.981  & (1.355) \\
\bottomrule
\end{tabularx}
\end{table}


\end{document}
2

this is my proposal using xltabular package:

\documentclass[12pt,twoside]{report}

\usepackage{tabularx, booktabs,multirow,adjustbox,caption,float,subcaption, longtable}
\usepackage{xltabular}

\begin{document}

\newcolumntype{C}{>{\footnotesize\centering\arraybackslash}X}
\newcolumntype{L}{>{\footnotesize\raggedright\arraybackslash}X}


\begin{xltabular}{\textwidth} {
    >{\hsize=1.70\hsize}L
    >{\hsize=0.30\hsize}C
}

    \caption{Executive Constraints by Regime Type} \label{Tab:Tab 2}\\

    \toprule
    & (1)\\
    & mean(sd)\\ 
    \toprule
    \endfirsthead
        
    \multicolumn{2}{c}%
    {\tablename\ \thetable{}: {Continue from the previuos page.\vspace{0.3cm}}} \\
    \toprule
    & (1)\\
    & mean(sd)\\ 
    \toprule
    \endhead
        
    \midrule
    \multicolumn{2}{r}{\footnotesize\textit{Continue to the next page.}} 
    \endfoot
        
    \endlastfoot
    


\textbf{Civilian Dictatorship} & \\
Legislative constraints on the executive index&       0.300         \\
                    &     (0.240)         \\

Judicial constraints on the executive index&       0.364         \\
                    &     (0.246)         \\

Range of consultation&     -0.0467         \\
                    &     (1.034)         \\

Party institutionalization index&       0.502         \\
                    &     (0.223)         \\

Freedom of Expression and Alternative Sources of Information index&       0.367         \\
                    &     (0.258)         \\

Relative Experience of Core Cabinet Members          &       1.029         \\
                    &     (1.119)        
\\\midrule
%
\textbf{Democracy}           &                     \\
Legislative constraints on the executive index&       0.749         \\
                    &     (0.213)         \\

Judicial constraints on the executive index&       0.770         \\
                    &     (0.205)         \\

Range of consultation&       1.560         \\
                    &     (1.020)         \\

Party institutionalization index&       0.736         \\
                    &     (0.223)         \\

Freedom of Expression and Alternative Sources of Information index&       0.850         \\
                    &     (0.136)         \\

Relative Experience of Core Cabinet Members             &       1.413         \\
                    &     (1.123)         \\
\midrule
\textbf{Military Dictatorship}            &                     \\
Legislative constraints on the executive index&       0.202         \\
                    &     (0.184)         \\

Judicial constraints on the executive index&       0.270         \\
                    &     (0.201)         \\

Range of consultation&      -0.619         \\
                    &     (1.041)         \\

Party institutionalization index&       0.431         \\
                    &     (0.201)         \\

Freedom of Expression and Alternative Sources of Information index&       0.279         \\
                    &     (0.222)         \\

Relative Experience of Core Cabinet Members            &       0.843         \\
                    &     (0.866)         \\
\midrule
\textbf{Royal Dictatorship}               &                     \\
Legislative constraints on the executive index&       0.287         \\
                    &     (0.254)         \\

Judicial constraints on the executive index&       0.410         \\
                    &     (0.224)         \\

Range of consultation&      -0.174         \\
                    &     (0.923)         \\

Party institutionalization index&       0.158         \\
                    &     (0.170)         \\

Freedom of Expression and Alternative Sources of Information index&       0.268         \\
                    &     (0.199)         \\

Relative Experience of Core Cabinet Members             &       0.981         \\
                    &     (1.355)         \\


\bottomrule
\multicolumn{2}{l}{\footnotesize mean coefficients; sd in parentheses}\\
\end{xltabular}

\end{document}

enter image description here enter image description here

2

For completeness: a variation of nice @leandriis answer (+1) with use longtblr table environment defined in the tabularray package:

\documentclass[12pt,twoside]{report}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{longtblr}[
    caption={Executive Constraints by Regime Type},
      label={Tab:Tab 2},
    note{a} = {SD: Standard Deviation}
                ]{
    colspec = {X Q[c, si={table-format=-1.3,
                          round-mode=places,
                          round-precision = 3}] c},
    rowhead=2
                 }
    \toprule
                    & \SetCell[c=2]{c} {{{(1)}}}    &           \\
    \cmidrule{2-3}
                    & {{{mean}}}                    & (SD\TblrNote{a})      \\
    \midrule
\SetCell[c=3]{l, font=\bfseries}    Civilian Dictatorship          &         &         \\
Legislative constraints on the executive index                     &  0.300  & (0.240) \\
Judicial constraints on the executive index                        &  0.364  & (0.246) \\
Range of consultation                                              & -0.0467 & (1.034) \\
Party institutionalization index                                   &  0.502  & (0.223) \\
Freedom of Expression and Alternative Sources of Information index &  0.367  & (0.258) \\
Relative Experience of Core Cabinet Members                        &  1.029  & (1.119) \\
    \midrule
\SetCell[c=3]{l, font=\bfseries}    Democracy                      &         &          \\
Legislative constraints on the executive index                     &  0.749  & (0.213) \\
Judicial constraints on the executive index                        &  0.770  & (0.205) \\
Range of consultation                                              &  1.560  & (1.020) \\
Party institutionalization index                                   &  0.736  & (0.223) \\
Freedom of Expression and Alternative Sources of Information index &  0.850  & (0.136) \\
Relative Experience of Core Cabinet Members                        &  1.413  & (1.123) \\
    \midrule
\SetCell[c=3]{l, font=\bfseries}    Military Dictatorship          &         &         \\
Legislative constraints on the executive index                     &  0.202  & (0.184) \\
Judicial constraints on the executive index                        &  0.270  & (0.201) \\
Range of consultation                                              & -0.619  & (1.041) \\
Party institutionalization index                                   &  0.431  & (0.201) \\
Freedom of Expression and Alternative Sources of Information index &  0.279  & (0.222) \\
Relative Experience of Core Cabinet Members                        &  0.843  & (0.866) \\
    \midrule
\SetCell[c=3]{l, font=\bfseries}    Royal Dictatorship             &         &         \\
Legislative constraints on the executive index                     &  0.287  & (0.254) \\
Judicial constraints on the executive index                        &  0.410  & (0.224) \\
Range of consultation                                              & -0.174  & (0.923) \\
Party institutionalization index                                   &  0.158  & (0.170) \\
Freedom of Expression and Alternative Sources of Information index &  0.268  & (0.199) \\
Relative Experience of Core Cabinet Members                        &  0.981  & (1.355) \\
    \bottomrule
\end{longtblr}
\end{document}

enter image description here

0

I know I have to use the \endhead and [\endfoot] codes somewhere, but I do not know where.

I suggest you use something like the following:

Table \thetable, cont'd from preceding page\\
\hline
\endhead

\hline
\multicolumn{2}{r@{}}{\small\itshape cont'd on next page}
\endfoot

A full MWE:

enter image description here

...

enter image description here

\documentclass[12pt,twoside]{report}

\usepackage{booktabs,longtable,setspace}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\begin{document}

\begin{spacing}{1}
\begin{longtable}{@{} l d{2.4} @{}} 
\caption{Executive Constraints by Regime Type} \label{Tab:Tab 2}\\
\toprule
    & \multicolumn{1}{c@{}}{(1)}\\
    & \multicolumn{1}{c@{}}{mean (sd)}\\
\midrule
\endfirsthead

Table \thetable, cont'd from preceding page\\
\midrule
\endhead

\midrule
\multicolumn{2}{r@{}}{\small\itshape cont'd on next page}
\endfoot

\bottomrule
\endlastfoot



\textbf{Civilian Dictatorship}      & \\
Legislative constraints on the executive index& 0.300 \\
          &   (0.240) \\

Judicial constraints on the executive index& 0.364 \\
          &   (0.246) \\

Range of consultation&   -0.0467 \\
          &   (1.034) \\

Party institutionalization index& 0.502 \\
          &   (0.223) \\

Freedom of Expression and Alternative Sources of Information index& 0.367 \\
          &   (0.258) \\

Relative Experience of Core Cabinet Members     & 1.029 \\
          &   (1.119) \\
 \addlinespace

\textbf{Democracy}      & \\
Legislative constraints on the executive index& 0.749 \\
          &   (0.213) \\

Judicial constraints on the executive index& 0.770 \\
          &   (0.205) \\

Range of consultation& 1.560 \\
          &   (1.020) \\

Party institutionalization index& 0.736 \\
          &   (0.223) \\

Freedom of Expression and Alternative Sources of Information index& 0.850 \\
          &   (0.136) \\

Relative Experience of Core Cabinet Members       & 1.413 \\
          &   (1.123) \\
 \addlinespace

\textbf{Military Dictatorship}      & \\
Legislative constraints on the executive index& 0.202 \\
          &   (0.184) \\

Judicial constraints on the executive index& 0.270 \\
          &   (0.201) \\

Range of consultation&   -0.619 \\
          &   (1.041) \\

Party institutionalization index& 0.431 \\
          &   (0.201) \\

Freedom of Expression and Alternative Sources of Information index& 0.279 \\
          &   (0.222) \\

Relative Experience of Core Cabinet Members      & 0.843 \\
          &   (0.866) \\
 \addlinespace

\textbf{Royal Dictatorship} & \\
Legislative constraints on the executive index& 0.287 \\
          &   (0.254) \\

Judicial constraints on the executive index& 0.410 \\
          &   (0.224) \\

Range of consultation&   -0.174 \\
          &   (0.923) \\

Party institutionalization index& 0.158 \\
          &   (0.170) \\

Freedom of Expression and Alternative Sources of Information index& 0.268 \\
          &   (0.199) \\

Relative Experience of Core Cabinet Members       & 0.981 \\
          &   (1.355) \\

\midrule
\multicolumn{2}{@{}l}{\footnotesize mean coefficients; sd in parentheses}\\

\end{longtable}
\end{spacing}

\end{document}

You must log in to answer this question.

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