subequations: Equation numbering does not start with no. 1
The user egreg has posted a nice approach on how to increase equation numbers within subequations
.
Minimum Working Example (MWE):
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
Screenshot of the result:
Description of the issue:
As you can see in the screenshot, even the very first equation begins with no. 2 instead of no. 1. I have tried to repair this behavior, but I don't get the issue fixed.
How to fix the code so numbering will begin with no. 1 and does continue numbering order of the previous document?
equations numbering amsmath subequations alignat
add a comment |
The user egreg has posted a nice approach on how to increase equation numbers within subequations
.
Minimum Working Example (MWE):
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
Screenshot of the result:
Description of the issue:
As you can see in the screenshot, even the very first equation begins with no. 2 instead of no. 1. I have tried to repair this behavior, but I don't get the issue fixed.
How to fix the code so numbering will begin with no. 1 and does continue numbering order of the previous document?
equations numbering amsmath subequations alignat
1
Well, theadvanceparent
makes sense only in the middle ofsubequations
, not at the very beginning...
– campa
Apr 1 at 13:48
@campa: Yes, I thought the same. But even removing the very firstadvanceparent
-part does not change the numbering scheme.
– Dave
Apr 1 at 13:51
1
Yes, that's one of the possiblexdef
vsgdef
issues @daleif meant in his answer to your previous question:-)
– campa
Apr 1 at 13:54
@campa: Oh my... :-) Sometimes LaTeX is everything else but not handy. :-)
– Dave
Apr 1 at 13:57
add a comment |
The user egreg has posted a nice approach on how to increase equation numbers within subequations
.
Minimum Working Example (MWE):
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
Screenshot of the result:
Description of the issue:
As you can see in the screenshot, even the very first equation begins with no. 2 instead of no. 1. I have tried to repair this behavior, but I don't get the issue fixed.
How to fix the code so numbering will begin with no. 1 and does continue numbering order of the previous document?
equations numbering amsmath subequations alignat
The user egreg has posted a nice approach on how to increase equation numbers within subequations
.
Minimum Working Example (MWE):
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
Screenshot of the result:
Description of the issue:
As you can see in the screenshot, even the very first equation begins with no. 2 instead of no. 1. I have tried to repair this behavior, but I don't get the issue fixed.
How to fix the code so numbering will begin with no. 1 and does continue numbering order of the previous document?
equations numbering amsmath subequations alignat
equations numbering amsmath subequations alignat
asked Apr 1 at 13:43
DaveDave
1,236619
1,236619
1
Well, theadvanceparent
makes sense only in the middle ofsubequations
, not at the very beginning...
– campa
Apr 1 at 13:48
@campa: Yes, I thought the same. But even removing the very firstadvanceparent
-part does not change the numbering scheme.
– Dave
Apr 1 at 13:51
1
Yes, that's one of the possiblexdef
vsgdef
issues @daleif meant in his answer to your previous question:-)
– campa
Apr 1 at 13:54
@campa: Oh my... :-) Sometimes LaTeX is everything else but not handy. :-)
– Dave
Apr 1 at 13:57
add a comment |
1
Well, theadvanceparent
makes sense only in the middle ofsubequations
, not at the very beginning...
– campa
Apr 1 at 13:48
@campa: Yes, I thought the same. But even removing the very firstadvanceparent
-part does not change the numbering scheme.
– Dave
Apr 1 at 13:51
1
Yes, that's one of the possiblexdef
vsgdef
issues @daleif meant in his answer to your previous question:-)
– campa
Apr 1 at 13:54
@campa: Oh my... :-) Sometimes LaTeX is everything else but not handy. :-)
– Dave
Apr 1 at 13:57
1
1
Well, the
advanceparent
makes sense only in the middle of subequations
, not at the very beginning...– campa
Apr 1 at 13:48
Well, the
advanceparent
makes sense only in the middle of subequations
, not at the very beginning...– campa
Apr 1 at 13:48
@campa: Yes, I thought the same. But even removing the very first
advanceparent
-part does not change the numbering scheme.– Dave
Apr 1 at 13:51
@campa: Yes, I thought the same. But even removing the very first
advanceparent
-part does not change the numbering scheme.– Dave
Apr 1 at 13:51
1
1
Yes, that's one of the possible
xdef
vs gdef
issues @daleif meant in his answer to your previous question :-)
– campa
Apr 1 at 13:54
Yes, that's one of the possible
xdef
vs gdef
issues @daleif meant in his answer to your previous question :-)
– campa
Apr 1 at 13:54
@campa: Oh my... :-) Sometimes LaTeX is everything else but not handy. :-)
– Dave
Apr 1 at 13:57
@campa: Oh my... :-) Sometimes LaTeX is everything else but not handy. :-)
– Dave
Apr 1 at 13:57
add a comment |
2 Answers
2
active
oldest
votes
The subequations
environment allows to use label
just after it starts, in order to refer to the parent number globally. The idea is exploited in the linked answer.
You don't need this, so you have to explicitly start the business.
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
newcommand{advanceparent}{%
stepcounter{parentequation}%
startparent
}
newcommand{startparent}{%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{2}
startparent
1 & =1 &quad & text{(Example text)} \
2 & =2 & & text{(Example text)} \
advanceparent
3 & =3 & & text{(Example text)} \
4 & =4 & & text{(Example text)}
end{alignat}
end{subequations}
end{document}
add a comment |
You can decrease the counter inside of the subequation
environment:
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
addtocounter{parentequation}{-1}%
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
If you don't want to do that manually at every set of equations, then you can hook it into the environment with etoolbox
. In the example I have used the begin of alignat
because the begin of subequations
is still too early (the counter is setup after that).
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
AtBeginEnvironment{alignat}{addtocounter{parentequation}{-1}}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
%addtocounter{parentequation}{-1}% no longer needed
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f482588%2fsubequations-equation-numbering-does-not-start-with-no-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The subequations
environment allows to use label
just after it starts, in order to refer to the parent number globally. The idea is exploited in the linked answer.
You don't need this, so you have to explicitly start the business.
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
newcommand{advanceparent}{%
stepcounter{parentequation}%
startparent
}
newcommand{startparent}{%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{2}
startparent
1 & =1 &quad & text{(Example text)} \
2 & =2 & & text{(Example text)} \
advanceparent
3 & =3 & & text{(Example text)} \
4 & =4 & & text{(Example text)}
end{alignat}
end{subequations}
end{document}
add a comment |
The subequations
environment allows to use label
just after it starts, in order to refer to the parent number globally. The idea is exploited in the linked answer.
You don't need this, so you have to explicitly start the business.
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
newcommand{advanceparent}{%
stepcounter{parentequation}%
startparent
}
newcommand{startparent}{%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{2}
startparent
1 & =1 &quad & text{(Example text)} \
2 & =2 & & text{(Example text)} \
advanceparent
3 & =3 & & text{(Example text)} \
4 & =4 & & text{(Example text)}
end{alignat}
end{subequations}
end{document}
add a comment |
The subequations
environment allows to use label
just after it starts, in order to refer to the parent number globally. The idea is exploited in the linked answer.
You don't need this, so you have to explicitly start the business.
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
newcommand{advanceparent}{%
stepcounter{parentequation}%
startparent
}
newcommand{startparent}{%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{2}
startparent
1 & =1 &quad & text{(Example text)} \
2 & =2 & & text{(Example text)} \
advanceparent
3 & =3 & & text{(Example text)} \
4 & =4 & & text{(Example text)}
end{alignat}
end{subequations}
end{document}
The subequations
environment allows to use label
just after it starts, in order to refer to the parent number globally. The idea is exploited in the linked answer.
You don't need this, so you have to explicitly start the business.
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
newcommand{advanceparent}{%
stepcounter{parentequation}%
startparent
}
newcommand{startparent}{%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
begin{alignat}{2}
startparent
1 & =1 &quad & text{(Example text)} \
2 & =2 & & text{(Example text)} \
advanceparent
3 & =3 & & text{(Example text)} \
4 & =4 & & text{(Example text)}
end{alignat}
end{subequations}
end{document}
answered Apr 1 at 21:34
egregegreg
733k8919313254
733k8919313254
add a comment |
add a comment |
You can decrease the counter inside of the subequation
environment:
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
addtocounter{parentequation}{-1}%
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
If you don't want to do that manually at every set of equations, then you can hook it into the environment with etoolbox
. In the example I have used the begin of alignat
because the begin of subequations
is still too early (the counter is setup after that).
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
AtBeginEnvironment{alignat}{addtocounter{parentequation}{-1}}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
%addtocounter{parentequation}{-1}% no longer needed
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
add a comment |
You can decrease the counter inside of the subequation
environment:
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
addtocounter{parentequation}{-1}%
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
If you don't want to do that manually at every set of equations, then you can hook it into the environment with etoolbox
. In the example I have used the begin of alignat
because the begin of subequations
is still too early (the counter is setup after that).
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
AtBeginEnvironment{alignat}{addtocounter{parentequation}{-1}}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
%addtocounter{parentequation}{-1}% no longer needed
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
add a comment |
You can decrease the counter inside of the subequation
environment:
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
addtocounter{parentequation}{-1}%
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
If you don't want to do that manually at every set of equations, then you can hook it into the environment with etoolbox
. In the example I have used the begin of alignat
because the begin of subequations
is still too early (the counter is setup after that).
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
AtBeginEnvironment{alignat}{addtocounter{parentequation}{-1}}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
%addtocounter{parentequation}{-1}% no longer needed
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
You can decrease the counter inside of the subequation
environment:
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
addtocounter{parentequation}{-1}%
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
If you don't want to do that manually at every set of equations, then you can hook it into the environment with etoolbox
. In the example I have used the begin of alignat
because the begin of subequations
is still too early (the counter is setup after that).
documentclass{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{etoolbox}
AtBeginEnvironment{alignat}{addtocounter{parentequation}{-1}}
newcommand{advanceparent}{%
stepcounter{parentequation}%
setcounter{equation}{0}%
xdeftheparentequation{arabic{parentequation}}%
}
begin{document}
begin{subequations}
%addtocounter{parentequation}{-1}% no longer needed
begin{alignat}{3}
advanceparent
&& 1 & =1 &quad & (text{Example text}) \
&& 2 & =2 & & (text{Example text}) \
advanceparent
&& 3 & =3 & & (text{Example text}) \
&& 4 & =4 & & (text{Example text})
end{alignat}
end{subequations}
end{document}
answered Apr 1 at 14:01
MarijnMarijn
8,479639
8,479639
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f482588%2fsubequations-equation-numbering-does-not-start-with-no-1%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
1
Well, the
advanceparent
makes sense only in the middle ofsubequations
, not at the very beginning...– campa
Apr 1 at 13:48
@campa: Yes, I thought the same. But even removing the very first
advanceparent
-part does not change the numbering scheme.– Dave
Apr 1 at 13:51
1
Yes, that's one of the possible
xdef
vsgdef
issues @daleif meant in his answer to your previous question:-)
– campa
Apr 1 at 13:54
@campa: Oh my... :-) Sometimes LaTeX is everything else but not handy. :-)
– Dave
Apr 1 at 13:57