Re: [問題] theorem 的 counter

看板LaTeX (論文排版)作者時間12年前 (2013/08/11 18:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/8 (看更多)
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.
文章代碼(AID): #1I1sWYwe (LaTeX)
文章代碼(AID): #1I1sWYwe (LaTeX)