5

I use scrartcl. I would like the sections to be numbered 1A, 1B, 2A, 2B, etc. I would like subsections etc. to be numbered 1A.1, 1A.2, etc. the idea is to present theory in the "A" sections and examples in the "B" sections.

Please ask if more clarity is needed.

Mico
  • 506,678
  • 1
    Are all sections divided into two parts? – egreg Jul 12 '12 at 23:21
  • @egreg: yes, all sections are divided into "A" and "B" parts. Your solution, posted below, seems to do the trick. – underwhelmer Jul 13 '12 at 12:45
  • One might think to redefine directly \section so that it produces alternately \sectionA and \sectionB, but I believe that having a specific mark up is better. – egreg Jul 13 '12 at 12:48

2 Answers2

7

You can define appropriate commands for introducing the two types of sections:

\documentclass{scrartcl}
\newcommand{\sectionA}{\renewcommand{\thesection}{\arabic{section}A}\section}
\newcommand{\sectionB}{\edef\thesection{\arabic{section}B}\addtocounter{section}{-1}\section}

% This part is necessary when hyperref is needed
\usepackage{hyperref}

\newcounter{Hsection}
\renewcommand{\theHsection}{\thesection}
\newcounter{Hsubsection}
\renewcommand{\theHsubsection}{\thesection.\arabic{subsection}}
% end of hyperref part

\begin{document}
\tableofcontents

\sectionA{First, theory}
\subsection{One}
\subsection{Two}

\sectionB{First, examples}
\subsection{One}
\subsection{Two}

\sectionA{Second, theory}
\subsection{One}
\subsection{Two}

\sectionB{Second, examples}
\subsection{One}
\subsection{Two}

\end{document}

As you see, one has to do some adjustments when hyperref is loaded. Add all the desired options to it, of course.

egreg
  • 1,121,712
4

If you're just considered sectional headings, then you can use \sections, \subsections and \subsubsections with the following counter redefinitions way:

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection\Alph{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}

The above changes the numbering scheme representation for sections to \arabic (actually, the default), subsections to \Alph (for theory and examples) and subsubsections to \arabic (also, the default). It also makes sure that the display conforms to your requirements in terms of concatenation.

Werner
  • 603,163