Forgot password?
 Create new account
View 111|Reply 5

请教证明后的注1,注2要怎么定义环境?

[Copy link]

418

Threads

1628

Posts

110K

Credits

Credits
11891

Show all posts

abababa Posted at 2024-8-23 19:44:53 |Read mode
如题,比如有些定理-证明之后,要对这个定理加一些说明,就有注1……注2……这种,要怎么定义这样一个环境呢?就是在证明之后的,然后自动编号的,但对下一个证明后的注,又要重新从1开始编号。

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2024-8-23 20:48:32
  1. \documentclass{ctexart}
  2. \usepackage{amsmath,amsthm}
  3. \newtheorem{thm}{定理}
  4. \newtheorem{zhu}{注}
  5. \numberwithin{zhu}{thm}
  6. \renewcommand\thezhu{\arabic{zhu}}
  7. \begin{document}
  8. \begin{thm}
  9. aaa
  10. \end{thm}
  11. \begin{zhu}
  12. bbb
  13. \end{zhu}
  14. \begin{zhu}
  15. ccc
  16. \end{zhu}
  17. \begin{thm}
  18. ddd
  19. \end{thm}
  20. \begin{zhu}
  21. eee
  22. \end{zhu}
  23. \begin{zhu}
  24. fff
  25. \end{zhu}
  26. \end{document}
Copy the Code

效果就是
定理 1. aaa
注 1. bbb
注 2. ccc
定理 2. ddd
注 1. eee
注 2. fff

418

Threads

1628

Posts

110K

Credits

Credits
11891

Show all posts

 Author| abababa Posted at 2024-8-24 16:48:15
kuing 发表于 2024-8-23 20:48
效果就是
定理 1. aaa
注 1. bbb
原来如此,要重新设置编号
\newtheorem{zhu}{注}[theorem]
\renewcommand\thezhu{\arabic{zhu}}

这个要是在“命题”等等环境后面,也有“注”,要怎么弄呢?

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2024-8-24 16:57:14
  1. \documentclass{ctexart}
  2. \usepackage{amsmath,amsthm}
  3. \newtheorem{thm}{定理}
  4. \newtheorem{mt}{命题}
  5. \newtheorem{zhu}{注}
  6. \numberwithin{zhu}{thm}
  7. \numberwithin{zhu}{mt}
  8. \renewcommand\thezhu{\arabic{zhu}}
  9. \begin{document}
  10. \begin{thm}
  11. aaa
  12. \end{thm}
  13. \begin{zhu}
  14. bbb
  15. \end{zhu}
  16. \begin{zhu}
  17. ccc
  18. \end{zhu}
  19. \begin{thm}
  20. ddd
  21. \end{thm}
  22. \begin{zhu}
  23. eee
  24. \end{zhu}
  25. \begin{zhu}
  26. fff
  27. \end{zhu}
  28. \begin{mt}
  29. ggg
  30. \end{mt}
  31. \begin{zhu}
  32. hhh
  33. \end{zhu}
  34. \begin{zhu}
  35. iii
  36. \end{zhu}
  37. \end{document}
Copy the Code

定理 1. aaa
注 1. bbb
注 2. ccc
定理 2. ddd
注 1. eee
注 2. fff
命题 1. ggg
注 1. hhh
注 2. iii

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2024-8-24 17:13:39
也可以使用 latex 的内部命令 \@addtoreset 实现相同的效果:将这三行
\numberwithin{zhu}{thm}
\numberwithin{zhu}{mt}
\renewcommand\thezhu{\arabic{zhu}}
改成
\makeatletter
\@addtoreset{zhu}{thm}
\@addtoreset{zhu}{mt}
\makeatother
这样就不依赖 amsmath 包。
完整代码:
  1. \documentclass{ctexart}
  2. \usepackage{amsthm}
  3. \newtheorem{thm}{定理}
  4. \newtheorem{mt}{命题}
  5. \newtheorem{zhu}{注}
  6. \makeatletter
  7. \@addtoreset{zhu}{thm}
  8. \@addtoreset{zhu}{mt}
  9. \makeatother
  10. \begin{document}
  11. \begin{thm}
  12. aaa
  13. \end{thm}
  14. \begin{zhu}
  15. bbb
  16. \end{zhu}
  17. \begin{zhu}
  18. ccc
  19. \end{zhu}
  20. \begin{thm}
  21. ddd
  22. \end{thm}
  23. \begin{zhu}
  24. eee
  25. \end{zhu}
  26. \begin{zhu}
  27. fff
  28. \end{zhu}
  29. \begin{mt}
  30. ggg
  31. \end{mt}
  32. \begin{zhu}
  33. hhh
  34. \end{zhu}
  35. \begin{zhu}
  36. iii
  37. \end{zhu}
  38. \end{document}
Copy the Code

418

Threads

1628

Posts

110K

Credits

Credits
11891

Show all posts

 Author| abababa Posted at 2024-8-24 19:47:25
kuing 发表于 2024-8-24 16:57
定理 1. aaa
注 1. bbb
注 2. ccc
原来如此,以前我只会用3楼那种,是用在“推论”上的,后来发现有的命题也有推论,就用不了了,还试过写成\newtheorem{corollary}{推论}[theorem,proposition]这种,没能编译过。

手机版Mobile version|Leisure Math Forum

2025-4-20 22:06 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list