Re: [問題] theorem 的 counter
Indeed, all definitions should be collected and put them in the preamble ar=
ea (for reasons of completeness and easy to find.) But in actuality, you ca=
n put them (almost) anywhere as long as you know where they are for a small=
snippet.=20
(1) Whenever a new environment is defined, the LaTeX will generate a corres=
ponding counter for it, and establish the connection with the level high up=
.. In your example, they are \theexercise and \theanswer. As you saw in the =
old method. Since latex has established/known the counter name. I need to u=
se REnewcommand to redefine the internal definitions.
(2) This is a one time deal, you don't need to redefine them every time.
(3) For method 4, the new environment is exwsol(exercise with solution). It=
is a new one, so I use newcommand to define it. This newcommand exwsol is=
a wrap up of the environment "answer". so you still need this on in the pr=
eamble.=20
\begin{exwsol} %w=3Dwith
For those has solutions.
\end{exwsol}
\begin{exwosol} %wo=3Dwithout
For those has no solutions.
\end{exwosol}
(4) Indeed, you can make it an options, but this would need more latex code=
s, including a conditional test for [options]. If you want to make you code=
into a package, yes. you should do that. But for personal usage, I would c=
opy the exwsol and make another one exwosol or just leave the second input =
{Solution goes here} empty {} shown above.=20
PS. The latex definition for chapter has an option functionality. You may w=
ant to find it and lean sth from it. It is fun. Or read "TeX by topics" on =
subsection 11.9.3 (V. Eijkhout).=20
Hope this helps.
討論串 (同標題文章)
LaTeX 近期熱門文章
PTT數位生活區 即時熱門文章