如何识别 LaTeX 中的两个计数器? [英] How to identify two counters in LaTeX?

查看:14
本文介绍了如何识别 LaTeX 中的两个计数器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In a certain document, I want to make the two counters "theorem" and "subsection" to be one and the same thing. Any ideas?

Edit: Since the math parts are potentially confusing, I rephrase the question as follows without any such references.

I use a certain counter "mycounter" for counting something, and this counter is predefined in a certain package. When the subsection goes up, I want "mycounter" to go up. And vice-versa. When subsection is reset, I want "mycounter" to be reset.

This is what I hope to achieve by identifying the two counters.

解决方案

Herbert Sizt is almost there.

ewtheorem{theorem}{Theorem}[subsection] would number theorems within subsections (ie, the theorems within Section 1.2 would be 1.2.1, 1.2.2, etc). Instead ewtheorem{theorem}[subsection]{Theorem} appears to do what the OP requires. Section 1.5 (say) would be followed by theorem 1.6, which would be followed by section 1.7. The theorem is formatted differently from sections.

An alternative way is to do

def	heorem#1{egingroup
  let	empsubsection	hesubsection
  def	hesubsection{Thm.~	empsubsection}%
  subsection{#1}%
  endgroup
}

That's slightly more 'home-made', but makes the theorems have exactly the same layout as subsection, which may or may not be what's required.

这篇关于如何识别 LaTeX 中的两个计数器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆