我有这个例子
\documentclass[12pt]{article}
\newcount\mynote
\def\note#1{\global\mynote=#1\relax}
\begin{document}
\centering
\begin{tabular}{p{6cm}c}
Text text text text text text text text text text text text text
text text text text
text here$\rightarrow$ \note{3} text text text text text text text
text text text text text text text text text text text
text text text text text text text text text text text text text
&
\number\mynote \\
\end{tabular}
\end{document}
我希望将右侧的数字与包含 \note
宏的行对齐(该方法即使在枚举环境中也必须有效)。
答案1
像这样?
为此需要进行手动调整(计算行数$\rightarrow$ \note{3}
):
\documentclass[12pt]{article}
\usepackage{multirow}
\newcount\mynote
\def\note#1{\global\mynote=#1\relax}
\begin{document}
\centering
\begin{tabular}{p{6cm}c}
Text text text text text text text text text text text text text
text text text text text here $\rightarrow$ \note{3} text text text
text text text text text text text text text text text text text
text text text text text text text text text text text text text
text text
& \multirow[b]{3}{*}{\number\mynote} \\
\end{tabular}
\end{document}
答案2
您可以通过放置标记(“标签”)来保存所需位置的x
坐标y
zref
的savepos
模块),然后将内容绝对地使用eso-pic
:
\documentclass{article}
\usepackage{eso-pic}
\usepackage[savepos]{zref}
\begin{document}
\begin{tabular}{ p{6cm} c }
Text text text text text text text text text text text text text
text text text text
text here $\rightarrow$ \zsaveposy{mynote-y} text text text text text
text text text text text text text text text text text text text
text text text text text text text text text text text text text
&
\zsaveposx{mynote-x}
\end{tabular}
\AddToShipoutPictureFG*{
\AtPageLowerLeft{%
\hspace*{\zposx{mynote-x}sp}%
\raisebox{\zposy{mynote-y}sp}{3}%
}
}
\end{document}