General ⇒ prefix section/subsection numbering with a letter
-
- Posts: 5
- Joined: Fri Jul 13, 2007 12:11 pm
prefix section/subsection numbering with a letter
I am required to have a special numbering of sections and subsections in my document. There needs to be a letter B in front of every section/subsection number, but otherwise the numbering scheme should be the usual one. So it should go like this: B1, B1.1, B1.2, B1.3, B2, B2.1, B2.2, etc, etc, and the letter B should appear also on the table of contents.
How would I go about this?
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
- pumpkinegan
- Posts: 91
- Joined: Thu May 03, 2007 10:29 pm
prefix section/subsection numbering with a letter
\renewcommand{\thesection}{B\arabic{section}}
-
- Posts: 5
- Joined: Fri Jul 13, 2007 12:11 pm
Re: prefix section/subsection numbering with a letter
It works great, but this solution gave me another problem, please bear with me. At the bottom of every page I need to have the text "Part B 5 of 20" for instance if the page number is 5 and the total number of pages is 20. I achieved this by
\renewcommand{\thepage}{Part B \hspace{11cm} Page \arabic{page} of 20}
After using your solution for the section number prefixing the "Part B 5 of 20" stuff appears in the table of contents for each section, which is not what I need. So the table of contents should use normal page numbering but the bottom of each page should have this "Part B 5 of 20" stuff.
Any ideas?
-
- Posts: 5
- Joined: Fri Jul 13, 2007 12:11 pm
Re: prefix section/subsection numbering with a letter
\pagestyle{fancy}
\cfoot[\thepage]{Part B \hfill Page \thepage \hspace{0.05cm} of 20}
The only thing missing is that the total number of pages is hardwired to 20, I guess it's possible to have that filled in automatically. If not that's also okay, I can just add it when the document is ready and I know the total number.
-
- Posts: 5
- Joined: Fri Jul 13, 2007 12:11 pm
Re: prefix section/subsection numbering with a letter
\usepackage{lastpage}
\cfoot[\thepage]{Part B \hfill Page \thepage \hspace{0.05cm} of \pageref{LastPage}}
Isn't that great?

- pumpkinegan
- Posts: 91
- Joined: Thu May 03, 2007 10:29 pm
prefix section/subsection numbering with a letter
The \hspace is probably not the best thing use do after \thepage (a LaTeX command that eats up the spaces after it). To keep a space after \thepage (and other LaTeX commands) use:fetchinson wrote: \cfoot[\thepage]{Part B \hfill Page \thepage \hspace{0.05cm} of \pageref{LastPage}}
Code: Select all
\cfoot[\thepage]{Part B \hfill Page \thepage\ of \pageref{LastPage}}
-
- Posts: 5
- Joined: Fri Jul 13, 2007 12:11 pm