Define a new align environment with custom numeration
up vote
2
down vote
favorite
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!!
numbering align
New contributor
add a comment |
up vote
2
down vote
favorite
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!!
numbering align
New contributor
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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!!
numbering align
New contributor
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!!
numbering align
numbering align
New contributor
New contributor
New contributor
asked Nov 20 at 21:30
Andrus
132
132
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
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}{thealphalignarabic{equation}}%
align
}
{endalignsetcounter{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}
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
add a comment |
up vote
1
down vote
The following code let
s 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.
documentclass{article}
usepackage{amsmath,alphalph}
newcounter{selfalignprefix}
newcounter{selfalign}[selfalignprefix]
renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}
makeatletter
newenvironment{selfalign}
{letc@equationc@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}
Thanks for your help!
– Andrus
Nov 20 at 23:57
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
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}{thealphalignarabic{equation}}%
align
}
{endalignsetcounter{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}
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
add a comment |
up vote
2
down vote
accepted
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}{thealphalignarabic{equation}}%
align
}
{endalignsetcounter{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}
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
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}{thealphalignarabic{equation}}%
align
}
{endalignsetcounter{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}
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}{thealphalignarabic{equation}}%
align
}
{endalignsetcounter{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}
answered Nov 20 at 21:47
egreg
700k8518623136
700k8518623136
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
add a comment |
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
Works perfectly, thanks!
– Andrus
Nov 20 at 23:56
add a comment |
up vote
1
down vote
The following code let
s 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.
documentclass{article}
usepackage{amsmath,alphalph}
newcounter{selfalignprefix}
newcounter{selfalign}[selfalignprefix]
renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}
makeatletter
newenvironment{selfalign}
{letc@equationc@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}
Thanks for your help!
– Andrus
Nov 20 at 23:57
add a comment |
up vote
1
down vote
The following code let
s 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.
documentclass{article}
usepackage{amsmath,alphalph}
newcounter{selfalignprefix}
newcounter{selfalign}[selfalignprefix]
renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}
makeatletter
newenvironment{selfalign}
{letc@equationc@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}
Thanks for your help!
– Andrus
Nov 20 at 23:57
add a comment |
up vote
1
down vote
up vote
1
down vote
The following code let
s 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.
documentclass{article}
usepackage{amsmath,alphalph}
newcounter{selfalignprefix}
newcounter{selfalign}[selfalignprefix]
renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}
makeatletter
newenvironment{selfalign}
{letc@equationc@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}
The following code let
s 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.
documentclass{article}
usepackage{amsmath,alphalph}
newcounter{selfalignprefix}
newcounter{selfalign}[selfalignprefix]
renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}
makeatletter
newenvironment{selfalign}
{letc@equationc@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}
answered Nov 20 at 21:50
Werner
432k599501630
432k599501630
Thanks for your help!
– Andrus
Nov 20 at 23:57
add a comment |
Thanks for your help!
– Andrus
Nov 20 at 23:57
Thanks for your help!
– Andrus
Nov 20 at 23:57
Thanks for your help!
– Andrus
Nov 20 at 23:57
add a comment |
Andrus is a new contributor. Be nice, and check out our Code of Conduct.
Andrus is a new contributor. Be nice, and check out our Code of Conduct.
Andrus is a new contributor. Be nice, and check out our Code of Conduct.
Andrus is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461029%2fdefine-a-new-align-environment-with-custom-numeration%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown