1

I have to format section and subsection numbers as follows:

(I use article class.)

I. Section
A. Subsection
B. Subsection

II. Section
A. Subsection
B. Subsection

I use the package sectsty. At the moment, the code reads like this:

\usepackage{sectsty}
\sectionfont{\normalfont\centering\scshape}
\subsectionfont{\normalfont\itshape}
\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\thesection.\Alph{subsection}}

But if I do that, I get:

I Section
I.A Subsection

etc.

How do I get rid of the Roman numeral in the subsection number, and how do I add the trailing dots?

3
  • Well, delete \thesection from the re-definition of \thesubsection.
    – Bernard
    Commented May 13, 2020 at 16:21
  • Thank you! Cecile
    – Cecile
    Commented May 13, 2020 at 16:59
  • As for your other question, please consider accepting the provided answer. This way the process is "closed". Commented Mar 21, 2021 at 23:18

1 Answer 1

3

You asked,

How do I get rid of the roman numeral in the subsection?

You're very close. Just change

\renewcommand\thesubsection{\thesection.\Alph{subsection}}

to

\renewcommand\thesubsection{\Alph{subsection}}

i.e., omit the \thesection. prefix which expands to \Roman{section}..

Aside: Observe that the numbering issue is not related to the use or non-use of the sectsty package.


Addendum: To affix "dots" (aka periods, full stops) to I, A, etc, I suggest you add the following code to the preamble:

% Method proposed in "The LaTeX Companion", 2nd ed.:
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\space}%    default
   {\csname #1@cntformat\endcsname}}%  enable individual control
\newcommand\section@cntformat{\thesection.\space}       % section level
\newcommand\subsection@cntformat{\thesubsection.\space} % subsection level
\makeatother

This somewhat complicated-looking approach preserves the ability to create cross-references to sections and subsections without pesky dots suddenly showing up in the cross-reference. (That's exactly what would happen if one set, naively, \renewcommand\thesection{\Roman{section}.} instead of just the current \renewcommand\thesection{\Roman{section}}.)


Here's the output of an MWE (minimum working example):

enter image description here

\documentclass{article}
\usepackage{sectsty}
\sectionfont{\normalfont\centering\scshape}
\subsectionfont{\normalfont\itshape}

\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\Alph{subsection}}

% Method proposed in "The LaTeX Companion", 2nd ed.:
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\space}%    default
   {\csname #1@cntformat\endcsname}}%  individual control
\newcommand\section@cntformat{\thesection.\space}       % section level
\newcommand\subsection@cntformat{\thesubsection.\space} % subsection level
\makeatother

\begin{document}
\section{Section}
\subsection{First Subsection}
\subsection{Second Subsection}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .