如何在长表内创建多行表?

如何在长表内创建多行表?

请查看下面的代码并帮助我。

\begin{longtable}{| c | L{3cm} | L{3cm} | L{3cm} | L{3cm} | L{3cm} | L{3cm} | L{3cm} | }
            \hline
            \rowcolor{Gainsboro!60}
            \makecell{} & \makecell{Centrifugal \\ force}  & \makecell{Gravitational \\ force} & \makecell{Inclination} & \makecell{Vibration} & \makecell{Fluidization} & \makecell{Inertial \\ force} & \makecell{Other \\ Effects}\\
            \hline
            \endhead
           Size & \multirow{2}{*}{Cyclones} & Counter flow vertical air raise classifiers, Zig-Zag Classifiers & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & Cyclones, Rotating Wheel Air-Classifiers, High-Efficiency Separator, Turbo-air Classifier, Circulating air-classifiers. & &  \\
           \hline
           Density &  & alpha & echo & charlie & bravo &  & \\
          \hline
           Shape & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & &  \\
           \hline
           
        \end{longtable}

由于您上面的例子不可编译,因此我建议使用这个 MWE。从 \documentclass{...} 开始并定义一个\newcolumntype{L}

\documentclass{article}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{multirow}
\newcolumntype{L}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{lscape}

\begin{document}
    \begin{landscape}
    \begin{longtable}{| c | L{2cm} | L{2cm} | L{2cm} |L{2cm} | L{2cm} | p{2cm} | p{2cm} | }
        \hline
    %   \rowcolor{Gainsboro!60}
        \makecell{} & \makecell{Centrifugal \\ force}  & \makecell{Gravitational \\ force} & \makecell{Inclination} & \makecell{Vibration} & \makecell{Fluidization} & \makecell{Inertial \\ force} & \makecell{Other \\ Effects}\\
        \hline
        \endhead
        Size & \multirow{2}{*}{Cyclones} & Counter flow vertical air raise classifiers, Zig-Zag Classifiers & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & Cyclones, Rotating Wheel Air-Classifiers, High-Efficiency Separator, Turbo-air Classifier, Circulating air-classifiers. & &  \\
        \hline
        Density &  & alpha & echo & charlie & bravo &  & \\
        \hline
        Shape & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. & &  \\
        \hline
        
    \end{longtable}
    \end{landscape}
    
\end{document}

在此处输入图片描述

答案1

不清楚您的问题是什么(除了表格太宽,不适合页面)。您可以考虑对代码进行以下微小更改:

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{ragged2e}
\usepackage{longtable, makecell, multirow}
    \newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\usepackage[table, svgnames]{xcolor}

\begin{document}
\begingroup
    \footnotesize
    \setlength\tabcolsep{3pt}
    \setlength\extrarowheight{2pt}
\begin{longtable}{| c | *{7}{L{20mm}|} }
    \hline
    \rowcolor{Gainsboro!60}
    & \makecell{Centrifugal \\ force}  
        & \makecell{Gravitational \\ force} 
            & \makecell{Inclination} 
                & \makecell{Vibration} 
                    & \makecell{Fluidization} 
                        & \makecell{Inertial \\ force} 
                            & \makecell{Other \\ Effects}       \\
    \hline
\endhead
% table body
Size & \multirow[t]{12}{=}{Cyclones}
        & Counter flow vertical air raise classifiers, Zig-Zag Classifiers
            & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                    & Cyclones, Rotating Wheel Air-Classifiers, High-Efficiency Separator, Turbo-air Classifier, Circulating air-classifiers.
                        &   &   \\
   \cline{1-1}\cline{3-6}
Density 
    &   & \makecell{alpha} 
            & \makecell{echo}
                & \makecell{charlie} 
                    & \makecell{bravo}
                        &   &   \\
  \hline
Shape 
    & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. 
        & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. 
            & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. 
                & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. 
                    & These kind of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. 
                        &   &   \\
   \hline
\end{longtable}
\endgroup
\end{document}

在此处输入图片描述

答案2

也许这就是你正在寻找的 桌子

我已经使用该booktabs包排版了此表。您的问题不太清楚,所以我只是尝试了我认为好的方法。

代码

\documentclass{article}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{multirow}
\newcolumntype{L}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{lscape}
\usepackage{booktabs}
\usepackage{geometry}

\begin{document}
\begin{landscape}
    \begin{longtable}{
        c 
        >{\raggedright}p{2.5cm} 
        >{\raggedright}p{2.5cm}
        >{\raggedright}p{2.5cm}
        >{\raggedright}p{2.5cm}
        >{\raggedright}p{2.5cm}
        >{\raggedright}p{2.5cm}
        p{2cm}}\toprule
        & \multicolumn{3}{c}{\scshape force} 
            & Inclination 
                & Vibration
                    & Fluidization 
                        & Other \\\cmidrule{2-4}
%
        & \multicolumn{1}{c}{Centrifugal} 
            & \multicolumn{1}{c}{Gravitational}
                & \multicolumn{1}{c}{Inertial} 
                    &&&& Effects \\\midrule
%
        Size 
            & \multicolumn{1}{c}{Cyclones} 
                & Counterflow vertical air raise classifiers, Zig-Zag Classifiers 
                    & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                        & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document. 
                            & Cyclones, Rotating Wheel Air-Classifiers, High-Efficiency Separator, Turbo-air Classifier, Circulating air-classifiers. 
                                & &  \\\cmidrule{1-1}\cmidrule{3-6}
        Density 
            & & aplha
                & echo 
                    & charlie 
                        & bravo 
                            & & \\\midrule
        Shape 
            & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                    & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                        & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                            & These kinds of issues are mostly related to the PDF viewer, they will not appear in a print version of the document.
                                & &  \\\bottomrule
    \end{longtable}
\end{landscape}
\end{document}

提示:避免在表格中使用垂直线:)

欢迎来到 TeX.SE

相关内容