How to define two counters in LaTeX?

In a specific document, I want the two counters “theorem” and “division” to be the same. Any ideas?

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

I use a specific counter "mycounter" to count something, and this counter is predefined in a specific package. When the unit rises, I want the "mycounter" to rise. And vice versa. When the unit is reset, I want mycounter to be reset.

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

0
source share
4 answers
Herbert Sizt is almost there.

\newtheorem{theorem}{Theorem}[subsection] (.. 1.2 1.2.1, 1.2.2 ..). \newtheorem{theorem}[subsection]{Theorem} , OP. 1.5 () 1.6, 1.7. , .

\def\theorem#1{\begingroup
  \let\tempsubsection\thesubsection
  \def\thesubsection{Thm.~\tempsubsection}%
  \subsection{#1}%
  \endgroup
}

"", , \subsection, , .

+2

, - (, "mycounter" ), , (1) \thesection \thetheorem (2) , .

, titlesec secsty . , , - , .

. , -, . , , , , , , Kopka Guide Latex .

EDIT: , , , , LaTeX / . , , ? , : http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Theorems.html

EDIT_2: Kopka Guide, , , \newtheorem, , . , '\newtheorem {theor} {t} []' "", . , , reset , , .

+1

, ; . , , , , - "" ?

Is the idea that you want to declare each theorem in your unit, and therefore want to refer to it by that number? In this case, it ...see Theorem~\ref{sec:foo}can get you at least halfway without special settings.

0
source

This is an example of the answer that Norman Gray gave, which looks great to me when I run it. Very good Norman, thanks. (You can change the [subsection] and {theorem} elements on the \ newtheorem line to see how this affects things.):

\documentclass{article}

\newtheorem{theorem}[subsection]{Theorem}

\begin{document}
\section{My Section}
\subsection{A subsection}

\begin{theorem}adfadfadf
\end{theorem}

\subsection{A subsection}

\begin{theorem}adfadfadf
\end{theorem}
\begin{theorem}adfadfadf
\end{theorem}

\begin{theorem}
\emph{(Lagrange Theorem)}
\label{Lagrange}
Let $G$ be a finite group, and let $H$ be a subgroup
of $G$.  Then the order of $H$ divides the order of $G$.
\end{theorem}

\end{document}
0
source

Source: https://habr.com/ru/post/1753807/


All Articles