2

I'm using \paragraph as a way to have some \subsubsubsection. They should appear as:

A) something
B) some other thing

Instead, each time I use \paragraph I only get an A). Can someone help me understand what I'm doing wrong, please?

Here is my code:

\newcounter{somecounter}
\setcounter{somecounter}{1}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
  {-3.25ex\@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus .2ex}%
  {\normalfont\normalsize\itshape\Alph{somecounter})}}
\makeatother
New contributor
Marta Botella Campos is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
4
  • Always show a small but complete example that demonstrates your problem. That makes it much easier to test the issue. Commented 20 hours ago
  • 1
    \paragraph already has an associated counter @Marijn there is no need to allocate a new counter or use \refstepcounter Commented 19 hours ago
  • As it turns out, if I don't add the counter, \Alph does not show any lettering... Commented 7 hours ago
  • just define \theparagraph to use \Alph as you would for any other sectioning command such as \section or \chapter see the posted answer. Commented 6 hours ago

1 Answer 1

5

Why are you using somecounter here? Your code does exactly what you ask it to, printing the value of somecounter as a letter. Presumably, you wanted to instead write \theparagraph where you currently have \Alph{somecounter} and redefine \theparagraph using

\RenewExpandableDocumentCommand{\theparagraph}{}{\Alph{paragraph}}

You’ll likely also need to change the value of secnumdepth

\setcounter{secnumdepth}{4}

since by default, section numbering stops at \subsubsection.

Note that the \@startsection command does a number of things behind the scenes for you, including calling \refstepcounter{paragraph} which not only advances the counter value, but also sets the appropriate values behind the scenes so that \label and \ref will work as intended.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.