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
Hi all,
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?
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.

- pumpkinegan
- Posts: 91
- Joined: Thu May 03, 2007 10:29 pm
prefix section/subsection numbering with a letter
Renew the section counter (the subsection does not need to be changed):
\renewcommand{\thesection}{B\arabic{section}}
-
- Posts: 5
- Joined: Fri Jul 13, 2007 12:11 pm
Re: prefix section/subsection numbering with a letter
So easy? Thanks a lot!
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?
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
Actually, I found a solution in case someone else is also interested:
\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.
\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
This is also not very difficult it turns out:
\usepackage{lastpage}
\cfoot[\thepage]{Part B \hfill Page \thepage \hspace{0.05cm} of \pageref{LastPage}}
Isn't that great?
\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
Re: prefix section/subsection numbering with a letter
Thanks a lot, this indeed works nicely!