# How to make additional paragraph commands that use sectioning counters?

I would like to be able to use the following additional (new) commands: \sparagraph, \ssparagraph, \sssparagraph. All of these will use the \paragraph formatting but, will use different counters. The \sparagraph will use the section label and counter. The \ssparagraph will use the sub section label and counter. The \sssparagraph will use the sub sub section label and counter.

If the chapter is 1 and the section is 1. The label for the section will be 1.1. If I followed this section with a \sparagraph, I would want the paragraph to start with 1.2. Formatting as the \paragraph, but using the section numbering, including incrementing that counter.

-
What is the difference between \sparagraph and \subsection? Do you just want to rename them? – Yiannis Lazarides May 2 '12 at 5:26
– Peter Grill May 2 '12 at 6:03

Here is one possible solution, using the standard sectional definitions via \@startsection:

\documentclass{book}
\makeatletter
\newcommand\sparagraph{\@startsection{section}{1}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
\newcommand\ssparagraph{\@startsection{subsection}{2}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
\newcommand\sssparagraph{\@startsection{subsubsection}{3}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
\setcounter{secnumdepth}{3}% Allow numbering up to \subsubsection or \sssparagraph
\makeatother
\begin{document}
\chapter{A chapter}
\section{A section}

\sparagraph{An sparagraph}
\ssparagraph{An ssparagraph}
\ssparagraph{Another ssparagraph}
\sssparagraph{An sssparagraph}

\sparagraph{Another sparagraph}
\ssparagraph{A ssparagraph}
\sssparagraph{An sssparagraph}
\sssparagraph{An sssparagraph}
\end{document}


\sparagraph and friends are setup using the section|subsection|subsubsection counter, and is also set at that level (1, 2 or 3, respectively).

-

ConTeXt provides a \definehead command to define new section heads.

\definehead
[paragraph] % ConTeXt doesn't define \paragraph.
[subsubsubsection] % It uses \subsubsubsection instead.

[sparagraph]
[section]

[ssparagraph]
[subsection]

[sssparagraph]
[subsubsection]

[sparagraph,ssparagraph,sssparagraph,paragraph]
[alternative=text,
style=bold]


All \define<something> commands in ConTeXt follow the same syntax:

\define<....>
[<name>]
[<parent>]
[<options>]


I define \sparagraph etc to inherit all their settings from the corresponding section command, and then overwrite the style and alternative settings so that they match that of paragraph.

-
Probably LaTeX should have used \subsubsubsection too, as \paragraph causes all sorts of confusion :-) – Joseph Wright May 2 '12 at 6:49
At subsubsubsubsection (the default section depth in ConTeXt), the subsub alternative also starts to get confusing! ConTeXt also defines \startsectionlevel ... \stopsectionlevel set of macros, that can be nested to increment the section depth. – Aditya May 2 '12 at 7:02