Page LayoutRelabeling Sections and Subsections

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
isharp2
Posts: 23
Joined: Fri Feb 11, 2011 2:06 am

Relabeling Sections and Subsections

Post by isharp2 »

Hi,
I need to do 3 things:
1) rewrite my sections so they are in roman numerals
2) rewrite my subsections so they are A through Z, and do not contain the section preface or '.'
3) rewrite my subsubsections so they are 1 through 9, and do not contain their section or subsection as a preface or a '.'.

I have not quite accomplished this using the following renew commands:

Code: Select all

\newcommand{\mysection}[2][]
  {\section[#1]
    {\centering #2}
      \setcounter{figure}{0}
      \renewcommand{\thefigure}{\thesection.\arabic{figure}} %Arabic figures
      \renewcommand{\thesection}{\Roman{section}}               %Roman numeral title
}

%Subsections do not get centered
\newcommand{\mysubsection}[2][]
{\subsection[#1]{#2}
  \setcounter{figure}{0}
  \renewcommand{\thefigure}{\thesubsection.\arabic{figure}}
  \renewcommand{\thesubsection}{\Alph{subsection}.} %Make sure the subsection label counter is capital A through Z followed

}

%subsub section should not include the 'ALPHA' subsection before it
\newcommand{\mysubsubsection}[2][]
{\subsubsection[#1]{#2}
  \setcounter{figure}{0}\renewcommand{\thefigure}
  {\thesubsubsection.\arabic{figure}} %Set figures to Arabic numbers 1 - 9
  \renewcommand{\thesubsubsection}{\arabic{subsubsection}} %Make sure the subsection label counter is 1 through 9 with no '.', 'arabic' 

}
However, the first line in my first section in my table of contents receives a '1' instead of a roman numeral (All other sections are correctly labeled with roman numerals).
My first subsection contains numbers instead of A through Z (all other sections are fine)
My first subsubsection contains the preface 'A through Z' and a '.'. All following subsubsections are labeled correctly though.

Does anyone have any idea what is happening.
This error does not only occur in the table of contents, but also when you go to the actual page you will see these mistakes. I have no idea why the first instances of these renewcommands in my program seem to not work. Please 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

isharp2
Posts: 23
Joined: Fri Feb 11, 2011 2:06 am

Relabeling Sections and Subsections

Post by isharp2 »

I dont know why, but once i posted:

Code: Select all

\renewcommand{\thesection}{\Roman{section}}               %Roman numeral title
\renewcommand{\thesubsection}{\Alph{subsection}.} %Make sure the subsection label counter is capital A through Z followed
\renewcommand{\thesubsubsection}{\arabic{subsubsection}} %Make sure the subsection label counter is 1 through 9 with no '.', 'arabic'
again just above my

Code: Select all

\newcommand ....
code, and now all sections, subsections, and subsubsections look as they are supposed to.
I hope this helps someone who is having the same issue.
Post Reply