You are not logged in.
I have a quesion about LaTeX.
I want to disable the numbering of sections, but not of subsections. By default, it's like this:
1. First section
1.1. Subsection to the first section
1.2. Another subsection
2. Another section
2.1. And so on...
I want it like this:
First section
1. Subsection to the first section
2. Another subsection
Another section
1. And so on...
I know I can specify the depth of the numbering with \secnumdepth, but this way I could only do the opposite of what I want, i.e. disable numbering of subsections and keep the numbering of section. With \section*{First section}, I could selectively disable numbering and manually add the section to the TOC, then I have my unnumbered sections, but the subsections are still numbered "0.1. Subsection..." instead of "1. Subsection".
Any ideas?
-----------------------------------------------------------------------------
[edit] SOLUTION:
\renewcommand{\thesection}{\hspace*{-1.0em}}
\renewcommand{\thesubsection}{\arabic{subsection}}
Last edited by cryptkeeper (2012-01-18 06:18:49)
Offline
My commands are kind of kludgy (they make the indenting a little weird), but I think they should work
First, we redefine the command used for numbering sections to "hspace*{-18pt} (ie: just display the title 18pts left of where it should be). This may need to be adjusted depending on font size/ etc.
Next, we redefine the command used for numbering subsections to display the subsection number as an arabic numeral.
\renewcommand{\thesection}{\hspace*{-18pt}}
\renewcommand{thesubsection}{\indent\arabic{subsection}}
Just for reference, I believe the default behaviour is
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}
EDIT:
These commands should be placed in the preamble, although I think they work in document.
Also,
\renewcommand{\thesection}{\hspace*{-1.0em}}
\renewcommand{thesubsection}{\indent\arabic{subsection}}
may work better, depending on the font/ fontsize you use. (1.0em is roughly the width of an 'M' in the current font.)
Last edited by leocp1 (2012-01-16 17:55:30)
Offline
\section*{bla}
\addtocounter{section}{1}
That should work.
Offline
\section*{bla} \addtocounter{section}{1}
That should work.
I don't think so. In this way you only get 1.1 instead of 0.1
Mortuus in anima, curam gero cutis
Offline
draugdel wrote:\section*{bla} \addtocounter{section}{1}
That should work.
I don't think so. In this way you only get 1.1 instead of 0.1
Doh, didn´t read that right.
Offline
\renewcommand{\thesection}{\hspace*{-18pt}} \renewcommand{\thesubsection}{\indent\arabic{subsection}}
\renewcommand{\thesection}{\hspace*{-1.0em}} \renewcommand{\thesubsection}{\indent\arabic{subsection}}
Both commands principally work. There are two issues though. First: You forgot the \ before thesubsection in both commands (I corrected it in the quote).
Second (and that's the real issue): There's too little space between the numbers of the subsections and the subsection title in the TOC. For subsections 1-9, it just works, but from 10 on the second number overlaps with the first character of the title.
Apart from that, it's exactly what I was looking for!
Last edited by cryptkeeper (2012-01-17 08:48:58)
Offline
Doh. I made a pretty bad mistakes
You've probably figured this out by now, but removing the \indent will solve your problems:
\renewcommand{\thesection}{\hspace*{-1.0em}}
\renewcommand{\thesubsection}{\arabic{subsection}}
is what I was supposed to have written.
I honestly have no idea why I made so many typos.
Offline
You've probably figured this out by now, but removing the \indent will solve your problems:
Actually I haven't because I've just started using LaTeX last week, I'm just getting used to the basics.
\renewcommand{\thesection}{\hspace*{-1.0em}} \renewcommand{\thesubsection}{\arabic{subsection}}
is what I was supposed to have written.
Perfect solution! Thanks a lot for your help.
Offline