I need to find a command/environment that allows me to nest a [sub]section one level deeper than the level of the parent [sub]section.

For example, given this syntax,


I'd like to obtain this output:

1. ...... Foo
1.1 ..... Bar
1.2 ..... Zoo
1.2.1 ... Bar

Is there anything like that available ?

Regards, R

  • Welcome to StackOverflow! (La)TeX-related questions are better asked at TeX - LaTeX. Your question has been flagged so that it gets migrated there. – Alexis Pigeon Aug 21 '14 at 9:48
  • Interesting, but to be useful you need a command to enter a nested level and another one to leave the nested level. – alfC Aug 21 '14 at 19:08
  • You may use the answer here tex.stackexchange.com/a/31010/17424 and play with the index of the \level command (+1 when nested). Or am I off-topic ? – user17424 Dec 19 '14 at 22:02
  • @alfc I understand your intent, but a \section et al. are not environments, but merely macros. Thus, there is no need to "leave" anything, but merely to issue the macro one level down from the current level. – Steven B. Segletes Dec 19 '14 at 22:15

I came up with this:


\ifnum \thesubsection >0
    \ifnum \thesection >0

The various section commands in LaTeX are designed to do just what you ask for.






enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.