我正在尝试\parbox
在 LaTeX 中创建橡皮宽度,以便均匀填充整行。它用于创建一个 mad-libs 样式的填充命令,该命令将拉伸一定量的宽度。我尝试了以下操作:
\newcommand{\libfillin}[2]
{
\parbox[t]{#1 plus50pt minus50pt}{
\rule[-3pt]{\linewidth}{0.5mm}
\parbox[t][1pt][b]{\linewidth}{\small \centering
\emph{#2}}\vspace{2pt}\hfill\\
}
}
但是,这会导致文本plus50pt
minus50pt
被打印,并且 parboxes 的宽度无效。我该如何修复这个问题?
答案1
我从来没有听说过 mad-libs,但谷歌引导到维基百科,建议你想要一个像这样的输出
\documentclass{article}
\def\zz#1{%
\mbox{}%
\setbox0\hbox{#1}%
\nobreak\leaders\hrule\hskip\wd0 plus 20pt minus 20pt
\nobreak\hskip-.5\wd0 plus -10pt minus -10pt\relax
\makebox[0pt]{\raisebox{-7pt}{\small\itshape#1}}%
\nobreak\hskip.5\wd0 plus 10pt minus 10pt\relax\kern0pt
}
\begin{document}
\linespread{4}
\zz{exclamation}! he said \zz{adverb} as he jumped into his convertible
\zz{noun} and drove off with his \zz{adjective} wife.
\end{document}