Automatic table row numbers
Is there any way to get automatic row numbers in table?
For example, if I define table contents as
begin{tabular} % black magic column definition
rownumber & foo\
rownumber & bar\
rownumber & baz\
end{tabular}
and get something like
1 | foo
2 | bar
3 | baz
tables numbering
add a comment |
Is there any way to get automatic row numbers in table?
For example, if I define table contents as
begin{tabular} % black magic column definition
rownumber & foo\
rownumber & bar\
rownumber & baz\
end{tabular}
and get something like
1 | foo
2 | bar
3 | baz
tables numbering
Duplicate question: How to enumerate the rows of a table
– koppor
Oct 20 '15 at 13:02
add a comment |
Is there any way to get automatic row numbers in table?
For example, if I define table contents as
begin{tabular} % black magic column definition
rownumber & foo\
rownumber & bar\
rownumber & baz\
end{tabular}
and get something like
1 | foo
2 | bar
3 | baz
tables numbering
Is there any way to get automatic row numbers in table?
For example, if I define table contents as
begin{tabular} % black magic column definition
rownumber & foo\
rownumber & bar\
rownumber & baz\
end{tabular}
and get something like
1 | foo
2 | bar
3 | baz
tables numbering
tables numbering
edited Jul 15 '17 at 14:56
David Carlisle
482k3811131850
482k3811131850
asked Jun 21 '11 at 11:46
miah
273135
273135
Duplicate question: How to enumerate the rows of a table
– koppor
Oct 20 '15 at 13:02
add a comment |
Duplicate question: How to enumerate the rows of a table
– koppor
Oct 20 '15 at 13:02
Duplicate question: How to enumerate the rows of a table
– koppor
Oct 20 '15 at 13:02
Duplicate question: How to enumerate the rows of a table
– koppor
Oct 20 '15 at 13:02
add a comment |
3 Answers
3
active
oldest
votes
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If you want to start with the second row use
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
defrownumber{}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something
gdefrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}} \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If one wants a heading for the columns use:
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
multicolumn{1}{@{makebox[3em][r]{ID~}} | r}{emph{whatever}}\
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
1
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
2
edit the commandrownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row
– Herbert
Jun 30 '13 at 7:08
1
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
1
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
1
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
|
show 8 more comments
You could just make it use a counter...
documentclass{article}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{l|r}
rownumber & Something \
rownumber & Other stuff \
rownumber & MAGIC!
end{tabular}
end{document}
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
4
@miah: Load etoolbox and saypretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
4
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
|
show 5 more comments
A quick plain-format version as well for completenes:
newcountrowcount
defmyhalign#1{halign{globaladvancerowcount by 1 therowcountquad##}rowcount=0}
% Yes, yes, next up in *sniping*: "One problem: you can't use repeating preamble"...
myhalign{#hfilcr
blahcr
foocr}
halign{#hfilcr
barcr
bazcr}
myhalign{&#hfilcr
asdf&asdf&asdfcr
sdfg&asdf&dfghcr}
myhalign{#hfil&&hfil#cr
doesn't&workcr
boo&hoocr}
bye
Two problems. 1. Every subsequenthalign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omittingtherowcount
would not avoid stepping the counter. The stepping should go in the table preamble.
– egreg
Jun 21 '11 at 14:48
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg: You don't need the@<username>
-notation when you're addressing your comment to the answerer/questioner.
– morbusg
Jun 21 '11 at 14:57
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%2f21243%2fautomatic-table-row-numbers%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If you want to start with the second row use
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
defrownumber{}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something
gdefrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}} \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If one wants a heading for the columns use:
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
multicolumn{1}{@{makebox[3em][r]{ID~}} | r}{emph{whatever}}\
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
1
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
2
edit the commandrownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row
– Herbert
Jun 30 '13 at 7:08
1
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
1
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
1
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
|
show 8 more comments
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If you want to start with the second row use
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
defrownumber{}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something
gdefrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}} \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If one wants a heading for the columns use:
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
multicolumn{1}{@{makebox[3em][r]{ID~}} | r}{emph{whatever}}\
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
1
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
2
edit the commandrownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row
– Herbert
Jun 30 '13 at 7:08
1
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
1
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
1
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
|
show 8 more comments
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If you want to start with the second row use
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
defrownumber{}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something
gdefrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}} \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If one wants a heading for the columns use:
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
multicolumn{1}{@{makebox[3em][r]{ID~}} | r}{emph{whatever}}\
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If you want to start with the second row use
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
defrownumber{}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
Something
gdefrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}} \
Other stuff \
MAGIC!
end{tabular}
end{document}
output
If one wants a heading for the columns use:
documentclass{article}
usepackage{array,etoolbox}
pretotabular{setcounter{magicrownumbers}{0}}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r}
multicolumn{1}{@{makebox[3em][r]{ID~}} | r}{emph{whatever}}\
Something \
Other stuff \
MAGIC!
end{tabular}
end{document}
edited Dec 8 at 10:36
answered Jun 21 '11 at 11:59
Herbert
269k24408717
269k24408717
1
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
2
edit the commandrownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row
– Herbert
Jun 30 '13 at 7:08
1
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
1
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
1
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
|
show 8 more comments
1
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
2
edit the commandrownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row
– Herbert
Jun 30 '13 at 7:08
1
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
1
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
1
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
1
1
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
Is it possible to start numbering at the second line? i.e. have a header row? TIA.
– Fabian Tamp
Oct 10 '12 at 12:00
2
2
edit the command
rownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row– Herbert
Jun 30 '13 at 7:08
edit the command
rownumber that it test the value:
ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fi` then it puts only the number at the third row– Herbert
Jun 30 '13 at 7:08
1
1
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
@Herbert Do you mean replace begin{tabular}{@{makebox[3em][r]{rownumberspace}} | r} with begin{tabular}{@{makebox[3em][r]{ifnumthemagicrownumber>2relaxarabic{magicrownumbers}fispace}} | r} ? When I do that, I get "Undefined control sequence" errors.
– David Doria
Jul 7 '14 at 14:21
1
1
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
@littleO: see my edited answer
– Herbert
Sep 5 '15 at 7:10
1
1
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
see edited anwer (at the end)
– Herbert
Dec 8 at 10:36
|
show 8 more comments
You could just make it use a counter...
documentclass{article}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{l|r}
rownumber & Something \
rownumber & Other stuff \
rownumber & MAGIC!
end{tabular}
end{document}
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
4
@miah: Load etoolbox and saypretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
4
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
|
show 5 more comments
You could just make it use a counter...
documentclass{article}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{l|r}
rownumber & Something \
rownumber & Other stuff \
rownumber & MAGIC!
end{tabular}
end{document}
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
4
@miah: Load etoolbox and saypretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
4
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
|
show 5 more comments
You could just make it use a counter...
documentclass{article}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{l|r}
rownumber & Something \
rownumber & Other stuff \
rownumber & MAGIC!
end{tabular}
end{document}
You could just make it use a counter...
documentclass{article}
newcounter{magicrownumbers}
newcommandrownumber{stepcounter{magicrownumbers}arabic{magicrownumbers}}
begin{document}
begin{tabular}{l|r}
rownumber & Something \
rownumber & Other stuff \
rownumber & MAGIC!
end{tabular}
end{document}
edited Sep 6 at 16:46
alhelal
1,004119
1,004119
answered Jun 21 '11 at 11:51
Seamus
44.9k35215332
44.9k35215332
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
4
@miah: Load etoolbox and saypretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
4
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
|
show 5 more comments
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
4
@miah: Load etoolbox and saypretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
4
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
Is there any frendly way to reset the counter between tables?
– miah
Jun 21 '11 at 11:56
4
4
@miah: Load etoolbox and say
pretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
@miah: Load etoolbox and say
pretotabular{setcounter{magicrownumbers}{0}}
– egreg
Jun 21 '11 at 11:58
4
4
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@egreg I put that before my second table but the counter did not reset. I had to use simply setcounter{magicrownumbers}{0} instead
– David Doria
Jul 7 '14 at 14:27
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@DavidDoria That code should go in the preamble.
– egreg
Jul 7 '14 at 14:29
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
@egreg Hm, even with that in the preamble, the row numbers do not reset for me unless I clear the counter manually as I explained.
– David Doria
Jul 7 '14 at 15:05
|
show 5 more comments
A quick plain-format version as well for completenes:
newcountrowcount
defmyhalign#1{halign{globaladvancerowcount by 1 therowcountquad##}rowcount=0}
% Yes, yes, next up in *sniping*: "One problem: you can't use repeating preamble"...
myhalign{#hfilcr
blahcr
foocr}
halign{#hfilcr
barcr
bazcr}
myhalign{&#hfilcr
asdf&asdf&asdfcr
sdfg&asdf&dfghcr}
myhalign{#hfil&&hfil#cr
doesn't&workcr
boo&hoocr}
bye
Two problems. 1. Every subsequenthalign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omittingtherowcount
would not avoid stepping the counter. The stepping should go in the table preamble.
– egreg
Jun 21 '11 at 14:48
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg: You don't need the@<username>
-notation when you're addressing your comment to the answerer/questioner.
– morbusg
Jun 21 '11 at 14:57
add a comment |
A quick plain-format version as well for completenes:
newcountrowcount
defmyhalign#1{halign{globaladvancerowcount by 1 therowcountquad##}rowcount=0}
% Yes, yes, next up in *sniping*: "One problem: you can't use repeating preamble"...
myhalign{#hfilcr
blahcr
foocr}
halign{#hfilcr
barcr
bazcr}
myhalign{&#hfilcr
asdf&asdf&asdfcr
sdfg&asdf&dfghcr}
myhalign{#hfil&&hfil#cr
doesn't&workcr
boo&hoocr}
bye
Two problems. 1. Every subsequenthalign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omittingtherowcount
would not avoid stepping the counter. The stepping should go in the table preamble.
– egreg
Jun 21 '11 at 14:48
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg: You don't need the@<username>
-notation when you're addressing your comment to the answerer/questioner.
– morbusg
Jun 21 '11 at 14:57
add a comment |
A quick plain-format version as well for completenes:
newcountrowcount
defmyhalign#1{halign{globaladvancerowcount by 1 therowcountquad##}rowcount=0}
% Yes, yes, next up in *sniping*: "One problem: you can't use repeating preamble"...
myhalign{#hfilcr
blahcr
foocr}
halign{#hfilcr
barcr
bazcr}
myhalign{&#hfilcr
asdf&asdf&asdfcr
sdfg&asdf&dfghcr}
myhalign{#hfil&&hfil#cr
doesn't&workcr
boo&hoocr}
bye
A quick plain-format version as well for completenes:
newcountrowcount
defmyhalign#1{halign{globaladvancerowcount by 1 therowcountquad##}rowcount=0}
% Yes, yes, next up in *sniping*: "One problem: you can't use repeating preamble"...
myhalign{#hfilcr
blahcr
foocr}
halign{#hfilcr
barcr
bazcr}
myhalign{&#hfilcr
asdf&asdf&asdfcr
sdfg&asdf&dfghcr}
myhalign{#hfil&&hfil#cr
doesn't&workcr
boo&hoocr}
bye
edited Jun 21 '11 at 16:22
answered Jun 21 '11 at 14:34
morbusg
19.9k362136
19.9k362136
Two problems. 1. Every subsequenthalign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omittingtherowcount
would not avoid stepping the counter. The stepping should go in the table preamble.
– egreg
Jun 21 '11 at 14:48
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg: You don't need the@<username>
-notation when you're addressing your comment to the answerer/questioner.
– morbusg
Jun 21 '11 at 14:57
add a comment |
Two problems. 1. Every subsequenthalign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omittingtherowcount
would not avoid stepping the counter. The stepping should go in the table preamble.
– egreg
Jun 21 '11 at 14:48
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg: You don't need the@<username>
-notation when you're addressing your comment to the answerer/questioner.
– morbusg
Jun 21 '11 at 14:57
Two problems. 1. Every subsequent
halign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omitting therowcount
would not avoid stepping the counter. The stepping should go in the table preamble.– egreg
Jun 21 '11 at 14:48
Two problems. 1. Every subsequent
halign
will advance the counter even if it doesn't need it. 2. If a row shouldn't be numbered (a header), omitting therowcount
would not avoid stepping the counter. The stepping should go in the table preamble.– egreg
Jun 21 '11 at 14:48
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg I wasn't aiming for a be-all-end-all solution; just an answer to the question.
– morbusg
Jun 21 '11 at 14:51
@egreg: You don't need the
@<username>
-notation when you're addressing your comment to the answerer/questioner.– morbusg
Jun 21 '11 at 14:57
@egreg: You don't need the
@<username>
-notation when you're addressing your comment to the answerer/questioner.– morbusg
Jun 21 '11 at 14:57
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f21243%2fautomatic-table-row-numbers%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
Duplicate question: How to enumerate the rows of a table
– koppor
Oct 20 '15 at 13:02