2

I am writting a report and I have multiple systems of equations. I want to avoid have too big numbers (Equation 4.200 for example) and I dont want to link the numbering to the chapter or the section.

I want a personalized align enviroment that enummerates the equations as:

(A1)

(A2)

(A3)

The first time I use it and

(B1)

(B2)

(B3)

The second time I use and so on.

The normal numeration of the usual align enviroment or equation enviroment should not be afffected.

I have been trying for some hours but none of the answers seems to work :(

Thanks in advance!!

2

We can locally change the equation counter (restoring it at the end). This also behaves well with \label and \ref.

\documentclass{article}
\usepackage{amsmath}

\newcounter{alphalign}
\renewcommand{\thealphalign}{\Alph{alphalign}}
\newcounter{alphalignsavedequation}

\newenvironment{alphalign}
 {%
  \setcounter{alphalignsavedequation}{\value{equation}}%
  \counterwithin*{equation}{alphalign}%
  \stepcounter{alphalign}%
  \renewcommand{\theequation}{\thealphalign\arabic{equation}}%
  \align
 }
 {\endalign\setcounter{equation}{\value{alphalignsavedequation}}}

\begin{document}

An equation
\begin{equation}
0=0
\end{equation}
An alignment with alpha
\begin{alphalign}
0&=0\\
1&=1\\
2&=2
\end{alphalign}
Another equation
\begin{equation}
0=0
\end{equation}
Another alignment with alpha
\begin{alphalign}
0&=0\\
1&=1\\
2&=2
\end{alphalign}
Another equation
\begin{equation}
0=0
\end{equation}

\end{document}

enter image description here

1

The following code \lets the equation counter to another counter called selfalign within the newly-defined environment (group) selfalign. Since the \let is scoped/temporary within the group, it reverts to the original definition afterwards. alphalph is used to ensure the selfalign counter prefix can roll over beyond Z, if needed.

enter image description here

\documentclass{article}

\usepackage{amsmath,alphalph}
\newcounter{selfalignprefix}
\newcounter{selfalign}[selfalignprefix]

\renewcommand{\theselfalignprefix}{\AlphAlph{\value{selfalignprefix}}}
\renewcommand{\theselfalign}{\theselfalignprefix\arabic{selfalign}}

\makeatletter
\newenvironment{selfalign}
  {\let\c@equation\c@selfalign% Make equation counter point to the selfalign counter
   \stepcounter{selfalignprefix}% Step the prefix counter
   \renewcommand{\theequation}{\theselfalign}% Update equation counter representation
  \align}
  {\endalign}
\makeatother

\begin{document}

\begin{align}
  f(x) \\ g(x) \\ h(x)
\end{align}

\begin{selfalign}
  f(x) \\ g(x) \\ h(x)
\end{selfalign}

\begin{align}
  f(x) \\ g(x) \\ h(x)
\end{align}

\begin{selfalign}
  f(x) \\ g(x) \\ h(x)
\end{selfalign}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.