我退房了这页面,他们给出了很好的答案,但不是我需要的。我希望理由就像他们给出的答案一样,所有内容都放在一行中,触及边距,但我想为它创建一个新命令,而不是每次都输入所有内容。类似于在这页
\choice{apple}{banana}{orange}{pear}
所以我尝试定义一个类似的命令
\documentclass[a4paper,addpoints,answers,12pt]{exam}
\usepackage{graphicx,tabularx,caption,color,subcaption,amsmath,amssymb,lmodern,textcomp,gensymb,ifpdf,ifthen}
\newcommand{\mcq}{%
\begin{oneparchoices}
\choice #1
\choice #2
\choice #3
\choice #4
\choice #5
\end{oneparchoices}
}
\begin{document}
\mcq{uihoo}{eifhw2u}{fiwuhr}{fjwhf}{fnweir}
\end{document}
但这有太多错误:
line 12: Illegal parameter number in definition of \mcq. }
line 12: Illegal parameter number in definition of \mcq. }
line 12: Illegal parameter number in definition of \mcq. }
line 12: Illegal parameter number in definition of \mcq. }
line 12: Illegal parameter number in definition of \mcq. }
line 14: You can't use `macro parameter character #' in horizontal mode. \mcq
line 14: You can't use `macro parameter character #' in horizontal mode. \mcq
line 14: You can't use `macro parameter character #' in horizontal mode. \mcq
line 14: You can't use `macro parameter character #' in horizontal mode. \mcq
line 14: You can't use `macro parameter character #' in horizontal mode. \mcq
我也会尝试给出的任何解决方案oneparcheckboxes
,但让我们首先得到这个答案。
答案1
您需要告诉 LaTeX 有多少个参数:
\newcommand{\mcq}[5]{...