对于以下内容,为什么graphbox
顶部对齐图像比 更好adjustbox
?
另外,如何才能让width=\columnwidth
工作如预期般顺利进行呢?
\documentclass[12pt,a4paper]{exam}
\usepackage{graphbox,duckuments,tabularx}
\usepackage[export]{adjustbox}
\begin{document}
\begin{tabularx}{\textwidth}{
>{\hsize=0.5\hsize}X
>{\hsize=0.5\hsize}X
}% adjustbox
\blindduck[1] & \includegraphics[width=\columnwidth,valign=T]{example-image-a}
\end{tabularx}
\begin{tabularx}{\textwidth}{
>{\hsize=0.5\hsize}X
>{\hsize=0.5\hsize}X
}% graphbox
\blindduck[1] & \includegraphics[width=\columnwidth,align=t]{example-image-b}
\end{tabularx}
\end{document}
编辑
为什么不能像下面width=\columnwidth
这样按预期工作?width=\linewidth
\documentclass[12pt,a4paper]{exam}
\usepackage{graphbox,duckuments,tabularx}
\usepackage[export]{adjustbox}
\begin{document}
\begin{tabularx}{\textwidth}{
>{\hsize=1.5\hsize\linewidth=\hsize}X
>{\hsize=0.5\hsize\linewidth=\hsize}X
}
\blindduck[1] & \includegraphics[width=\columnwidth,valign=t]{example-image-a}
\end{tabularx}
\begin{tabularx}{\textwidth}{
>{\hsize=1.5\hsize\linewidth=\hsize}X
>{\hsize=0.5\hsize\linewidth=\hsize}X
}
\blindduck[1] & \includegraphics[width=\linewidth,align=t]{example-image-b}
\end{tabularx}
\end{document}
答案1
您不能将苹果与梨进行比较...如果您将valign=T
其替换valign=t
(正如薛定谔的猫中现已删除的答案中所建议的那样),那么您将得到完全相同的结果:
题外话:为什么使用{>{\hsize=0.5\hsize}X >{\hsize=0.5\hsize}X}
for 列规范?更简单、更正确的是 `{XX}˙:
\documentclass[12pt,a4paper]{exam}
\usepackage{tabularx}
\usepackage{duckuments}
\usepackage{graphbox}
\usepackage[export]{adjustbox}
\usepackage{duckuments}
\begin{document}
\begin{tabularx}{\textwidth}{XX}% adjustbox
\blindduck[1] & \includegraphics[width=\linewidth,valign=t]{example-image-a}
\end{tabularx}
\begin{tabularx}{\textwidth}{XX}% graphbox
\blindduck[1] & \includegraphics[width=\linewidth,align=t]{example-image-b}
\end{tabularx}
\end{document}