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

share|improve this question
2  
What is the difference between \sparagraph and \subsection? Do you just want to rename them? –  Yiannis Lazarides May 2 '12 at 5:26
    
Welcome to TeX.SE. –  Peter Grill May 2 '12 at 6:03
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
    
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
add comment

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.