1

Using this code works

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\singlespacing
\begin{longtable}{ L{3cm} L{4cm} L{4cm} L{4cm} L{4cm} }

\caption{Determination of whether studies' outcomes were concordant with any theoretical framework invoked} \label{tab:long} \\

\hline 
\multicolumn{1}{c}{\textbf{Study}} & \multicolumn{1}{c}{\textbf{Outcome 1}} & \multicolumn{1}{c}{\textbf{Outcome 2}} &
\multicolumn{1}{c}{\textbf{Theory invoked}} &
\multicolumn{1}{c}{\textbf{Determination}} \\ \hline 
\endfirsthead

\hline \multicolumn{1}{r}{{Continued on next page}} \\ \hline
\endfoot

\hline 
\multicolumn{1}{c}{\textbf{Study}} & \multicolumn{1}{c}{\textbf{Outcome 1}} & \multicolumn{1}{c}{\textbf{Outcome 2}}&
\multicolumn{1}{c}{\textbf{Theory invoked}}&
\multicolumn{1}{c}{\textbf{Determination}} \\ \hline 
\endhead

\hline \multicolumn{5}{r}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

Cassidy & Marijuana vaping with ENDS or otherwise in the past 30 days vs. none & X & X & X \\
Lozano & Past 12-month marijuana use vs. none & X & X & X \\
Dai & Past 12-month marijuana use vs. none & Weekly or more often use of marijuana, hash, THC, grass, pot, or weed vs. none & X & X \\ 
Audrain-McGovern & Past 30-day combustible marijuana use vs. not, marijuana vaping vs. not, and edible marijuana use vs. not & Ever combustible marijuana use vs. none, marijuana vaping vs. none, and edible marijuana use vs. none & X & X \\
Unger & Marijuana use in the past month & X & X & X \\
Park & Marijuana use in the last 6 months vs. none  & X & X & X \\
Wong & Past-month marijuana use at Wave 3 vs. none  & X & X & X \\
Rogers & Any marijuana use in the past 30 days vs. none  & X & X & X \\
Pokhrel & Past 12-month marijuana use vs. not  & X & X & X \\
Evans-Polce & Past 30-day nonmedical prescription tranquilizer, sedative, stimulant, or opioid use use  & X & X & X \\
Lee & Ever marijuana vaping in Wave 4 vs. none  & X & X & X \\
Butler & Cannabis use (at least monthly in the last 12 months) at T2  & X & X & X \\
Bentivegna & Past 12-month use of marijuana in Wave 2 or Wave 3  & X & X & X \\
Ksinan & Never cannabis use vs. cannabis use 1-5 times in the past 12 months vs. 6 or more times in the past 12 months  & X & X & X \\
Ortega & Ever use of marijuana vs. not at each of two follow-up years  & X & X & X \\
Seidel & Cannabis use: not at all vs. only a few puffs vs. 1-19 times vs. 20-100 times vs. more than 100 times  & X & X & X \\

\end{longtable}
\end{landscape}

If I change \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} to \newcolumntype{P}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}} and the L's to P's in \begin{longtable}{ L{3cm} L{4cm} L{4cm} L{4cm} L{4cm} }, I get an error.

1
  • 1
    From your code fragment is hard to say, why you receive errors. If I expand it to complete small document, it works fine using L and P columns. Please extend your code fragment to complete small document with your table, which we can compile as it is and which reproduce your problem
    – Zarko
    Nov 20, 2021 at 3:05

1 Answer 1

0

Change from L column type to P doesn't throw an error, but your code fragment has other issues: in table preamble you have two definitions of foot.

I would a wee bit redesign your table. In it I would:

  • instead of \hline use rules defined in the booktabs package
  • between rows insert \addlinespace also defined in booktabs package
  • define caption width to be equal to text width
  • for column headers use \thead macro defined in the makecell package
\documentclass{article}
\usepackage{booktabs, longtable, makecell}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{P}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\renewcommand\theadfont{\bfseries}
\usepackage{pdflscape}

\begin{document}
\begin{landscape}
\setlength\LTleft{0pt}
\setlength\LTcapwidth\linewidth

%\begin{longtable}{ L{3cm} *{4}{L{4cm}} }
\begin{longtable}{ P{3cm} *{4}{P{4cm}} }

\caption{Determination of whether studies' outcomes were concordant with any theoretical framework invoked} 
\label{tab:long}                            \\
    \toprule
\thead{Study}   & \thead{Outcome 1}         & \thead{Outcome 2} 
                & \thead{Theory invoked}    & \thead{Determination} \\ 
    \midrule
\endfirsthead
\caption[]{Determination of whether studies' outcomes were concordant with any theoretical framework invoked (cont.)}      \\
    \toprule
\thead{Study}   & \thead{Outcome 1}         & \thead{Outcome 2}
                & \thead{Theory invoked}    & \thead{Determination} \\
    \midrule
\endhead
    \midrule
\multicolumn{5}{r}{\footnotesize\textit{Continued on next page}}    \\ 
\endfoot
    \bottomrule
\endlastfoot

Cassidy     & Marijuana vaping with ENDS or otherwise in the past 30 days vs. none 
                & X & X & X     \\  \addlinespace
Lozano      & Past 12-month marijuana use vs. none 
                & X & X & X     \\  \addlinespace
Dai         & Past 12-month marijuana use vs. none 
                & Weekly or more often use of marijuana, hash, THC, grass, pot, or weed vs. none 
                    & X & X     \\  \addlinespace
Audrain-McGovern 
            & Past 30-day combustible marijuana use vs. not, marijuana vaping vs. not, and edible marijuana use vs. not 
                & Ever combustible marijuana use vs. none, marijuana vaping vs. none, and edible marijuana use vs. none 
                    & X & X     \\  \addlinespace
Unger       & Marijuana use in the past month 
                & X & X & X     \\  \addlinespace
Park        & Marijuana use in the last 6 months vs. none  
                & X & X & X     \\  \addlinespace
Wong        & Past-month marijuana use at Wave 3 vs. none  
                & X & X & X     \\  \addlinespace
Rogers      & Any marijuana use in the past 30 days vs. none  
                & X & X & X     \\  \addlinespace
Pokhrel     & Past 12-month marijuana use vs. not  
                & X & X & X     \\  \addlinespace
Evans-Polce & Past 30-day nonmedical prescription tranquilizer, sedative, stimulant, or opioid use
                & X & X & X     \\  \addlinespace
Lee         & Ever marijuana vaping in Wave 4 vs. none  
                & X & X & X     \\  \addlinespace
Butler      & Cannabis use (at least monthly in the last 12 months) at T2  
                & X & X & X     \\  \addlinespace
Bentivegna  & Past 12-month use of marijuana in Wave 2 or Wave 3  
                & X & X & X     \\  \addlinespace
Ksinan      & Never cannabis use vs. cannabis use 1-5 times in the past 12 months vs. 6 or more times in the past 12 months  
                & X & X & X     \\  \addlinespace
Ortega      & Ever use of marijuana vs. not at each of two follow-up years  
                & X & X & X     \\  \addlinespace
Seidel      & Cannabis use: not at all vs. only a few puffs vs. 1-19 times vs. 20-100 times vs. more than 100 times  
                & X & X & X     \\
\end{longtable}
\end{landscape}
\end{document}

enter image description here

So I cant say, what is going wrong in your document.

1
  • this worked! I think the issue was in the preamble for my dissertation document, the table format was pre-specified. I had to overrule that with \usepackage{booktabs, longtable, makecell}
    – Alex
    Nov 20, 2021 at 15:27

You must log in to answer this question.

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