我想使文本垂直居中规则布尔行为在每一行中,我该如何做到这一点?
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage[rightcaption]{sidecap}
\usepackage{wrapfig}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
Rule & Sample Evolution & Boolean Form & Behavior\\
\hline
$Rule$ & \includegraphics{stable.png} &$boolean$ & behavior\\
\hline
$Rule$ & \includegraphics{decreasing.png} &$boolean$ & behavior\\
\hline
$Rule$ & \includegraphics{growing.png} & $ boolean $ & behavior\\
\hline
$Rule$ & \includegraphics{chaotic.png} &$ boolean $ & behavior\\
\hline
\end{tabular}
\caption{Lorem ipsum}
\end{table}
\end{document}
答案1
更换每个
\includegraphics{stable.png}
经过
\raisebox{-.5\height}{\includegraphics{stable.png}}
或者也许根据喜好调整 .5,以便图像的参考点不在其底部边缘。
答案2
如果你还添加
\usepackage[export]{adjustbox}
您可以在命令valign=c
中使用选项\includegraphics
,这比使用更容易\raisebox
。
下面是一个示例,其中我还使用了booktabs
和array
功能以便更好地输入。例如,第一列和第三列将以斜体显示(请注意\upshape
标题中的覆盖方式)。
valign=t
第三行和第四行显示有和没有的行为valign
。
\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{graphicx} % loaded by adjustbox
\usepackage{booktabs} % better tables
\usepackage{array} % some more facilities
\begin{document}
\begin{table}
\centering
\begin{tabular}{>{\itshape}c c >{\itshape}c c}
\toprule
\upshape Rule & Sample Evolution & \upshape Boolean Form & Behavior\\
\midrule
Rule & \includegraphics[height=2cm,valign=c]{duck} & boolean & behavior\\
\midrule
Rule & \includegraphics[height=2cm,valign=t]{duck} & boolean & behavior\\
\midrule
Rule & \includegraphics[height=2cm]{duck} & boolean & behavior\\
\bottomrule
\end{tabular}
\caption{Lorem ipsum}
\end{table}
\end{document}