tags:

views:

40

answers:

1

Here I asked how to identify the subsection and theorem counters in LaTeX. It turns out that I must also identify the equation and subsection counters for my purposes. The methods suggested as answers to that question won't work. Please help me out, if you can. Thank you very much.

+2  A: 

Not sure if it's exactly what you're looking for, but here's example showing one way to add equation numbering to your previous solution. It does involve use of a user-defined 'myequation' environment instead of 'equation' environment:

\documentclass{article}

\newtheorem{theorem}[subsection]{Theorem}

\newenvironment{myequation}
{\setcounter{equation}{\value{subsection}}\begin{equation}}
{\stepcounter{subsection}\end{equation}}
\renewcommand{\theequation}{\mbox{\arabic{section}.\arabic{equation}}}

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

\begin{theorem}adfadfadf
\end{theorem}
\begin{myequation}abcdefg
\end{myequation}
\begin{myequation}abcdefg
\end{myequation}
\subsection{A subsection}

\begin{theorem}adfadfadf
\end{theorem}
\begin{theorem}adfadfadf
\end{theorem}
\begin{myequation}abcdefg
\end{myequation}


\end{document}
Herbert Sitz
This would be perfect if there is a way to use \equation itself. In any case, I was re-typesetting a decades-old paper in which this style looks a bit odd to me; so perhaps it is best that I use the normal behavior of \equation. Thanks, and I've accepted your answer.
George Scaria
There is a straightforward way to redefine \equation to do it, but I think it requires knowing what the formatting settings are for the \equation environment. Those could be looked up fairly easily. Or maybe someone knows another shortcut to do it that way. But one school of thought (i.e, mine, usually) says if you're modifying behavior you should make it as clear as possible by giving it a new name, anyway. In any case if you're not using this modification no need to pursue further. Cheers.
Herbert Sitz