找回密码
 快速注册
搜索
查看: 2610|回复: 0

关于《撸题集》里的♠♡♣♢

[复制链接]

730

主题

1万

回帖

9万

积分

积分
93613
QQ

显示全部楼层

kuing 发表于 2016-1-11 15:04 |阅读模式
大家应该都留意到我的《kuing网络撸题集》里用于题目间隔的 $\spadesuit\ \heartsuit\ \clubsuit\ \diamondsuit$ 在每一节内是循环出现的,我的实现方法如下,代码并不深,应该很容易理解。
  1. \documentclass{article}
  2. \usepackage{amsthm}
  3. \newtheorem{problem}{problem}[section]
  4. \newcommand\tmtop[1]{\ifcase#1\or
  5. \begin{center}$\spadesuit$\end{center}\or
  6. \begin{center}$\heartsuit$\end{center}\or
  7. \begin{center}$\clubsuit$\end{center}\or
  8. \begin{center}$\diamondsuit$\end{center}\fi}
  9. \newcounter{tmtopctr}
  10. \newcommand\puttmtop{\tmtop{\value{tmtopctr}}%
  11. \ifnum\value{tmtopctr}<4\relax
  12. \addtocounter{tmtopctr}{1}%
  13. \else\setcounter{tmtopctr}{1}\fi}
  14. \newenvironment{prob}{%
  15. \ifnum\value{problem}=0\relax
  16. \setcounter{tmtopctr}{0}\fi
  17. \puttmtop
  18. \begin{problem}}{\end{problem}}
  19. \begin{document}
  20. \section{test1}
  21. \begin{prob}
  22. aaa
  23. \end{prob}
  24. \begin{prob}
  25. bbb
  26. \end{prob}
  27. \begin{prob}
  28. ccc
  29. \end{prob}
  30. \begin{prob}
  31. ddd
  32. \end{prob}
  33. \begin{prob}
  34. eee
  35. \end{prob}
  36. \begin{prob}
  37. fff
  38. \end{prob}
  39. \begin{prob}
  40. ggg
  41. \end{prob}
  42. \begin{prob}
  43. hhh
  44. \end{prob}
  45. \begin{prob}
  46. iii
  47. \end{prob}
  48. \begin{prob}
  49. jjj
  50. \end{prob}
  51. \section{test2}
  52. \begin{prob}
  53. kkk
  54. \end{prob}
  55. \begin{prob}
  56. lll
  57. \end{prob}
  58. \begin{prob}
  59. mmm
  60. \end{prob}
  61. \end{document}
复制代码

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:26

Powered by Discuz!

× 快速回复 返回顶部 返回列表