看板LaTeX
标 题Re: [问题] theorem 的 counter
发信站(null) (Sun Aug 11 13:10:40 2013)
转信站ptt!news.ntu!ctu-gate!news.nctu!usenet.stanford.edu!f7no1886618qan.0!n
Hi, I pull out the book "TeX by topic" and study chapter 11 again. This is =
what I came up with.
\def\Ex{\futurelet\testchar\MaybeOptArgEx}
\def\MaybeOptArgEx{\ifx[\testchar \let\next\OptArgEx
\else=20
\let\next\NoOptArgEx=20
\fi=20
\next}
\def\NoOptArgEx#1{
\begin{exercise}
#1\par
\end{exercise}}
\def\OptArgEx[#1]#2{
\begin{exercise}
#2\par
\noindent=E8=A7=A3=E7=AD=94{\bf \theexercise:}\par
#1
\end{exercise}}
\section{Fifth try}
This macro provides an option for solution. This means that the solution mu=
st be surrounded by brackets [...]=20
\Ex{This is only a question without solution given.}
\Ex[A solution goes here]{This has an option for adding a solution.}
An image is attached
http://ppt.cc/0mkp
1F:推 voyante:it is too complicate. i use the simplest one. 08/12 15:40