当我使用长表格和分页符时,我想如何拆分表格,但不起作用。我想在 15 次引用后拆分它

当我使用长表格和分页符时,我想如何拆分表格,但不起作用。我想在 15 次引用后拆分它
\documentclass{article}
\usepackage{longtable}
\usepackage{multirow}


\begin{document}
\begin{table*}[!htp]
\setlength\extrarowheight{6pt}
\caption{Relevant heuristic techniques}\label{title}
\centering
\begin{tabular}{| >{\centering\arraybackslash}m{0.8in} | >{\centering\arraybackslash}m{1.1in} | >{\centering\arraybackslash}m{1.4in} | >{\centering\arraybackslash}m{1.2in}|}
 \hline
 Techniques         &  Aim & Distinctive attributes &  Limitations \\ %\midrule
 \hline
Hybrid technique (GA and WDO) \cite{8}&  Minimization of cost and PAR& HEMS model is considered with DER and energy storage system& User comfort is ignored\\
\hline
EA \cite{9} & Cost reduction  & Energy optimization in residential area, commercial area, and industrial & System complexity is enhanced     \\
 \hline
 BPSO \cite{10}& Primary steps of BPSO, its variant, and application& Working of BPSO in complex environment, its improved steps, and merging with other techniques discussed& Practical implementation not addressed\\
\hline
BPSO \cite{11}& Cost minimization & Scheduling Energy consumption patterns of appliances, its simplicity & PAR is not addressed and user comfort is ignored\\
\hline
 GA \cite{12}& Cost reduction and user comfort& User comfort by optimizing energy consumption behavior of residential, commercial and industrial area  & System deals with large number of appliances in multiple sector which increases system complexity \\
\hline
GA, BPSO, ACO \cite{13}& Cost and PAR reduction & HEMC schedules the appliances by considering user satisfaction and RESs integration& Computational time and system complexity is increased\\
\hline
GA \cite{14}& User comfort and cost reduction & Optimizes energy consumption behavior with RESs incorporation &  Practical implementation increases system complexity\\
\hline
 Hybrid(LP and BPSO) \cite{15}& Cost reduction and user comfort maximization  & Thermostatically and interruptible appliances are considered with load ahead pricing model & PAR is not considered \\
\hline 
\pagebreak
FP \cite{16} & Electricity cost reduction  & Cost efficient model with DES and practical implementation of the model proposed   & PAR and User comfort are not taken into account\\
\hline
GA \cite{17}& Cost and PAR reduction& For efficient cost model time slots are divided& System complexity and computational time enhances\\
\hline\\
HSA \cite{18}& Basic concept of HSA, its structure, and applications& Improved and Hybrid HSA with application & Real time implementation  is not considered   \\
\hline
\end{tabular}
\end{table*}
\end{document} 

答案1

在倒数第二行中,输入hline命令后\\,将其删除。

对于您的表格,我将更改页面布局(例如通过使用geometry包),使用tabularx表格环境并cellspace在单元格内容周围留出更多空间:

    \documentclass{article}
    \usepackage{array, cellspace, multirow, tabularx}
    \renewcommand\tabularxcolumn[1]{m{#1}}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

    \usepackage[showframe,margin=25mm]{geometry}% <-- added

    \begin{document}
    \begin{table*}
   % \setlength\extrarowheight{6pt}
    \caption{Relevant heuristic techniques}\label{title}
    \centering
    \begin{tabularx}{\linewidth}{| >{\centering\arraybackslash}m{1in} | C | C | C|}

通过这些改变我获得:

在此处输入图片描述

您可以使用包中的规则进一步改善表格外观booktabs。在这种情况下,您不需要cellspace包来在单元格内容周围留出更多垂直空间。现在可以使用以下方法实现\addlinespace

    \documentclass{article}
    \usepackage{array, booktabs, multirow, tabularx}
%    \renewcommand\tabularxcolumn[1]{m{#1}}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
    \newcolumntype{L}{>{\raggedright\arraybackslash}X}
%\setlength\cellspacetoplimit{4pt}
%\setlength\cellspacebottomlimit{4pt}

    \usepackage[showframe,margin=25mm]{geometry}% <-- added

    \begin{document}
    \begin{table*}
   % \setlength\extrarowheight{6pt}
    \caption{Relevant heuristic techniques}\label{title}
    \centering
    \begin{tabularx}{\linewidth}{ >{\raggedright}p{1in}  L  L  L}
     \toprule
     Techniques         &  Aim & Distinctive attributes &  Limitations \\ %\midrule
     \midrule
    Hybrid technique (GA and WDO) \cite{8}&  Minimization of cost and PAR& HEMS model is considered with DER and energy storage system& User comfort is ignored\\
\addlinespace
    EA \cite{9} & Cost reduction  & Energy optimization in residential area, commercial area, and industrial & System complexity is enhanced     \\
\addlinespace
     BPSO \cite{10}& Primary steps of BPSO, its variant, and application& Working of BPSO in complex environment, its improved steps, and merging with other techniques discussed& Practical implementation not addressed\\
\addlinespace
    BPSO \cite{11}& Cost minimization & Scheduling Energy consumption patterns of appliances, its simplicity & PAR is not addressed and user comfort is ignored\\
\addlinespace
     GA \cite{12}& Cost reduction and user comfort& User comfort by optimizing energy consumption behavior of residential, commercial and industrial area  & System deals with large number of appliances in multiple sector which increases system complexity \\
\addlinespace
    GA, BPSO, ACO \cite{13}& Cost and PAR reduction & HEMC schedules the appliances by considering user satisfaction and RESs integration& Computational time and system complexity is increased\\
\addlinespace
    GA \cite{14}& User comfort and cost reduction & Optimizes energy consumption behavior with RESs incorporation &  Practical implementation increases system complexity\\
\addlinespace
     Hybrid(LP and BPSO) \cite{15}& Cost reduction and user comfort maximization  & Thermostatically and interruptible appliances are considered with load ahead pricing model & PAR is not considered \\
\addlinespace
%    \pagebreak
    FP \cite{16} & Electricity cost reduction  & Cost efficient model with DES and practical implementation of the model proposed   & PAR and User comfort are not taken into account\\
\addlinespace
    GA \cite{17}& Cost and PAR reduction& For efficient cost model time slots are divided& System complexity and computational time enhances\\
\addlinespace
    HSA \cite{18}& Basic concept of HSA, its structure, and applications& Improved and Hybrid HSA with application & Real time implementation  is not considered   \\
    \bottomrule
    \end{tabularx}
    \end{table*}
    \end{document}

在此处输入图片描述

在两种解决方案中都不考虑使用longtable,因为对于选定的页面布局,这是不必要的。请注意,\pagebreaktable环境中使用和在中都longtable无法像您预期的那样工作。我在两个显示的示例中都将其删除。

table*可以从中得出这样的结论:您的文档有两列,但 MWE 中没有设置。table*表格定位选项不起作用,因为它只能位于(下一页)的顶部。

如果您确实需要longtable,那么您不能将其括在table环境中,如果文档中有两列,则会导致进一步的复杂化,因为您需要停止两列(在下一页的顶部再次推表)

附录: 由于某种原因,您要求将可以放在一页中的表格拆分成几页(按规定的行)。如果您将表格直接放在文档中,并使用标题caption包或capt-of手动将表格分成两张表格...或使用longtable(请参阅下面的 MWE),并希望它会在所需的行处进行划分(如果页面上有足够的空间容纳表格的第一部分,则可能会发生这种情况)。

\documentclass{article}
\usepackage{array, booktabs, longtable}
\usepackage{ragged2e}% for dummy text

\usepackage[showframe,margin=25mm]{geometry}% <-- added
\usepackage{lipsum}% for dummy text

\begin{document}
\lipsum[1]
\begin{longtable}{>{\RaggedRight}p{1in}
             *{3}{>{\RaggedRight}p{\dimexpr0.333\linewidth-0.333in-2.667\tabcolsep}}
                 }
\caption{Relevant heuristic techniques}
    \label{title}\\
 \toprule
 Techniques         &  Aim & Distinctive attributes &  Limitations \\
 \midrule
 \endfirsthead
\caption{Relevant heuristic techniques (cont.)}
    \label{title}\\
 \toprule
 Techniques         &  Aim & Distinctive attributes &  Limitations \\
 \midrule
 \endhead
 \midrule[0.8pt]
 \multicolumn{4}{r}{continue on the next page}
 \endfoot
 \bottomrule
 \endlastfoot
 % table content
Hybrid technique (GA and WDO) \cite{8}&  Minimization of cost and PAR& HEMS model is considered with DER and energy storage system& User comfort is ignored\\
\addlinespace
EA \cite{9} & Cost reduction  & Energy optimization in residential area, commercial area, and industrial & System complexity is enhanced     \\
\addlinespace
 BPSO \cite{10}& Primary steps of BPSO, its variant, and application& Working of BPSO in complex environment, its improved steps, and merging with other techniques discussed& Practical implementation not addressed\\
\addlinespace
BPSO \cite{11}& Cost minimization & Scheduling Energy consumption patterns of appliances, its simplicity & PAR is not addressed and user comfort is ignored\\
\addlinespace
 GA \cite{12}& Cost reduction and user comfort& User comfort by optimizing energy consumption behavior of residential, commercial and industrial area  & System deals with large number of appliances in multiple sector which increases system complexity \\
\addlinespace
GA, BPSO, ACO \cite{13}& Cost and PAR reduction & HEMC schedules the appliances by considering user satisfaction and RESs integration& Computational time and system complexity is increased\\
\addlinespace
GA \cite{14}& User comfort and cost reduction & Optimizes energy consumption behavior with RESs incorporation &  Practical implementation increases system complexity\\
\addlinespace
 Hybrid(LP and BPSO) \cite{15}& Cost reduction and user comfort maximization  & Thermostatically and interruptible appliances are considered with load ahead pricing model & PAR is not considered \\
\addlinespace
%\pagebreak
FP \cite{16} & Electricity cost reduction  & Cost efficient model with DES and practical implementation of the model proposed   & PAR and User comfort are not taken into account\\
\addlinespace
GA \cite{17}& Cost and PAR reduction& For efficient cost model time slots are divided& System complexity and computational time enhances\\
\addlinespace
HSA \cite{18}& Basic concept of HSA, its structure, and applications& Improved and Hybrid HSA with application & Real time implementation  is not considered   \\
\end{longtable}
\lipsum[2-3]
\end{document}

在上述中,MWE 被认为是米科评论。此代码给出:

在此处输入图片描述

相关内容