Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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. –  Shay 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 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
Thanks, this is a very compact and useful solution. –  Shay Jul 13 '12 at 12:46

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.