有没有办法让两个简短的答案并排显示?像这样:
Answer A: ___________________ Answer B: ___________________
我尝试过使用表格,但我更喜欢只在框中显示答案(我还没想好该怎么做),就像这样:
____________________ ____________________
Answer A: | | Answer B: | |
-------------------- --------------------
有什么建议么?
答案1
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent Answer A: \hrulefill Answer B: \hrulefill \\
\renewcommand{\arraystretch}{3}
\noindent
\begin{tabularx}{1.0\linewidth}{@{}l |X| l |X|}
\cline{2-2} \cline{4-4}
Answer A: & & Answer B: & \\
\cline{2-2} \cline{4-4}
\end{tabularx}
\end{document}
答案2
这里有两个可以使用的宏:\answerline[<len>]
和\answerbox[<len>]
。两者都采用可选的len
gth 参数(默认为10em
):
\documentclass{article}
\newcommand{\answerline}[1][10em]{\rule[-\fboxsep]{#1}{\fboxrule}}
\newcommand{\answerbox}[1][10em]{\fbox{\strut\rule{\dimexpr#1-2\fboxsep-2\fboxrule}{0pt}}}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
Answer A: \answerline \quad
Answer B: \answerline
Answer C: \answerline[5em]\quad
Answer D: \answerline[15em]
\hrulefill
Answer A: \answerbox \quad
Answer B: \answerbox
Answer C: \answerbox[5em]\quad
Answer D: \answerbox[15em]
\end{document}