我有一个非常特殊的表格,只需要这样(尽管有人可能会认为这不是很 TeX 的方式)。左上角的单元格应该包含一个徽标,它非常适合:
我的问题是,如何在不使用pstricks
'\rput
命令的情况下实现这一点?如果我只包含图像,那么 TeX 会为它保留一些空间,而这并不是我想要的。填充本来就很好,而且\rput
似乎没有传递有关边界框的任何信息。
\documentclass{article}
\usepackage{graphicx}
\usepackage{pstricks}
\usepackage{booktabs}
\begin{document}
\begin{table}\scriptsize
\begin{tabular}{@{}c@{}*{6}{l}@{}}
\specialrule{1pt}{0pt}{3pt}% toprule
% Row 1 ---
\hspace*{2cm}
& {Category}
& \multicolumn{2}{l}{Score}
& {Result}
& {Details}
& More detailed \\
% Row 2 ---
&&&&&&details
\\[-1.5ex]
% Row 3 ---
% \includegraphics[height=1.4cm]{scratch.eps}
\rput(0,0){\includegraphics[height=1.4cm]{scratch.eps}}%
& \small Some Category \\[1ex]
& \small Subcategory
& \multicolumn{2}{r}{of 30} \\
\specialrule{.7pt}{4pt}{3pt}% midrule ---
\end{tabular}
\end{table}
\end{document}
答案1
这可以通过多种方式实现,无需pstricks
。使用可提高\raisebox{<length>}[0pt][0pt]{<stuff>}
(负数会降低)。添加选项会删除 的高度/深度,因此不会影响行高。<stuff>
<length>
[0pt][0pt]
<stuff>
\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs}
\begin{document}
\begin{table}
% Option 1
\scriptsize
\begin{tabular}{ @{} c @{} *{6}{l} @{} }
\specialrule{1pt}{0pt}{3pt}% toprule
% Row 1 ---
\hspace*{2cm}
& Category
& \multicolumn{2}{l}{Score}
& Result
& Details
& More detailed \\
% Row 2 ---
&&&&&&details
\\[-1.5ex]
% Row 3 ---
\raisebox{-2.35\normalbaselineskip}[0pt][0pt]{\includegraphics[height=1.4cm]{example-image}}
& \small Some Category \\[1ex]
& \small Subcategory
& \multicolumn{2}{r}{of 30} \\
\specialrule{.7pt}{4pt}{3pt}% midrule ---
\end{tabular}
% Option 2
\scriptsize
\renewcommand{\arraystretch}{1.4}%
\begin{tabular}{ @{} c @{} *{5}{l} @{} }
\specialrule{1pt}{0pt}{3pt}% toprule
% Row 1 ---
& Category
& Score
& Result
& Details
& \smash{\renewcommand{\arraystretch}{1}\begin{tabular}[t]{@{} l @{}} More detailed \\ details \end{tabular}} \\
% Row 2 ---
~\raisebox{-2.3\normalbaselineskip}[0pt][0pt]{\includegraphics[height=1.4cm]{example-image}}~
& \small Some Category \\
& \small Subcategory
& \multicolumn{1}{r}{of 30} \\
\specialrule{.7pt}{4pt}{3pt}% midrule ---
\end{tabular}
\end{table}
\end{document}
当然,调整元素升高/降低的量。