您能帮我将表格和文本块*内的 Text2 与 Text1 的基线对齐吗?
将不胜感激。
\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\begin{document}
\begin{textblock*}{30mm}(30mm,30mm)
Text1
\end{textblock*}
\begin{textblock*}{30mm}(30mm,30mm)
\begin{tabular}[t]{@{}l}
Text2
\end{tabular}
\end{textblock*}
\end{document}
答案1
Struts 以表格的形式添加。如果\arraystretch
没有重新定义,\strut
可以添加:
\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\begin{document}
\begin{textblock*}{30mm}(30mm,30mm)
Text1\strut
\end{textblock*}
\begin{textblock*}{30mm}(30mm,30mm)
\begin{tabular}[t]{@{}l}
Text2
\end{tabular}
\end{textblock*}
\end{document}
否则:
\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\renewcommand*{\arraystretch}{1.2}
\newcommand*{\arstrut}{%
\vrule height\arraystretch\ht\strutbox
depth\arraystretch\dp\strutbox
width0pt\relax
}
\begin{document}
\begin{textblock*}{30mm}(30mm,30mm)
Text1\arstrut
\end{textblock*}
\begin{textblock*}{30mm}(30mm,30mm)
\begin{tabular}[t]{@{}l}
Text2
\end{tabular}
\end{textblock*}
\end{document}
更新:通过移动表格块来撤消校正。
\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\renewcommand*{\arraystretch}{1.2}
\begin{document}
\begin{textblock*}{30mm}(30mm,30mm)
Text1
\end{textblock*}
\begin{textblock*}{30mm}(30mm,30mm)
\settoheight{\dimen0}{Text1}%
\kern\dimen0\relax
\kern-\arraystretch\ht\strutbox\relax
\begin{tabular}[t]{@{}l}
Text2
\end{tabular}
\end{textblock*}
\end{document}