如何识别 LaTeX 中的两个计数器? [英] How to identify two counters in 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屋!