多行无法连接包含 parboxes 和数字的表格中的行

多行无法连接包含 parboxes 和数字的表格中的行

我正在尝试连接包含 parboxes 和数字的表格行,但多行似乎不起作用。有人能帮我吗?下面是一个最低限度的工作示例。谢谢,Jorge。

更新 1:请注意,我确实需要图 B 上方的额外垂直空间(这就是我将其嵌入 \parbox 的原因)。

更新 2:似乎真正的问题是 \tabular 或 \multirow 无法正确考虑由 \parbox 定义的最高单元格的高度。我修改了我的示例以显示该问题。

新的最小工作示例:

\documentclass{article}
\usepackage{graphbox,graphicx,multirow,multicol,geometry,array}
\begin{document}

This works:\\
\begin{tabular}{|l|l|r@{}|}
    \hline
    blah & blah & \multirow{4}{*}{\fbox{Text}}\\
    \hline
    blah & blah & \\
    \hline
    blah & blah & \\
    \hline
    blah & blah & \\
    \hline
\end{tabular}

\vspace{1cm}
This doesn't work:\\
\begin{tabular}{|l|l|r@{}|}
    \hline
    blah & blah & \multirow{4}{*}{\fbox{\parbox[b][3cm][b]{1cm}{Text}}}\\
    \hline
    blah & blah & \\
    \hline
    blah & blah & \\
    \hline
    blah & blah & \\
    \hline
\end{tabular}

\end{document} 

输出:

enter image description here

旧的最小工作示例:

\documentclass{article}    
\usepackage{graphbox}
\usepackage{graphicx}
\usepackage{multirow}

\begin{document}

% All separate rows
\noindent{}I want to join the rows in the last column of this table (keeping the bottom vertical alignment, so that the bottom of fig. B is now aligned with the "Some other text" line):\\

\begin{tabular}{|l|l|r|}
    \hline
    \parbox[t][][t]{4cm}{Some text}
    & \parbox[t][][t]{4cm}{
            Some text\\
            Some text\\
            Some text\\
            \\
            \includegraphics[width=3cm]{example-image-A}
        }
    &
        % I embed Fig. B in a parbox to create the artificial space above it!
        % (Also, why it's not aligned to the right, as specified in the tabular options?)
        \parbox[t][1cm][b]{5cm}{
        \includegraphics[align=t,width=4cm,height=4cm]{example-image-B}
        }
    \\
    \hline
    \small{Some other text} & &\\
    \hline
\end{tabular}

\vspace{1cm}

% Attempt to join rows in right-most column:
\noindent{}Using \emph{multirow} doesn't seem work:\\

\begin{tabular}{|l|l|r|}
    \hline
    \parbox[t][][t]{4cm}{Some text}
    & \parbox[t][][t]{4cm}{
            Some text\\
            Some text\\
            Some text\\
            \\
            \includegraphics[width=3cm]{example-image-A}
        }
    & \multirow{2}{*}{
        % I embed Fig. B in a parbox to create the artificial space above it!
        % (Also, why it's not aligned to the right, as specified in the tabular options?)
        \parbox[t][1cm][b]{5cm}{
        \includegraphics[align=t,width=4cm,height=4cm]{example-image-B}
        }
    }
    \\
    \hline
    \small{Some other text} & &\\
    \hline
\end{tabular}

\end{document} 

输出: enter image description here

更新:@Bernard 提出了一种解决方法,即调整相邻单元格的高度(见下文),这符合我的特定需求。不过,原始问题(使用 \parbox 元素调整多行单元格高度)仍未解决。

\documentclass{article}
\usepackage{graphbox}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{geometry}
\usepackage{array}

\begin{document}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{|l|l|r@{}|}
        \hline
        \parbox[t][][t]{4cm}{Some text}
        & \parbox[t][][t]{4cm}{
                Some text\\
                Some text\\
                Some text\\
                \\
                \includegraphics[width=3cm]{example-image-A}\\[1.5cm]
            }
        &
        \\
        \cline{1-2}
        \small{Some other text} & & \multirow{-8.4}{*}{\includegraphics[align=b,width=4cm,height=4cm]{example-image-B}}\\
        \hline
\end{tabular}
\end{document}

输出:

enter image description here

答案1

这是一个简单的解决方案multirow。您必须知道,作为环境参数的行数实际上是的数量lines,即n = no of rows对于单行单元格有效。此外,图形确实是右对齐的,正如您在tabcolsep删除最后一个时看到的那样。

\documentclass{article}
\usepackage{geometry}
\usepackage{graphbox}
\usepackage{graphicx}
\usepackage{array, multirow}

\begin{document}

\setlength{\extrarowheight}{2pt}
\begin{tabular}{|l|l|r@{}|}
    \hline
    \parbox[t][][t]{4cm}{Some text}
    & \parbox[t][][t]{4cm}{
            Some text\\
            Some text\\
            Some text\\[1.5cm]
           % \\
            \includegraphics[width=3cm]{example-image-A}
        }
    &
    \\
    \cline{1-2}
    \small{Some other text} & & \multirow{-8.4}{*}{\includegraphics[align=b,width=4cm,height=4cm]{example-image-B}}\\
    \hline
\end{tabular}

\end{document} 

enter image description here

相关内容