I am (still) trying replicate the layout of this document.
Sections and paragraphs are all numbered, in the margin (the chapter titles do not treat this as a margin, but I can ignore that). They are left-aligned.
So far, Google and playing have uncovered these:
1) parano.sty
This allows me to auto-number paragraphs, which is nice. It has no flexibility for depth (i.e. sub-paragraphs) and I haven't tested moving its numbers.
2) \paragraph{}
This is the closest solution so far. Using \setcounter{secnumdepth}{5}
I can add numbers to my paragraphs. This code then puts all of the numbers in the margin:
\makeatletter
\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}}
\makeatother
I can make these left-aligned by increasing [0pt]
and changing r
to l
, but I haven't been able to get the hanging indent right (or to move the box into the left margin)
Further, \paragraphs without a title leave some space (presumably to separate text from the title?), further stopping the neat alignment I am aiming for.
This solution (with the same limitations) also allows me to use sub-paragraphs, which I will eventually need.
Best Answer
After giving a look at the linked document, I could detect six sectional units: chapters, sections, numbered subsections with title, numbered subsections without title, numbered subsubsections with title, and numbered subsubsections without title. So the problem is how to define these six sectional units.
The code below shows a possible solution using the titlesec package; the underlaying idea is to use
\llap
and\parbox
es to typeset the numbers hanging onto the margin. The length\titleindent
allows you to easily control the hanging indent.\paragraph
has been changed so that it will allow numbered subsections without title and\subparagraph
was also redefined to allow numbered subsubsections.The following table shows the "dictionary" between each secional unit of the document and the LaTeX command that will be used to typeset it:
Chapters ->
\chapter
Sections ->
\section
Numbered subsections with title ->
\subsection
Numbered subsections without title ->
\paragraph
Numbered subsubsections with title ->
\subsubsection
Numbered subsubsections without title ->
\subparagraph
And here's the code (feel free to make the necessary adjustments to satisfy your requirements):
The previous approach assumes that you won't use
\paragraph
and\subparagraph
with their standard formatting; another (perhaps more sensible) option is to define two fresh new sectional units; this, of course, requires a little additional work, but now you will have the standard sectional units plus the two new ones.The following code illustrates this approach defining
\subsectionwt
(for numbered subsections without titles) and\subsubsectionwt
(for numbered subsubsections without titles); it also makes the necessary provisions for the ToC.The new "dictionary" is now:
Chapters ->
\chapter
Sections ->
\section
Numbered subsections with title ->
\subsection
Numbered subsections without title ->
\subsectionwt
Numbered subsubsections with title ->
\subsubsection
Numbered subsubsections without title ->
\subsubsectionwt
Paragraphs ->
\paragraph
Subparagraphs ->
\subparagraph
The example code: