看板LaTeX
标 题Re: [问题] theorem 的 counter
发信站(null) (Sun Aug 11 03:28:19 2013)
转信站ptt!news.ntu!ctu-gate!news.nctu!usenet.stanford.edu!fx3no1944069qab.0!
How about this
\begin{document}
\newtheorem{exercise}{=E4=BD=9C=E6=A5=AD}[section]
\newtheorem{answer}{=E8=A7=A3}[exercise]
\section{Old method}
\begin{exercise}
Old question
\end{exercise}
\begin{answer}
Old answer
\end{answer}
\section{Second try}
\renewcommand{\theanswer}{\theexercise}
\begin{exercise}
Old question
\end{exercise}
\begin{answer}
Old answer
\end{answer}
Hmmm, two separate environment are not desired.
\section{Third try}
A single environment with imbedded wordings.
\begin{exercise}
Question goes here.
.....
{\noindent \bf =E4=BD=9C=E6=A5=AD \theexercise =E8=A7=A3 \par}
Solution goes here.
\end{exercise}
\section{Fourth try}
Here we define a newenvironment with 2 inputs,=20
one for question and one for the solution.
\newenvironment{exwsol}[2]
{\begin{exercise}
#1\par
\noindent=E8=A7=A3=E7=AD=94{\bf \theexercise:}\par
#2
}
{\end{exercise}}
Then give an example displayed below
\begin{exwsol}
{Question goes here.}
{Solution goes here.}
\end{exwsol}
\end{document}
An image is attached.
http://ppt.cc/5R-6