My document has several minipage
-environments that need an inner sectioning with numeration independent of the "normal" sectioning of the document. Until now I have used a work-around and simply hard-coded the headers as paragraphs and applied the numbering and formatting by hand, e.g.
\begin{minipage}
\begin{center}Title\end{center}
\textbf{1 First section}
Some Text
\textit{1.1 First subsection}
Some more Text
\textit{1.2 Second subsection}
\begin{enumerate}
\item Foo
\item Bar
\end{enumerate}
\textbf{2 Second section}
Even more Text
\end{minipage}
However, this caused some blemishes like too narrow vertical spacing between headers and normal paragraphs in comparison to the vertical space between a "header" followed immediately by a list-environment. Moreover, I would like to have no indention of the first paragraph after a section. To make it short: I would like to have all this nice spacing correction "magic" that is applied by proper sectioning commands.
I would like to define three special minipage (mp) sectioning macros:
\mptitle
: First command in minipage to print a centered title\mpsection
: 1st-level sectioning\mpsubsection
: 2nd-level sectioning
with the following properties
- Numbering restarts for each minipage (i.e. similar to footnotes inside minipages)
- Entry in TOC not required and not wanted
- Proper vertical spacing before and after with all these nice spacing corrections, if two sectioning commands immediately follows each other, no indention of following paragraph, corrections for lists, etc.
- Working cross-reference (i.e. using
\label
) is nice to have, but not yet required
I had a look into source2e.pdf, chap. 61 and tried to figure out what \@startsection
, \@sect
and friends do and if I possible could re-use them, but I failed. Firstly, I was lost to really understand how these commands work. Secondly, I got the impression that the LEVEL parameter will always interfere with the normal sectioning (I read that is must be unique) and it seems that \@startsection
, \@sect
always manipulate the TOC.
I would really glad if somebody could help me to define \mptitle
, \mpsection
and \mpsubsection
analogous to what the normal sectioning commands do but omit all the unnecessary code that is required for TOC.
\@startsection
doesn't touch the TOC if called with a star following (since this is what\section*
and friends do). When\@ifstar
is tested at the end of\@startsection
's definition, if the result is true,\@ssect{#3}{#4}{#5}{#6}
is left in the input stream, which should not alter the TOC (note that it's\@ssect
in this case, not\@sect
as used for numbered sections). To suppress indentation after a heading made with\@startsection
, pass it a negative#4
(beforeskip).