1

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.

3

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

enter image description here

\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).

1

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

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

\definehead
  [sparagraph]
  [section]

\definehead
  [ssparagraph]
  [subsection]

\definehead
  [sssparagraph]
  [subsubsection]

\setuphead
  [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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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