在 Overleaf 的 longtable 中使用 \newline 中断表(续)

在 Overleaf 的 longtable 中使用 \newline 中断表(续)

我在 Overleaf 中创建了一个长表,总共有 10 行(每个作者一行)。我习惯将\newlineRoB 放在最后一列。但是,这会打断“表格在下一页继续”的操作,因为它会被推到表格上方的页面上。我希望能够将所有 RoB 结果分离出来,但似乎找不到解决办法。

\documentclass{article}
\usepackage[utf8]{inputenc}
 
%%%%%%%%%%%%%%%%%%%% Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Packages
\usepackage{graphicx,psfrag,color} % for postscript graphics files
  \graphicspath{ {./images/} }
\usepackage{amsmath}               % assumes amsmath package installed
  \allowdisplaybreaks[1]           % allow eqnarrays to break across pages
\usepackage{amssymb}               % assumes amsmath package installed 
\usepackage{url}                   % format hyperlinks correctly
\usepackage{rotating}              % allow portrait figures and tables
\usepackage{multirow}              % allows merging of rows in tables
\usepackage{lscape}                % allows pages to be typeset in landscape mode
\usepackage{tabularx}              % allows fixed width tables
\usepackage{verbatim}              % enhanced version of built-in verbatim environment
\usepackage{footnote}              % allows more control over footnote environments
\usepackage{float}                 % allows H option on floats to force here placement
\usepackage{booktabs}              % improve table line spacing
\usepackage{subcaption}            % for multiple sub-figures in a single float
\usepackage{siunitx}               % add SI units

% Add your packages here
\usepackage[none]{hyphenat}
\usepackage{dirtytalk}
\usepackage[utf8]{inputenc}
\usepackage{vcell}
\usepackage{array}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{rotating}
\usepackage{caption}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{longtable,lscape}
\usepackage{pdfpages}
\usepackage{atbegshi}
\usepackage{pdflscape}
\usepackage{ifthen}
\usepackage{calc}

%%%%%%%%%%%%%%%%%%%%% Begin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{landscape}
    \small
    
    \begin{longtable}{ 
     p{0.1\dimexpr \textwidth-3\arrayrulewidth-4\tabcolsep\relax}|
     p{0.2\dimexpr \textwidth-3\arrayrulewidth-4\tabcolsep\relax}|
     p{0.1\dimexpr \textwidth-3\arrayrulewidth-4\tabcolsep\relax}|
     p{0.4\dimexpr \textwidth-3\arrayrulewidth-4\tabcolsep\relax}|
     p{0.1\dimexpr \textwidth-3\arrayrulewidth-4\tabcolsep\relax}|
     p{0.4\dimexpr \textwidth-3\arrayrulewidth-4\tabcolsep\relax}|
    }
    \caption{Characteristics of included reviews} \label{tab:long} \\
    
    \hline \multicolumn{1}{|c|}{\textbf{Author / year}} 
    & \multicolumn{1}{c|}{\textbf{Synthesis type}} 
    & \multicolumn{1}{c|}{\textbf{Search dates}}
    & \multicolumn{1}{c|}{\textbf{PICO}} 
    & \multicolumn{1}{c|}{\textbf{No of RCTs}} 
    & \multicolumn{1}{c|}{\textbf{RoB (\%)}} \\ 
    \hline 
    \endfirsthead
    
    \multicolumn{6}{c}%
    {{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
    \hline \multicolumn{1}{|c|}{\textbf{Author / year}} 
    & \multicolumn{1}{c|}{\textbf{Synthesis type}} 
    & \multicolumn{1}{c|}{\textbf{Search dates}} 
    & \multicolumn{1}{c|}{\textbf{PICO}} 
    & \multicolumn{1}{c|}{\textbf{No of RCTs}} 
    & \multicolumn{1}{c|}{\textbf{RoB (\%)}} \\ \hline 
    \endhead
    
    \hline \multicolumn{6}{|r|}{{Continued on next page}} \\ \hline
    \endfoot
    
    \hline \hline
    \endlastfoot
    
    %%%%%%%%%%%%%%%%%%%%%% Insert first author %%%%%%%%%%%%%%%%%%
    
    Staley et al., 2021 & Meta-analysis & 1946 to 2020 & {\textbf{Population:} Women eligible to participate in a cervical cancer screening program as defined by the entry criteria for that program, including women due, overdue, those returning for repeat screening and women returning for follow up after abnormal result} 
    
    \newline{\textbf{Intervention:} Invitations, reminders, education, message framing, counselling, risk factor assessment, procedures, and economic interventions} \newline{\textbf{Comparison:} No intervention or routine / standard care} \newline{\textbf{Outcomes:} Uptake of cervical screening} 
    
    & 70 
    
    & {\textbf{Cochrane risk of bias tool:}} \newline 
    
    {\textbf{Random sequence generation}} \newline Low risk (33 studies; 47\%) \newline Unclear (35 studies; 50\%) \newline High risk (2 studies; 3\%) 
    
    {\textbf{Allocation concealment}} \newline Low risk (11 studies; 16\%) \newline Unclear (57 studies; 81\%) \newline High risk (2 studies; 3\%)
    
    {\textbf{Blinding: all outcomes}} \newline Low risk (9 studies; 13\%) \newline Unclear (59 studies; 84\%) \newline High risk (2 studies; 3\%)
    
    {\textbf{Incomplete outcome data, all outcomes}} \newline Low risk (42 studies; 60\%) \newline Unclear (9 studies; 13\%) \newline High risk (18 studies; 26\%) 
    
    {\textbf{Incomplete outcome data, all outcomes}} \newline Low risk (42 studies; 60\%) \newline Unclear (9 studies; 13\%) \newline High risk (18 studies; 26\%) 
    
    {\textbf{Incomplete outcome data, all outcomes}} \newline Low risk (42 studies; 60\%) \newline Unclear (9 studies; 13\%) \newline High risk (18 studies; 26\%) 
    
    \\
    
    \end{longtable}
    \end{landscape}

\end{document}

答案1

编辑:

  • 您的问题与 Overlief(只是编辑器)无关
  • 对于您的表格,longtable最好使用\longtblrtabularray一些好处:表格代码更短,结构清晰,列宽比例定义简单。
  • 最好\newline使用包中定义的列表(两级) 。这样,单元格文本中enumitem使用的问题就消除了。\newline
  • 您应该知道,所有类型的长表格只能在行之间拆分。由于您的表格(由于重复的行)有点太高,以至于第二行的重复无法放在一页中,因此在横向环境中,它会被推到下一页。可以通过两种方式处理此问题:
    • 减小字体大小至\footnotesize
    • 增加页面上的文本区域(通过使用包geometry
  • 为了展示工作原理longtblr,在下面的 MWE 中使用第二个选项和第二行重复三次。
\documentclass{article}
\usepackage[hmargin=20mm]{geometry} % added

\usepackage{pdflscape}        
\usepackage{caption}

\usepackage{xcolor}                 % changed
\usepackage{tabularray}
\UseTblrLibrary{siunitx, varwidth}  % added
\usepackage{enumitem}               % added

\begin{document}
    \begin{landscape}
\setlist[itemize]{nosep,
                  label={},  % <---
                  leftmargin=*,
                  itemsep=1ex,
                }
\setlist[itemize,2]{itemsep=0ex}
%
\NewTblrTheme{fancy}{
    \SetTblrStyle{head}{font=\small}
    \SetTblrStyle{foot}{font=\footnotesize}
    \SetTblrStyle{caption-tag}{font=\bfseries}
                    }
    \small
\begin{longtblr}[
  theme = fancy,
caption = {Characteristics of included reviews},
  label = {tab:long} 
                ]{hlines, vlines,
                  colspec = {*{3}{X[h, l]} 
                                  X[3.0, l, h] 
                                  X[0.6, c, h]  
                                  X[3.0, l, h] },
                  colsep = 4pt,
                  row{1}  = {font=\footnotesize\bfseries, c, m},
                  measure = vbox,            % <===
                  stretch = -1, %<--- remove extra space above and below lists
                                % with "nosep" option; tabularray doc p.51
%
                  rowhead = 1,
                  }
% column headers
Author/ year
    &   Synthesis type 
        &   Search dates 
            &   PICO 
                &   No of RCTs 
                    &  RoB (\%)           
                    \\ 
% table body
Staley et al., 2021
    & Meta-analysis
        & 1946 to 2020
                    &   \begin{itemize}
                    \item   \textbf{Cochrane risk of bias tool:}
                    \item   \textbf{Random sequence generation}
                            \begin{itemize}
                        \item   Low risk (33 studies; \qty{47}{\%})
                        \item   Unclear (35 studies; \qty{50}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Allocation concealment}
                            \begin{itemize}
                        \item    Low risk (11 studies; \qty{16}{\%})
                        \item   Unclear (57 studies; \qty{81}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Blinding: all outcomes}
                            \begin{itemize}
                        \item    Low risk (9 studies; \qty{13}{\%})
                        \item    Unclear (59 studies; \qty{84}{\%})
                        \item    High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Incomplete outcome data, all outcomes}
                           \begin{itemize}
                        \item   Low risk (42 studies; \qty{60}{\%})
                        \item   Unclear (9 studies; \qty{13}{\%})
                        \item   High risk (18 studies; \qty{26}{\%})    \\
                            \end{itemize}
                        \end{itemize}
                        & 70 &  \begin{itemize}
                    \item   \textbf{Cochrane risk of bias tool:}
                    \item   \textbf{Random sequence generation}
                            \begin{itemize}
                        \item   Low risk (33 studies; \qty{47}{\%})
                        \item   Unclear (35 studies; \qty{50}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                                       \item   \textbf{Allocation concealment}
                            \begin{itemize}
                        \item   Low risk (11 studies; \qty{16}{\%})
                        \item   Unclear (57 studies; \qty{81}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Blinding: all outcomes}
                            \begin{itemize}
                        \item    Low risk (9 studies; \qty{13}{\%})
                        \item    Unclear (59 studies; \qty{84}{\%})
                        \item    High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Incomplete outcome data, all outcomes}
                           \begin{itemize}
                        \item   Low risk (42 studies; \qty{60}{\%})
                        \item   Unclear (9 studies; \qty{13}{\%})
                        \item   High risk (18 studies; \qty{26}{\%})
                            \end{itemize}
                        \end{itemize}                           \\
%%
Staley et al., 2021
    & Meta-analysis
        & 1946 to 2020
                    &   \begin{itemize}
                    \item   \textbf{Cochrane risk of bias tool:}
                    \item   \textbf{Random sequence generation}
                            \begin{itemize}
                        \item   Low risk (33 studies; \qty{47}{\%})
                        \item   Unclear (35 studies; \qty{50}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Allocation concealment}
                            \begin{itemize}
                        \item    Low risk (11 studies; \qty{16}{\%})
                        \item   Unclear (57 studies; \qty{81}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Blinding: all outcomes}
                            \begin{itemize}
                        \item    Low risk (9 studies; \qty{13}{\%})
                        \item    Unclear (59 studies; \qty{84}{\%})
                        \item    High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Incomplete outcome data, all outcomes}
                           \begin{itemize}
                        \item   Low risk (42 studies; \qty{60}{\%})
                        \item   Unclear (9 studies; \qty{13}{\%})
                        \item   High risk (18 studies; \qty{26}{\%})    \\
                            \end{itemize}
                        \end{itemize}
                        & 70 &  \begin{itemize}
                    \item   \textbf{Cochrane risk of bias tool:}
                    \item   \textbf{Random sequence generation}
                            \begin{itemize}
                        \item   Low risk (33 studies; \qty{47}{\%})
                        \item   Unclear (35 studies; \qty{50}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                                       \item   \textbf{Allocation concealment}
                            \begin{itemize}
                        \item   Low risk (11 studies; \qty{16}{\%})
                        \item   Unclear (57 studies; \qty{81}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Blinding: all outcomes}
                            \begin{itemize}
                        \item    Low risk (9 studies; \qty{13}{\%})
                        \item    Unclear (59 studies; \qty{84}{\%})
                        \item    High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Incomplete outcome data, all outcomes}
                           \begin{itemize}
                        \item   Low risk (42 studies; \qty{60}{\%})
                        \item   Unclear (9 studies; \qty{13}{\%})
                        \item   High risk (18 studies; \qty{26}{\%})
                            \end{itemize}
                        \end{itemize}                           \\
%%
Staley et al., 2021
    & Meta-analysis
        & 1946 to 2020
                    &   \begin{itemize}
                    \item   \textbf{Cochrane risk of bias tool:}
                    \item   \textbf{Random sequence generation}
                            \begin{itemize}
                        \item   Low risk (33 studies; \qty{47}{\%})
                        \item   Unclear (35 studies; \qty{50}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Allocation concealment}
                            \begin{itemize}
                        \item    Low risk (11 studies; \qty{16}{\%})
                        \item   Unclear (57 studies; \qty{81}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Blinding: all outcomes}
                            \begin{itemize}
                        \item    Low risk (9 studies; \qty{13}{\%})
                        \item    Unclear (59 studies; \qty{84}{\%})
                        \item    High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Incomplete outcome data, all outcomes}
                           \begin{itemize}
                        \item   Low risk (42 studies; \qty{60}{\%})
                        \item   Unclear (9 studies; \qty{13}{\%})
                        \item   High risk (18 studies; \qty{26}{\%})    \\
                            \end{itemize}
                        \end{itemize}
                        & 70 &  \begin{itemize}
                    \item   \textbf{Cochrane risk of bias tool:}
                    \item   \textbf{Random sequence generation}
                            \begin{itemize}
                        \item   Low risk (33 studies; \qty{47}{\%})
                        \item   Unclear (35 studies; \qty{50}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                                       \item   \textbf{Allocation concealment}
                            \begin{itemize}
                        \item   Low risk (11 studies; \qty{16}{\%})
                        \item   Unclear (57 studies; \qty{81}{\%})
                        \item   High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Blinding: all outcomes}
                            \begin{itemize}
                        \item    Low risk (9 studies; \qty{13}{\%})
                        \item    Unclear (59 studies; \qty{84}{\%})
                        \item    High risk (2 studies; \qty{3}{\%})
                            \end{itemize}
                    \item   \textbf{Incomplete outcome data, all outcomes}
                           \begin{itemize}
                        \item   Low risk (42 studies; \qty{60}{\%})
                        \item   Unclear (9 studies; \qty{13}{\%})
                        \item   High risk (18 studies; \qty{26}{\%})
                            \end{itemize}
                        \end{itemize}                           \\
    \end{longtblr}
    \end{landscape}
\end{document}

在此处输入图片描述

相关内容