Number subsections and subsubsections, but not sections
I'm working on an article and I don't want to number my sections. However, I do want my subsections and subsubsections to be numbered.
Right now my document has this numbering, but the 0 in 0.X.Y should not be there. How can I fix that?
Currently:
Section
0.1 subsection
0.2 subsection
0.2.1 subsubsection
0.3 subsection
Should be:
Section
1. subsection
2. subsection
2.1 subsubsection
3. subsection
This is my code:
documentclass{article}
begin{document}
section*{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
end{document}
PS: I did search a on the web and found a lot on this topic, but not a solution to this particular thing.
sectioning numbering
add a comment |
I'm working on an article and I don't want to number my sections. However, I do want my subsections and subsubsections to be numbered.
Right now my document has this numbering, but the 0 in 0.X.Y should not be there. How can I fix that?
Currently:
Section
0.1 subsection
0.2 subsection
0.2.1 subsubsection
0.3 subsection
Should be:
Section
1. subsection
2. subsection
2.1 subsubsection
3. subsection
This is my code:
documentclass{article}
begin{document}
section*{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
end{document}
PS: I did search a on the web and found a lot on this topic, but not a solution to this particular thing.
sectioning numbering
What should happen after a 2ndsection*
? Should the numbering start again at 1 or should it continue?
– knut
Dec 5 '11 at 21:39
add a comment |
I'm working on an article and I don't want to number my sections. However, I do want my subsections and subsubsections to be numbered.
Right now my document has this numbering, but the 0 in 0.X.Y should not be there. How can I fix that?
Currently:
Section
0.1 subsection
0.2 subsection
0.2.1 subsubsection
0.3 subsection
Should be:
Section
1. subsection
2. subsection
2.1 subsubsection
3. subsection
This is my code:
documentclass{article}
begin{document}
section*{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
end{document}
PS: I did search a on the web and found a lot on this topic, but not a solution to this particular thing.
sectioning numbering
I'm working on an article and I don't want to number my sections. However, I do want my subsections and subsubsections to be numbered.
Right now my document has this numbering, but the 0 in 0.X.Y should not be there. How can I fix that?
Currently:
Section
0.1 subsection
0.2 subsection
0.2.1 subsubsection
0.3 subsection
Should be:
Section
1. subsection
2. subsection
2.1 subsubsection
3. subsection
This is my code:
documentclass{article}
begin{document}
section*{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
end{document}
PS: I did search a on the web and found a lot on this topic, but not a solution to this particular thing.
sectioning numbering
sectioning numbering
edited Dec 5 '11 at 16:48
![](https://i.stack.imgur.com/zb5Zo.png?s=32&g=1)
![](https://i.stack.imgur.com/zb5Zo.png?s=32&g=1)
lockstep
192k53593723
192k53593723
asked Dec 5 '11 at 14:40
TonyTony
156124
156124
What should happen after a 2ndsection*
? Should the numbering start again at 1 or should it continue?
– knut
Dec 5 '11 at 21:39
add a comment |
What should happen after a 2ndsection*
? Should the numbering start again at 1 or should it continue?
– knut
Dec 5 '11 at 21:39
What should happen after a 2nd
section*
? Should the numbering start again at 1 or should it continue?– knut
Dec 5 '11 at 21:39
What should happen after a 2nd
section*
? Should the numbering start again at 1 or should it continue?– knut
Dec 5 '11 at 21:39
add a comment |
3 Answers
3
active
oldest
votes
If you're interested in printing section{<heading>}
in a similar way that section*{<heading>}
would print (that is, flush left and not indented), then titlesec
provides an easy interface:
documentclass{article}
usepackage{titlesec}% http://ctan.org/pkg/titlesec
titleformat{section}%
[hang]% <shape>
{normalfontbfseriesLarge}% <format>
{}% <label>
{0pt}% <sep>
{}% <before code>
renewcommand{thesection}{}% Remove section references...
renewcommand{thesubsection}{arabic{subsection}}%... from subsections
begin{document}
section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Second subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsubsection{First subsubsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Last subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
end{document}
This just sets the label separator between the section number and title to 0pt
, as well as not printing the number. normalfontbfseriesLarge
is the default formatting for article
.
add a comment |
Note: I rewrote this answer significantly after becoming aware of Ulrike Fisher's comment to @knut's answer.
There are two steps that need to be taken. The first, straightforward step consists of redefining the thesubsection
macro. The second, less obvious step involves a redefinition of the LaTeX internal macro @seccntformat
, as is explained in the book The LaTeX Companion, 2nd ed. The following MWE applies both steps:
documentclass{article}
renewcommand{thesubsection}{arabic{subsection}}
makeatletter
def@seccntformat#1{@ifundefined{#1@cntformat}%
{csname the#1endcsnamequad}% default
{csname #1@cntformatendcsname}}% enable individual control
newcommandsection@cntformat{}
makeatother
begin{document}
section{First Section}
subsection{First subsection}
subsection{Second subsection}
subsubsection{First subsubsection}
subsection{Third subsection}
section{Second Section}
subsection{A new subsection}
end{document}
But without the redefinition ofthesection
you still get a numbered section. See also my answer.
– knut
Dec 5 '11 at 19:14
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of thesubsections
after the nextsection*
- but there is no information in the question, what's needed in this case.
– knut
Dec 5 '11 at 21:38
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to usesection
rather thansection*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of@seccntformat
and a new macro,section@cntformat
-- set here to{}
. Interestingly, it is not necesssary to setthesection
to something like{}
. Whew, this was a lot harder than it looked like at first!
– Mico
Dec 6 '11 at 0:24
1
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instructionnewcommandsubsection@cntformat{thesubsection.space}
, immediately beforemakeatother
.
– Mico
3 hours ago
|
show 2 more comments
Does this works for you:
documentclass{article}
begin{document}
part*{Section}
section{subsection}
section{subsection}
subsection{subsubsection}
blah
section{subsection}
end{document}
Or is there a special reason, why you need sections as sections and subsections as subsection?
Alternative:
documentclass{article}
renewcommand{thesection}{}
renewcommand{thesubsection}{arabic{subsection}}
begin{document}
section{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
section{Section 2}
subsection{subsection 2}
This subsection starts again with 1.
end{document}
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
3
This will not restart the numbering of thesubsection
s after the nextsection*
.
– Ulrike Fischer
Dec 5 '11 at 15:21
You are right - but it works withsection
. I change my answer.
– knut
Dec 5 '11 at 19:16
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%2f37189%2fnumber-subsections-and-subsubsections-but-not-sections%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
If you're interested in printing section{<heading>}
in a similar way that section*{<heading>}
would print (that is, flush left and not indented), then titlesec
provides an easy interface:
documentclass{article}
usepackage{titlesec}% http://ctan.org/pkg/titlesec
titleformat{section}%
[hang]% <shape>
{normalfontbfseriesLarge}% <format>
{}% <label>
{0pt}% <sep>
{}% <before code>
renewcommand{thesection}{}% Remove section references...
renewcommand{thesubsection}{arabic{subsection}}%... from subsections
begin{document}
section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Second subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsubsection{First subsubsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Last subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
end{document}
This just sets the label separator between the section number and title to 0pt
, as well as not printing the number. normalfontbfseriesLarge
is the default formatting for article
.
add a comment |
If you're interested in printing section{<heading>}
in a similar way that section*{<heading>}
would print (that is, flush left and not indented), then titlesec
provides an easy interface:
documentclass{article}
usepackage{titlesec}% http://ctan.org/pkg/titlesec
titleformat{section}%
[hang]% <shape>
{normalfontbfseriesLarge}% <format>
{}% <label>
{0pt}% <sep>
{}% <before code>
renewcommand{thesection}{}% Remove section references...
renewcommand{thesubsection}{arabic{subsection}}%... from subsections
begin{document}
section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Second subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsubsection{First subsubsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Last subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
end{document}
This just sets the label separator between the section number and title to 0pt
, as well as not printing the number. normalfontbfseriesLarge
is the default formatting for article
.
add a comment |
If you're interested in printing section{<heading>}
in a similar way that section*{<heading>}
would print (that is, flush left and not indented), then titlesec
provides an easy interface:
documentclass{article}
usepackage{titlesec}% http://ctan.org/pkg/titlesec
titleformat{section}%
[hang]% <shape>
{normalfontbfseriesLarge}% <format>
{}% <label>
{0pt}% <sep>
{}% <before code>
renewcommand{thesection}{}% Remove section references...
renewcommand{thesubsection}{arabic{subsection}}%... from subsections
begin{document}
section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Second subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsubsection{First subsubsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Last subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
end{document}
This just sets the label separator between the section number and title to 0pt
, as well as not printing the number. normalfontbfseriesLarge
is the default formatting for article
.
If you're interested in printing section{<heading>}
in a similar way that section*{<heading>}
would print (that is, flush left and not indented), then titlesec
provides an easy interface:
documentclass{article}
usepackage{titlesec}% http://ctan.org/pkg/titlesec
titleformat{section}%
[hang]% <shape>
{normalfontbfseriesLarge}% <format>
{}% <label>
{0pt}% <sep>
{}% <before code>
renewcommand{thesection}{}% Remove section references...
renewcommand{thesubsection}{arabic{subsection}}%... from subsections
begin{document}
section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Second subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsubsection{First subsubsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{Last subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
subsection{First subsection}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sollicitudin rutrum tellus,
eu luctus dolor commodo eu. Integer pellentesque mollis congue.
end{document}
This just sets the label separator between the section number and title to 0pt
, as well as not printing the number. normalfontbfseriesLarge
is the default formatting for article
.
answered Dec 5 '11 at 19:47
![](https://i.stack.imgur.com/aNU1b.png?s=32&g=1)
![](https://i.stack.imgur.com/aNU1b.png?s=32&g=1)
WernerWerner
448k719921697
448k719921697
add a comment |
add a comment |
Note: I rewrote this answer significantly after becoming aware of Ulrike Fisher's comment to @knut's answer.
There are two steps that need to be taken. The first, straightforward step consists of redefining the thesubsection
macro. The second, less obvious step involves a redefinition of the LaTeX internal macro @seccntformat
, as is explained in the book The LaTeX Companion, 2nd ed. The following MWE applies both steps:
documentclass{article}
renewcommand{thesubsection}{arabic{subsection}}
makeatletter
def@seccntformat#1{@ifundefined{#1@cntformat}%
{csname the#1endcsnamequad}% default
{csname #1@cntformatendcsname}}% enable individual control
newcommandsection@cntformat{}
makeatother
begin{document}
section{First Section}
subsection{First subsection}
subsection{Second subsection}
subsubsection{First subsubsection}
subsection{Third subsection}
section{Second Section}
subsection{A new subsection}
end{document}
But without the redefinition ofthesection
you still get a numbered section. See also my answer.
– knut
Dec 5 '11 at 19:14
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of thesubsections
after the nextsection*
- but there is no information in the question, what's needed in this case.
– knut
Dec 5 '11 at 21:38
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to usesection
rather thansection*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of@seccntformat
and a new macro,section@cntformat
-- set here to{}
. Interestingly, it is not necesssary to setthesection
to something like{}
. Whew, this was a lot harder than it looked like at first!
– Mico
Dec 6 '11 at 0:24
1
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instructionnewcommandsubsection@cntformat{thesubsection.space}
, immediately beforemakeatother
.
– Mico
3 hours ago
|
show 2 more comments
Note: I rewrote this answer significantly after becoming aware of Ulrike Fisher's comment to @knut's answer.
There are two steps that need to be taken. The first, straightforward step consists of redefining the thesubsection
macro. The second, less obvious step involves a redefinition of the LaTeX internal macro @seccntformat
, as is explained in the book The LaTeX Companion, 2nd ed. The following MWE applies both steps:
documentclass{article}
renewcommand{thesubsection}{arabic{subsection}}
makeatletter
def@seccntformat#1{@ifundefined{#1@cntformat}%
{csname the#1endcsnamequad}% default
{csname #1@cntformatendcsname}}% enable individual control
newcommandsection@cntformat{}
makeatother
begin{document}
section{First Section}
subsection{First subsection}
subsection{Second subsection}
subsubsection{First subsubsection}
subsection{Third subsection}
section{Second Section}
subsection{A new subsection}
end{document}
But without the redefinition ofthesection
you still get a numbered section. See also my answer.
– knut
Dec 5 '11 at 19:14
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of thesubsections
after the nextsection*
- but there is no information in the question, what's needed in this case.
– knut
Dec 5 '11 at 21:38
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to usesection
rather thansection*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of@seccntformat
and a new macro,section@cntformat
-- set here to{}
. Interestingly, it is not necesssary to setthesection
to something like{}
. Whew, this was a lot harder than it looked like at first!
– Mico
Dec 6 '11 at 0:24
1
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instructionnewcommandsubsection@cntformat{thesubsection.space}
, immediately beforemakeatother
.
– Mico
3 hours ago
|
show 2 more comments
Note: I rewrote this answer significantly after becoming aware of Ulrike Fisher's comment to @knut's answer.
There are two steps that need to be taken. The first, straightforward step consists of redefining the thesubsection
macro. The second, less obvious step involves a redefinition of the LaTeX internal macro @seccntformat
, as is explained in the book The LaTeX Companion, 2nd ed. The following MWE applies both steps:
documentclass{article}
renewcommand{thesubsection}{arabic{subsection}}
makeatletter
def@seccntformat#1{@ifundefined{#1@cntformat}%
{csname the#1endcsnamequad}% default
{csname #1@cntformatendcsname}}% enable individual control
newcommandsection@cntformat{}
makeatother
begin{document}
section{First Section}
subsection{First subsection}
subsection{Second subsection}
subsubsection{First subsubsection}
subsection{Third subsection}
section{Second Section}
subsection{A new subsection}
end{document}
Note: I rewrote this answer significantly after becoming aware of Ulrike Fisher's comment to @knut's answer.
There are two steps that need to be taken. The first, straightforward step consists of redefining the thesubsection
macro. The second, less obvious step involves a redefinition of the LaTeX internal macro @seccntformat
, as is explained in the book The LaTeX Companion, 2nd ed. The following MWE applies both steps:
documentclass{article}
renewcommand{thesubsection}{arabic{subsection}}
makeatletter
def@seccntformat#1{@ifundefined{#1@cntformat}%
{csname the#1endcsnamequad}% default
{csname #1@cntformatendcsname}}% enable individual control
newcommandsection@cntformat{}
makeatother
begin{document}
section{First Section}
subsection{First subsection}
subsection{Second subsection}
subsubsection{First subsubsection}
subsection{Third subsection}
section{Second Section}
subsection{A new subsection}
end{document}
edited 6 mins ago
answered Dec 5 '11 at 15:09
![](https://i.stack.imgur.com/c7PDj.jpg?s=32&g=1)
![](https://i.stack.imgur.com/c7PDj.jpg?s=32&g=1)
MicoMico
284k31388776
284k31388776
But without the redefinition ofthesection
you still get a numbered section. See also my answer.
– knut
Dec 5 '11 at 19:14
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of thesubsections
after the nextsection*
- but there is no information in the question, what's needed in this case.
– knut
Dec 5 '11 at 21:38
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to usesection
rather thansection*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of@seccntformat
and a new macro,section@cntformat
-- set here to{}
. Interestingly, it is not necesssary to setthesection
to something like{}
. Whew, this was a lot harder than it looked like at first!
– Mico
Dec 6 '11 at 0:24
1
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instructionnewcommandsubsection@cntformat{thesubsection.space}
, immediately beforemakeatother
.
– Mico
3 hours ago
|
show 2 more comments
But without the redefinition ofthesection
you still get a numbered section. See also my answer.
– knut
Dec 5 '11 at 19:14
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of thesubsections
after the nextsection*
- but there is no information in the question, what's needed in this case.
– knut
Dec 5 '11 at 21:38
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to usesection
rather thansection*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of@seccntformat
and a new macro,section@cntformat
-- set here to{}
. Interestingly, it is not necesssary to setthesection
to something like{}
. Whew, this was a lot harder than it looked like at first!
– Mico
Dec 6 '11 at 0:24
1
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instructionnewcommandsubsection@cntformat{thesubsection.space}
, immediately beforemakeatother
.
– Mico
3 hours ago
But without the redefinition of
thesection
you still get a numbered section. See also my answer.– knut
Dec 5 '11 at 19:14
But without the redefinition of
thesection
you still get a numbered section. See also my answer.– knut
Dec 5 '11 at 19:14
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of the
subsections
after the next section*
- but there is no information in the question, what's needed in this case.– knut
Dec 5 '11 at 21:38
I understand. Then you have the same problem Ulrike mentioned: This will not restart the numbering of the
subsections
after the next section*
- but there is no information in the question, what's needed in this case.– knut
Dec 5 '11 at 21:38
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to use
section
rather than section*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of @seccntformat
and a new macro, section@cntformat
-- set here to {}
. Interestingly, it is not necesssary to set thesection
to something like {}
. Whew, this was a lot harder than it looked like at first!– Mico
Dec 6 '11 at 0:24
@knut: I just noticed the comment by Ulrike Fisher to your answer. She's right about having to use
section
rather than section*
, as otherwise subsection numbers won't get reset in a new section. As my (now thoroughly revised) answer that's based on some code from The LaTeX Companion shows, what's really needed to solve the OP's challenge is both a redefinition of @seccntformat
and a new macro, section@cntformat
-- set here to {}
. Interestingly, it is not necesssary to set thesection
to something like {}
. Whew, this was a lot harder than it looked like at first!– Mico
Dec 6 '11 at 0:24
1
1
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
That is great. However, how can I add the period after the subsection number and keep only one space after? I think "1. First subsection" would look better.
– Adam
6 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instruction
newcommandsubsection@cntformat{thesubsection.space}
, immediately before makeatother
.– Mico
3 hours ago
@Adam - The answer shown above provides a specific control only for the appearance (actually, non-appearance!) of section-level numbers, when used in section-level headers. To provide a specific control for subsection-level numbers of the type you've noted, I'd add the instruction
newcommandsubsection@cntformat{thesubsection.space}
, immediately before makeatother
.– Mico
3 hours ago
|
show 2 more comments
Does this works for you:
documentclass{article}
begin{document}
part*{Section}
section{subsection}
section{subsection}
subsection{subsubsection}
blah
section{subsection}
end{document}
Or is there a special reason, why you need sections as sections and subsections as subsection?
Alternative:
documentclass{article}
renewcommand{thesection}{}
renewcommand{thesubsection}{arabic{subsection}}
begin{document}
section{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
section{Section 2}
subsection{subsection 2}
This subsection starts again with 1.
end{document}
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
3
This will not restart the numbering of thesubsection
s after the nextsection*
.
– Ulrike Fischer
Dec 5 '11 at 15:21
You are right - but it works withsection
. I change my answer.
– knut
Dec 5 '11 at 19:16
add a comment |
Does this works for you:
documentclass{article}
begin{document}
part*{Section}
section{subsection}
section{subsection}
subsection{subsubsection}
blah
section{subsection}
end{document}
Or is there a special reason, why you need sections as sections and subsections as subsection?
Alternative:
documentclass{article}
renewcommand{thesection}{}
renewcommand{thesubsection}{arabic{subsection}}
begin{document}
section{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
section{Section 2}
subsection{subsection 2}
This subsection starts again with 1.
end{document}
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
3
This will not restart the numbering of thesubsection
s after the nextsection*
.
– Ulrike Fischer
Dec 5 '11 at 15:21
You are right - but it works withsection
. I change my answer.
– knut
Dec 5 '11 at 19:16
add a comment |
Does this works for you:
documentclass{article}
begin{document}
part*{Section}
section{subsection}
section{subsection}
subsection{subsubsection}
blah
section{subsection}
end{document}
Or is there a special reason, why you need sections as sections and subsections as subsection?
Alternative:
documentclass{article}
renewcommand{thesection}{}
renewcommand{thesubsection}{arabic{subsection}}
begin{document}
section{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
section{Section 2}
subsection{subsection 2}
This subsection starts again with 1.
end{document}
Does this works for you:
documentclass{article}
begin{document}
part*{Section}
section{subsection}
section{subsection}
subsection{subsubsection}
blah
section{subsection}
end{document}
Or is there a special reason, why you need sections as sections and subsections as subsection?
Alternative:
documentclass{article}
renewcommand{thesection}{}
renewcommand{thesubsection}{arabic{subsection}}
begin{document}
section{Section}
subsection{subsection}
subsection{subsection}
subsubsection{subsubsection}
blah
subsection{subsection}
section{Section 2}
subsection{subsection 2}
This subsection starts again with 1.
end{document}
edited Dec 5 '11 at 19:17
answered Dec 5 '11 at 14:49
knutknut
6,42112949
6,42112949
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
3
This will not restart the numbering of thesubsection
s after the nextsection*
.
– Ulrike Fischer
Dec 5 '11 at 15:21
You are right - but it works withsection
. I change my answer.
– knut
Dec 5 '11 at 19:16
add a comment |
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
3
This will not restart the numbering of thesubsection
s after the nextsection*
.
– Ulrike Fischer
Dec 5 '11 at 15:21
You are right - but it works withsection
. I change my answer.
– knut
Dec 5 '11 at 19:16
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
That does the job, but the size is rather large now. Can you tell me how to keep it the same size as the sections? Thanks :)
– Tony
Dec 5 '11 at 14:54
3
3
This will not restart the numbering of the
subsection
s after the next section*
.– Ulrike Fischer
Dec 5 '11 at 15:21
This will not restart the numbering of the
subsection
s after the next section*
.– Ulrike Fischer
Dec 5 '11 at 15:21
You are right - but it works with
section
. I change my answer.– knut
Dec 5 '11 at 19:16
You are right - but it works with
section
. I change my answer.– knut
Dec 5 '11 at 19:16
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%2f37189%2fnumber-subsections-and-subsubsections-but-not-sections%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
What should happen after a 2nd
section*
? Should the numbering start again at 1 or should it continue?– knut
Dec 5 '11 at 21:39