2009-09-06 33 views
2

我已经定义了一个环境我如何通过数字参数

\newenvironment{question}[1] 
{Question (#1 points):}{} 

乳胶的环境中,我使用它作为

\begin{question}[10] 
... 
\end{question} 

我收到以下错误:

Missing number, treated as zero 
\begin{question}[ 
       10] 
+0

您可以考虑使用“考试”文档类:http://www.ctan.org/tex-archive/help/Catalogue/entries/exam.html – las3rjock 2009-09-06 09:08:01

+0

*而不是重新发明轮子, * @ las3rjock:**我当然不能为OP,但现有的在LaTeX类中编写测试的任何*都不能满足我的需求。但是我接下来看看你的建议,CTAN上有几个这样的类,它们提供了很多不同的功能。 – dmckee 2009-09-06 15:20:06

回答

7

正确的语法是花括号,而不是方括号:

\begin{question}{10} 
What is the airspeed velocity of an unladen swallow? 
\end{question} 
+3

欧洲或非洲燕子? – Martijn 2009-09-22 12:57:59

+3

@Martijn:* Psalidoprocne nitens *,具体为:-D – derobert 2009-09-22 14:19:07