图形多行垂直尺寸

图形多行垂直尺寸

我知道multirow与图形的结合并不是有意的。multirow无法计算图形的高度并且溢出。

这是最小的工作示例:

\documentclass[12pt,a4paper,oneside]{scrbook}

\usepackage{graphicx}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{multirow}

\begin{document}

\begin{tabular} {|c|c|c|}
\hline 
\textsf{\textbf{Development Phase}} & \textsf{\textbf{Integration Step}} & \textsf{\textbf{Test Stage Home News Blas}} \\
\hline
\multirow{2}{*}{Hardware Development} & \multirow{2}{*}{ \includegraphics[height=100px]{universe.jpg} } & \textsf{\footnotesize Hardware Test} \\
\cline{3-3}
 &  & {\footnotesize HW-SW Integration Test } \\
\hline

\end{tabular}

\end{document}

是否有替代软件包multirow或解决方法?

我通过搜索找到的解决方案对我来说没用。我不想改变非单元格的大小multirow

或者是否有一个关于高度的选项multirow(我在文档中找不到)?

答案1

像这样?

在此处输入图片描述

跨行高度之和应等于图像高度。您可以通过添加rule足够高度来实现:

\documentclass[12pt,a4paper,oneside]{scrbook}

\usepackage[export]{adjustbox}  % load graphicx too
%\usepackage{tabu}              % not recommended, it is bugy
\usepackage{longtable, multirow}

\begin{document}

\begin{tabular} {|c|c|c|}
\hline
\textsf{\textbf{Development Phase}} & \textsf{\textbf{Integration Step}} & \textsf{\textbf{Test Stage Home News Blas}} \\
\hline
\multirow{2}{*}{Hardware Development} 
    & \multirow{2}{*}{\includegraphics[height=100px, 
                                       margin=0pt 3pt 0pt 3pt]{example-image-duck} }
        & \textsf{\footnotesize Hardware Test}\rule[-43px]{0pt}{50px} \\
\cline{3-3}
    &   & {\footnotesize HW-SW Integration Test}\rule[-43px]{0pt}{50px} \\
\hline
\end{tabular}

\end{document}

附录(1): 一种方法是不使用multirow单元格,而是使用以下方法将最后一个单元格分成两部分makecell

\documentclass[12pt,a4paper,oneside]{scrbook}

\usepackage[export]{adjustbox}  % load graphicx too
%\usepackage{tabu}              % not recommended, it is bugy
\usepackage{longtable, makecell, multirow}
\renewcommand\theadfont{\small\bfseries\sffamily}
\renewcommand\theadgape{}
\setcellgapes{3pt}


\begin{document}

\begingroup
\makegapedcells
\begin{tabular}{|c|c|>{\footnotesize}c|}
    \hline
\thead{Development Phase}
    &   \thead{Integration Step} 
        &   \thead{Test Stage Home News Blas}                   \\
    \hline
Hardware Development
    &   \includegraphics[height=100px,
                         valign=t]{example-image-duck} 
        &   \makecell[t]{\sffamily Hardware Test   \\[5ex]
                            \hline\\ 
                         HW-SW Integration Test} \\
    \hline
\end{tabular}
\endgroup
\end{document}

在此处输入图片描述

附录(2): 今天我将使用 tabularay选项vspan=even和宽度等于的包\textwidth(由于使用了 X列类型):

\documentclass[12pt,a4paper,oneside]{scrbook}
\usepackage[export]{adjustbox}  % load graphicx too
\usepackage{tabularray}


\begin{document}
    \begin{table}[ht]
    \setkeys{Gin}{width=\linewidth}
\begin{tblr}{hlines, vlines,
             colspec = {Q[l,h] X[c] X[l, h]},
              colsep = 3pt,
              rowsep = 3pt,
              row{1} = {font=\small\bfseries, c},
              vspan=even    % <---
             }
Development Phase
    &   Integration Step 
        &   Test Stage Home News Blas   \\
\SetCell[r=2]{l}    Hardware Development
    &   \SetCell[r=2]{c}    \includegraphics[valign=t]{example-image-duck}
        &   Hardware Test               \\  
    &   &   HW-SW Integration Test      \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

相关内容