1

I am currently using the command

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

To have my document sections and subsections appear as:

1
1.a
1.b
2 ...

However, for my document's fourth section, I would like (combining subsections a b, and c):

4
4.a b c
4.d

How do I do this while keeping the other section labels unchanged? Thanks for the help!

6
  • Is there a particular reason you want the subsections combined? Why not just call it 4.a, and then move on to 4.b?
    – Teepeemm
    May 14, 2021 at 19:20
  • @Teepeemm Yes, this document is my solutions to a problem set in which parts 4a and 4b are coding problems and 4c is an analysis of those coding problems. I want my write-up to match the Professors problem set section labeling, but I don't want to leave 4a and 4b blank since it would look nicer and read easier as "4 a b c".
    – Okeith
    May 14, 2021 at 19:26
  • Just use \subsection{\! b c}\addcounter{subsection}{2}.
    – Oni
    May 14, 2021 at 19:39
  • @Oni That does not work. The following section is still labeled "4.b" and the first section is now titled "4.a (large space) b c" since the argument entered in the subsection's braces is interpreted as the subsection's title.
    – Okeith
    May 14, 2021 at 19:59
  • \begingroup \renewcommand{\thesubsection}{\thesection.abc} \subsection{Subsection} \endgroup \addtocounter{subsection}{2}
    – Ivan
    May 14, 2021 at 20:01

2 Answers 2

1

Like @Ivan commented:

\begingroup
\renewcommand{\thesubsection}{\thesection.a b c}
\subsection{Subsection}
\endgroup 
\addtocounter{subsection}{2}

Will add the b and c to the subsection and next subsection is 4.d.

0

To get something beyond what you want-- keeping in mind that such multiple-subsections may need to be clubbed later on-- let's take a more general macro for collating together as many subsections as one may choose... using the \foreach loop defined in the pgffor package, and nicely elucidated in this post.

\documentclass{scrartcl}
\usepackage{pgffor, amsmath}

\renewcommand{\thesubsection}{\thesection.\alph{subsection}}
\newcommand{\multisubsection}[2]{
                \subsection*{%
                   \thesection.%
                     \foreach \c in {1, ..., #1}%
                        {\addtocounter{subsection}{1}%
                         \alph{subsection}\,}\!. 
                             #2}}
\begin{document}

\section{The first section}
We have some questions answered in the following subsections.

\multisubsection{3}{A long answer, this should be}
When answering this question, we must consider the fact that
a complicated question expects a long and complicated, but clear answer.

\subsection{Answer to the second problem}
An easy answer, let's say.

\multisubsection{2}{Another, not-so-difficult problem}
Should have a moderately long answer, but as much to-the-point as possible.

\subsection{The next answer}
This should be evident from the above.

\end{document}

This should produce an output looking like this-- Multiple-subsections

You must log in to answer this question.

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