Page LayoutEnabling automatic Numbering for Paragraphs

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Enabling automatic Numbering for Paragraphs

Post by AleCes »

Hello everybody

I'd like to know how to turn on automatic numbering of paragraphs and sub-paragraphs. I wish the numbering of paragraph to be composed of section number.paragraph number, and just letters for sub-paragraphs.

Example:
\section{} Actual output: 1
\paragraph{} Desired output: 1.1
\subparagraph{} Desired output: a

Thanks for your help

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enabling automatic Numbering for Paragraphs

Post by localghost »

It could be helpful to know the used document class. Please note that the next heading level below \section is \subsection and not \paragraph.

Assumed that the used class is »article«, just increment the counter for the headings numbering depth.

Code: Select all

\setcounter{secnumdepth}{4}
This will number all headings levels down to \paragraph, but not \subparagraph. For the desired numbering you will have to redefine the counter output. A Forum Search should yield usable solutions since this has been discussed here very often.


Thorsten
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Enabling automatic Numbering for Paragraphs

Post by AleCes »

A Forum Search should yield usable solutions since this has been discussed here very often.
Yeah, I did so, but \setcounter{secnumdepth}{4} doesn't work. That's why I opened this thread. :oops:

My document class is book and with \setcounter{secnumdepth}{4} I got numbering like these for paragraphs:

1.0.0.11
1.0.0.12
1.0.0.13

While what I wish for is

1.1
1.2
1.3
It could be helpful to know the used document class. Please note that the next heading level below \section is \subsection and not \paragraph.
All right, I know that, it's just that I don't use subsections because the headings are placed above the text, just like in sections.

Thanks for your help
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enabling automatic Numbering for Paragraphs

Post by localghost »

AleCes wrote:[…] All right, I know that, it's just that I don't use subsections because the headings are placed above the text, just like in sections. […]
These headings can be customized by the titlesec package.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Re: Enabling automatic Numbering for Paragraphs

Post by AleCes »

Thanks. I read the manual through but I couldn't find the function I'm seeking, or maybe I just didn't spot the one I'm in need of. Could you please show me in which page/chapter I'll find the pieces of informations I'm looking for? Thank you very much.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enabling automatic Numbering for Paragraphs

Post by localghost »

AleCes wrote:[…] Could you please show me in which page/chapter I'll find the pieces of informations I'm looking for? […]
Section 3 in general and Section 3.1 in particular should help you on in this regard. You may also be interested in Section 9 with its examples.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Enabling automatic Numbering for Paragraphs

Post by AleCes »

This is what I've been able to put together

Code: Select all

\titleformat{\paragraph}
Then I suppose format is the option I need here, right? But I couldn't find any info in the 3.1 section concerning title numbering. Nor do the example seem to provide any relevant example. :mrgreen:
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enabling automatic Numbering for Paragraphs

Post by localghost »

I think you need to redefine the \subsection headings since this is the one you don't like. On page 24 of the titlesec manual you will find some examples for \section headings which you should be able to adapt to \subsection headings.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Re: Enabling automatic Numbering for Paragraphs

Post by AleCes »

So you want me to tamper with \subsection and \subsubsection instead of \paragraph and \subparagraph? But I'm contented with the overall format of paragraphs and subparagraphs, I just want to change the title. On the other hand, I'll have to make a much more substantial change in order to transform a subsection into a paragraph. (Numbering is OK, but all of the rest is not).

Are you sure it is worth the pain? And pag. 24 shows (9.3 Chapter example) appears to be dealing with fancy, colored headings, is that really what I need?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enabling automatic Numbering for Paragraphs

Post by localghost »

AleCes wrote:So you want me to tamper with \subsection and \subsubsection instead of \paragraph and \subparagraph? But I'm contented with the overall format of paragraphs and subparagraphs, I just want to change the title. On the other hand, I'll have to make a much more substantial change in order to transform a subsection into a paragraph. (Numbering is OK, but all of the rest is not). […]
My apologies for trying to show how it could be done consistently with consecutive heading levels. Won't happen again.

So I suggest that you simply redefine the concerned counters. As an example I give the redefinition for the depiction of the »subparagraph« counter.

Code: Select all

\renewcommand*{\thesubparagraph}{\alph{subparagraph}}
The other redefinitions happen similar.
AleCes wrote:[…] Are you sure it is worth the pain? And pag. 24 shows (9.3 Chapter example) appears to be dealing with fancy, colored headings, is that really what I need?
My fault. In the current version of the manual it's on page 21. And I surely didn't want to cause you pain with my suggestions. Redefining the counters will presumably less painful for you.
Post Reply