我问过这个问题这里...但我也在这里问这个问题。我想重现带有徽标的下表。
但我不确定如何继续。这是一个最小的工作示例
\documentclass[11pt]{article}
\usepackage{graphicx, array}
\usepackage[margin=1.5cm , a4paper]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{table}[ht]
\centering
\begin{tabular}{*{2}{m{0.48\textwidth}}}
\begin{center}
The graphic goes here.
Some more text.
\end{center} &
\begin{center}
Some more text.
\end{center}
\end{tabular}
\end{table}
\end{document}
然而,这远非我想要的...我该如何实现上述目标?我必须使用类似的东西multirow
吗?
答案1
一个TikZ
办法。
首先我们绘制三个右节点,一个接一个,宽度相同,但高度不同。右侧部分是一个fit
节点(与右侧节点一样高),其中心标签中定义了徽标和下方文本。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning, fit}
\begin{document}
\begin{tikzpicture}[mybox/.style={draw=orange, line width=1mm, minimum width=4cm, text width=3cm, align=center}]
\node[mybox, minimum height=1cm] (1r) {This is some text};
\node[mybox, minimum height=12mm, below=-\pgflinewidth of 1r] (2r) {Text in \\ two rows};
\node[mybox, minimum height=2cm, below=-\pgflinewidth of 2r] (3r) {Some more text in lower row};
\node[draw=orange, line width=1mm,
inner sep=-.5\pgflinewidth,
fit={(3r.south west) (1r.north west)},
below left=0 and -\pgflinewidth of 1r.north west,
minimum width=4cm,
label={[text width=3cm, align=center]center:
{\includegraphics[width=3cm]{example-image-A}\\
Some more text below the icon}}]{};
\end{tikzpicture}
\end{document}
答案2
使用multirow
以下方法确实有效(但请注意,这不是唯一的解决方案):
\documentclass[border=4mm]{standalone}
\usepackage{array,graphicx,multirow}
\usepackage[table]{xcolor}
\begin{document}
\bgroup
\arrayrulecolor{orange}
\setlength{\arrayrulewidth}{1pt}
\begin{tabular}[]{|*{2}{>{\centering\arraybackslash}m{0.4\linewidth}|}}
\hline
\multirow{3}{*}{\parbox[c]{\linewidth}{\centering%
\includegraphics[width=0.3\linewidth]{example-image}
text text text text text text}}
&
text\\
\cline{2-2}
& text text text text text text text text\\
\cline{2-2}
& text text text
\\
\hline
\end{tabular}
\egroup
\end{document}
问题multirow
是,它不知道所需的高度,而是根据第一个参数(作为 3 个正常行)进行猜测。因此,以这种方式使用大型徽标将不起作用。
另一种方法不适multirow
用于大图像,但它不会自动在第二列创建良好的垂直间距:
\documentclass[border=4mm]{standalone}
\usepackage{array,graphicx}
\usepackage[table]{xcolor}
\begin{document}
\bgroup
\arrayrulecolor{orange}
\setlength{\arrayrulewidth}{1pt}
\begin{tabular}[]{| m{0.4\linewidth} | @{}l@{} |}
\hline
\includegraphics[width=0.7\linewidth]{example-image}
text text text text text text text text
&
\begin{tabular}[c]{>{\centering\arraybackslash}m{0.4\linewidth}}
text text text\\
\hline
text text text text text text\\
\hline
text text text text text text text text text
\end{tabular}\\
\hline
\end{tabular}
\egroup
\end{document}
插入一点手动空间:
\documentclass[border=4mm]{standalone}
\usepackage{array,graphicx}
\usepackage[table]{xcolor}
\begin{document}
\bgroup
\arrayrulecolor{orange}
\setlength{\arrayrulewidth}{1pt}
\begin{tabular}[]{| m{0.4\linewidth} | @{}l@{} |}
\hline
\includegraphics[width=0.7\linewidth]{example-image}
text text text text text text text text
&
\begin{tabular}[c]{>{\centering\arraybackslash}m{0.4\linewidth}}
text text text\\[0.5em]
\hline
\noalign{\vspace*{0.5em}}
text text text text text text\\[0.5em]
\hline
\noalign{\vspace*{0.5em}}
text text text text text text text text text
\end{tabular}\\
\hline
\end{tabular}
\egroup
\end{document}