Ltablex 不会破坏多行

Ltablex 不会破坏多行

ltablex我使用和包构建了一个包含多行的多页表multirow。我的问题是,现在如何防止 Latex 破坏这样的多行?

\begin{center}
    \begin{footnotesize}
        \renewcommand{\arraystretch}{1.25}\aboverulesep = 0mm \belowrulesep = 0mm
        \captionsetup{type=table}
        \begin{tabularx}{1\textwidth}{|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|X|p{0.1\textwidth}|}
            \cline{1-5}
            \textbf{Direction} & \textbf{Signal Name} & \textbf{Symbol} & \textbf{Description} & \textbf{Type}  \\\cline{1-5}
            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
        \end{tabularx}
        %\caption{Table Cap}
\end{footnotesize}
\end{center}

答案1

我现在已经更新了 MWE 来解决第 2 页上缺失的一行,我假设你不要想要重复标题。

由于您没有提供可行的 MWE,因此很难更具体,因此我给您一些可能的解决方案。

请记住,多行只是覆盖在下方单元格上。因此,对于长桌,后面使用表列,多行下方的每一行都是可能的断点。第 9 页长桌手册描述了您可以使用的不同命令,以便在之前强制分页multirow,或者避免在所述行之间分页。

请记住,您还可以使用 LaTeX 命令\enlargethispage{<val>}来增加或减少给定页面上的可用空间。例如:

\enlargethispage{\baselineskip}

可能会为额外的行留出空间。负值:

\enlargethispage{-\baselineskip}

将会减少可用空间,从而迫使更早地分页。

为了在下一页的顶部显示规则,请将规则命令放在表头中:

\cline{1-5}\endfirsthead\cline{1-5}

\cline{1-5}您可以使用简单的来代替\hline

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage[a4paper,
            vmargin=0.7in, hmargin=0.7in%
            ]{geometry}

\usepackage{array, hhline, ltablex, tabularx, multirow, caption}

\begin{document}

\begin{center}
    \begin{footnotesize}
        \renewcommand{\arraystretch}{1.25}%\aboverulesep = 0mm \belowrulesep = 0mm
        \captionsetup{type=table}
        \begin{tabularx}{1\textwidth}{|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|X|p{0.1\textwidth}|}

\caption{Table Cap}\\

\endfirsthead
\cline{1-5} % Or \hline
\endhead
\cline{1-5} % Or \hline

\textbf{Direction} & \textbf{Signal Name} & \textbf{Symbol} & \textbf{Description} & \textbf{Type}  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}
          in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

            in  & \multirow[t]{2}{\hsize}{ready signal} & ready-v1  & Some description & 1 \\ \cline{1-1} \cline{3-5}
            out & & ready-v2 & Some description & 1  \\\cline{1-5}

        \end{tabularx}
\end{footnotesize}
\end{center}

\end{document}

答案2

从你的代码片段看不出为什么需要ltablex包。如果你真的需要具有特征的长表tabularx,那么我建议你最好使用xltabular包(即组合longtabletabularx包)。

如果您坚持使用ltablex,那么如果您希望拥有具有与标准相同功能的X列(在任何表中) ,则需要在文档序言中添加。tabularxtabularx\keepXColumns

对于您来说,我会重新设计您的表格,如下所示:

\documentclass{article}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\setcellgapes{3pt}

\begin{document}
    \begin{table}
\makegapedcells
    \caption{Table Cap}\label{tab:mytable}
\begin{tabularx}{\linewidth}{|c|p{0.1\linewidth}| l | X | c|}
            \cline{1-5}
\thead[b]{Direction} 
    &   \thead[b]{Signal\\ Name} 
                    &   \thead[b]{Symbol} 
                                        &   \thead[b]{Description} 
                                                            & \thead[b]{Type}           \\  \cline{1-5}
in  & \multirow{2.4}{=}{ready signal} 
                    & ready-v1          & Some description  & 1         \\ \cline{1-1}      \cline{3-5}
out &               & ready-v2          & Some description  & 1         \\  \cline{1-5}
in  & \multirow{2.4}{=}{ready signal}
                    & ready-v1          & Some description  & 1         \\ \cline{1-1}      \cline{3-5}
out &               & ready-v2          & Some description  & 1         \\  \cline{1-5}
in  & \multirow{2.4}{=}{ready signal}
                    & ready-v1          & Some description  & 1         \\ \cline{1-1}      \cline{3-5}
out &               & ready-v2          & Some description  & 1         \\  \cline{1-5}
in  & \multirow{2.4}{=}{ready signal}
                    & ready-v1          & Some description  & 1         \\ \cline{1-1}      \cline{3-5}
out &               & ready-v2          & Some description  & 1         \\  \cline{1-5}
        \end{tabularx}
\end{table}
\end{document}

结果如下:

在此处输入图片描述

在上面的表格设计中,我预计除了第二列(其中有multirows' 单元格)和第四列(带有X类型)之外的所有列中都只有短短的一行文本。

相关内容