1

I am working with the following longtable on Overleaf :

\begin{longtable}{lllll}
\hline
\multicolumn{1}{|l|}{\textbf{DM}}                                                          & \multicolumn{1}{l|}{\textbf{\begin{tabular}[c]{@{}l@{}}White \\ men (n/\%)\end{tabular}}}  & \multicolumn{1}{l|}{\textbf{Black men}}                                                    & \multicolumn{1}{l|}{\textbf{White women}}                                                   & \multicolumn{1}{l|}{\textbf{Black women}}                                                   \\ \hline
\endfirsthead
%
\endhead
%
\multicolumn{1}{|l|}{\textit{Might can}}                                                   & \multicolumn{1}{l|}{24 (5\%)}                                                              & \multicolumn{1}{l|}{10  (9\%)}                                                             & \multicolumn{1}{l|}{14 (4\%)}                                                               & \multicolumn{1}{l|}{5 (4\%)}                                                                \\ \hline
\multicolumn{1}{|l|}{\textit{Might could}}                                                 & \multicolumn{1}{l|}{93 (19\%)}                                                             & \multicolumn{1}{l|}{24 (21\%)}                                                             & \multicolumn{1}{l|}{80 (21\%)}                                                              & \multicolumn{1}{l|}{22 (16\%)}                                                              \\ \hline
\multicolumn{1}{|l|}{\textit{Might would}}                                                 & \multicolumn{1}{l|}{12 (3\%)}                                                              & \multicolumn{1}{l|}{8 (7\%)}                                                               & \multicolumn{1}{l|}{8 (2\%)}                                                                & \multicolumn{1}{l|}{13 (10\%)}                                                              \\ \hline
\multicolumn{1}{|l|}{\textit{Used to could}}                                               & \multicolumn{1}{l|}{29 (6\%)}                                                              & \multicolumn{1}{l|}{9 (8\%)}                                                               & \multicolumn{1}{l|}{22 (6\%)}                                                               & \multicolumn{1}{l|}{10 (8\%)}                                                               \\ \hline
                                                                                           &                                                                                            &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\\ \\
\multicolumn{1}{|l|}{\textbf{White overall}}                                               & \multicolumn{1}{l|}{\textbf{Black overall}}                                                &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{38 (4.3\%)}                                                           & \multicolumn{1}{l|}{15 (6\%)}                                                              &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{173 (20\%)}                                                           & \multicolumn{1}{l|}{46 (19\%)}                                                             &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{20 (2\%)}                                                             & \multicolumn{1}{l|}{21 (9\%)}                                                              &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{51 (6\%)}                                                             & \multicolumn{1}{l|}{19 (8\%)}                                                              &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
                                                                                           &                                                                                            &                                                                                            &                                                                                             &                                                                                             \\ \hline
\multicolumn{1}{|l|}{\textbf{DM}}                                                          & \multicolumn{1}{l|}{\textbf{\begin{tabular}[c]{@{}l@{}}White \\ lower class\end{tabular}}} & \multicolumn{1}{l|}{\textbf{\begin{tabular}[c]{@{}l@{}}Black \\ lower class\end{tabular}}} & \multicolumn{1}{l|}{\textbf{\begin{tabular}[c]{@{}l@{}}White \\ middle class\end{tabular}}} & \multicolumn{1}{l|}{\textbf{\begin{tabular}[c]{@{}l@{}}Black \\ middle class\end{tabular}}} \\ \hline
\multicolumn{1}{|l|}{\textit{Might can}}                                                   & \multicolumn{1}{l|}{13 (6\%)}                                                              & \multicolumn{1}{l|}{10 (7\%)}                                                              & \multicolumn{1}{l|}{24 (4\%)}                                                               & \multicolumn{1}{l|}{5 (5\%)}                                                                \\ \hline
\multicolumn{1}{|l|}{\textit{Might could}}                                                 & \multicolumn{1}{l|}{55 (26\%)}                                                             & \multicolumn{1}{l|}{33 (23\%)}                                                             & \multicolumn{1}{l|}{105 (19\%)}                                                             & \multicolumn{1}{l|}{11 (12\%)}                                                              \\ \hline
\multicolumn{1}{|l|}{\textit{Might would}}                                                 & \multicolumn{1}{l|}{10 (5\%)}                                                              & \multicolumn{1}{l|}{11 (8\%)}                                                              & \multicolumn{1}{l|}{10 (2\%)}                                                               & \multicolumn{1}{l|}{9 (10\%)}                                                               \\ \hline
\multicolumn{1}{|l|}{\textit{Used to could}}                                               & \multicolumn{1}{l|}{21 (10\%)}                                                             & \multicolumn{1}{l|}{13 (9\%)}                                                              & \multicolumn{1}{l|}{29 (5\%)}                                                               & \multicolumn{1}{l|}{5 (5\%)}                                                                \\ \hline
                                                                                           &                                                                                            &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{\textbf{\begin{tabular}[c]{@{}l@{}}White\\ upper class\end{tabular}}} & \multicolumn{1}{l|}{\textbf{\begin{tabular}[c]{@{}l@{}}Black\\ upper class\end{tabular}}}  &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{1 (1\%)}                                                              & \multicolumn{1}{l|}{0 (0\%)}                                                               &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{13 (11\%)}                                                            & \multicolumn{1}{l|}{2 (22\%)}                                                              &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{0 (0\%)}                                                              & \multicolumn{1}{l|}{1 (11\%)}                                                              &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\multicolumn{1}{|l|}{1 (1\%)}                                                              & \multicolumn{1}{l|}{1 (11\%)}                                                              &                                                                                            &                                                                                             &                                                                                             \\ \cline{1-2}
\\
\caption{Incidence of four DMs in LAGS by ethnicity, gender, and social class \citep[from][]{mishoe_pragmatics_1994}\label{table:mishoetable}}
\end{longtable}

When my table spreads across two pages, one of the \hlines produces an isolated horizontal line separated from its tabular object:

When I try moving my table down, hoping that the hline will join its mini-table, I get a duplicated line :

Is there anyway to make my table (and it's sub-components) behave more uniformly?

Here's a simplified version of my overleaf project :

https://www.overleaf.com/read/xtvjmtwxmscz

Would appreciate some help !

Cameron

5
  • Just out of idle curiosity: What's the purpose of the \multicolumn{1}{|l|}{...} wrapper directives?
    – Mico
    Jan 20 at 10:54
  • I must confess I'm not sure why, because I generated this longtable from the following website : tablesgenerator.com/latex_tables
    – Cameron
    Jan 20 at 11:21
  • 1
    I actually suspected as much when I asked the question. The quality of the code generated by tablegenerator.com is simply awful.
    – Mico
    Jan 20 at 11:42
  • Do you know of any generators (preferably online) which would do a better job than the above?
    – Cameron
    Jan 20 at 12:14
  • In my opinion, the code created by all online table generator sites is poor. For sure, their code is virtually unmaintainable by humans.
    – Mico
    Jan 20 at 12:33
1

Here's a much-simplified version of your code, mainly by getting rid of all \multicolumn{1}{.}{.} wrapppers and by switching from a longtable setup to a table/tabular setup. I've also gotten rid of all vertical lines and most horizontal lines in order to give the table a much more open "look", and I've dispensed with all \textbf directives -- they're simply not needed. Finally, I've also shifted the second and fourth groups by one column to the right.

enter image description here

\documentclass{article}
\usepackage{booktabs}
\usepackage{natbib}
\newcommand\mytab[1]{\begin{tabular}[t]{@{}l@{}} #1 \end{tabular}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{} lllll }
\toprule
DM & \mytab{White men \\ (n/\%)} & Black men & White women & Black women \\ 
\midrule
\textit{Might can}     & 24  (5\%) & 10  (9\%) & 14  (4\%) &  5  (4\%) \\ 
\textit{Might could}   & 93 (19\%) & 24 (21\%) & 80 (21\%) & 22 (16\%) \\ 
\textit{Might would}   & 12  (3\%) &  8  (7\%) &  8  (2\%) & 13 (10\%) \\ 
\textit{Used to could} & 29  (6\%) &  9  (8\%) & 22  (6\%) & 10  (8\%) \\ 
\bottomrule
\\
\cmidrule[\heavyrulewidth]{2-3}
& \mytab{White \\ overall} & \mytab{Black \\ overall} \\ 
\cmidrule[\lightrulewidth]{2-3}
& 38 (4.3\%) & 15  (6\%) \\ 
&173 (20\%)  & 46 (19\%) \\ 
& 20  (2\%)  & 21  (9\%) \\ 
& 51  (6\%)  & 19  (8\%) \\ 
\cmidrule[\heavyrulewidth]{2-3}
\\ 
\toprule
DM & \mytab{White \\ lower class} & \mytab{Black \\ lower class} & \mytab{White \\ middle class} & \mytab{Black \\ middle class} \\ 
\midrule
\textit{Might can}     & 13  (6\%) & 10  (7\%) &  24  (4\%) &  5  (5\%) \\ 
\textit{Might could}   & 55 (26\%) & 33 (23\%) & 105 (19\%) & 11 (12\%) \\ 
\textit{Might would}   & 10  (5\%) & 11  (8\%) &  10  (2\%) &  9 (10\%) \\ 
\textit{Used to could} & 21 (10\%) & 13  (9\%) &  29  (5\%) &  5  (5\%) \\ 
\bottomrule
\\ 
\cmidrule[\heavyrulewidth]{2-3}
&\mytab{White \\ upper class} & \mytab{Black \\ upper class} \\ 
\cmidrule[\lightrulewidth]{2-3}
& 1  (1\%) & 0  (0\%) \\ 
&13 (11\%) & 2 (22\%) \\ 
& 0  (0\%) & 1 (11\%) \\ 
& 1  (1\%) & 1 (11\%) \\ 
\cmidrule[\heavyrulewidth]{2-3}
\end{tabular}

\caption{Incidence of four DMs in LAGS, by ethnicity, gender, and social class 
         \citep[from][]{mishoe_pragmatics_1994}}
\label{table:mishoetable}
\end{table}
\end{document}
2
  • Wow, thanks a lot ! I initially assumed table generators would save me time, but learning to code them seems to let you make much nicer tables such as this one
    – Cameron
    Jan 20 at 12:33
  • 1
    @Cameron - You're most welcome.
    – Mico
    Jan 20 at 12:34

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.