% \iffalse %% %% File: nccsect.dtx Copyright (C) 2002--2005 by Alexander I. Rozhenko %% %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{nccsect} % [2005/06/15 v1.3 Extended Section, Caption, and TOC Handling (NCC)] % % \changes{v1.00}{2002/02/01}{This version is uploaded to CTAN} % \changes{v1.01}{2002/02/08}{\NCC@thetocchapter hook added} % \changes{v1.02}{2002/02/13}{Bug in using the \nosectiontag fixed} % \changes{v1.02}{2002/03/19}{Test for caption with empty text added} % \changes{v1.03}{2002/05/19}{Vskips in captions after style changes now} % \changes{v1.04}{2002/05/22}{Centering in captions now works} % \changes{v1.1}{2004/12/12}{Introduce |\NCC@sec@reset@controls|} % \changes{v1.1}{2004/12/12}{Simplify making sections. The |\NCC@makesection| now % incompatible with previous version!!!} % \changes{v1.1}{2004/12/12}{Revised version: many internal changes} % \changes{v1.1}{2004/12/12}{Documentation was prepared} % \changes{v1.2}{2005/04/15}{Emulate |\@makecaption| for compatibility} % \changes{v1.2}{2005/04/15}{Compatibility with the supertabular package added} % \changes{v1.2}{2005/04/15}{Compatibility with the longtable package added} % \changes{v1.2}{2005/05/20}{Introduce |\beforechapter| hook} % \changes{v1.2}{2005/05/20}{Add |\StartHromTextArea| and |\StartFromHeaderArea|} % \changes{v1.2}{2005/05/21}{Add |\epigraph| and |\epigraphparameters|} % \changes{v1.2}{2005/05/22}{Add |\captionstyle| and related staff} % \changes{v1.2}{2005/05/22}{Add |\TOCMarginDrift|} % \changes{v1.2}{2005/05/22}{Add |\applystyle| command to TOC Entry style} % \changes{v1.2}{2005/06/08}{Set |\@twocolumnfalse| in before-chapter hook} % \changes{v1.2}{2005/06/08}{Allow sectioning in |\beforechapter| hook} % \changes{v1.3}{2005/06/15}{Fixed bug with using |\applystyle| command} % %<*driver> \documentclass{ltxdoc} \usepackage{nccsect,nccboxes,desclist} \GetFileInfo{nccsect.sty} \begin{document} \title{The \textsf{nccsect} package\thanks{This file has version number \fileversion, last revised \filedate.}} \author{Alexander I. Rozhenko\\rozhenko@oapmg.sscc.ru} \date{\filedate} \maketitle \DocInput{nccsect.dtx} \end{document} % % \fi % % \section{The Scope and Objectives} % % The package changes the implementation of sections, captions, % and toc-entries in the \LaTeX\ kernel. The reasons for the changes % are concerned with the following disadvantages of the % standard \LaTeX\ implementation: % % \paragraph{1} Standard \LaTeX\ sectioning commands can prepare % display sections in the single style: justified paragraph % with hand indented number. To change this style to another % one (centered, par-indented, or else), you need % to re-implement the internal |\@sect| command. It is no % control for this style on user's level. % % \paragraph{2} If you want to customize the presentation a number in % a section (for example, put a paragraph mark \S\ before a number % or put a point after a number), you at least need to % re-implement the |\@sect| command. % % \paragraph{3} The sectioning commands provide no straightforward % control for running headings. The marking commands % like the |\sectionmark| solve this problem partially. % Using them within parameter of sectioning command, % you can change the mark properly, but this solution does not work in % complicated documents which use first and last marks % appearing on a page. The safe solution consists in direct % replacement a mark prepared within the |\@sect| command % to a custom mark. % % \paragraph{4} Special efforts are required to pass a section % without number to the header and to the toc-list. There is no simple % solution providing this action. % % \paragraph{5} Captions for tables and figures are prepared in % just the same way, although, they are usually used in different % places of floating environments: table captions start % \textit{before\/} a table, but figure captions go \textit{after\/} % a figure. So, the vertical skip inserted before a caption is % unnecessary for table captions. The right solution is to design % captions for different float types in different ways. % % \paragraph{6} The star-form of captions is absent. It is useful % when a document contains an alone figure or table. Moreover, % in fiction books, unnumbered captions useful. % % \paragraph{7} The design of toc-entries is hard for modifications. % It is much better to calculate the skips in toc-entries on the % base of prototyping technique instead of hard-coding them % with absolute values. Moreover, the skips for nested sections % must depend on of higher level skips. For example, if we % change skips for a section entry, the skips for subsection entries % should be adjusted automatically. % % \bigskip % The package eliminates above-mention disadvantages of the standard % \LaTeX\ implementation. The commands implemented in it are divided % into two levels: user level and design level. The user-level commands % are intended for use within a document and the design-level commands % are directed to class and package writers. % % \section{User Interface} % % The table below shows sectioning commands provided with standard % \LaTeX\ classes. Every section has a \textit{level\/} (an integer % number). Sections can be printed in one of two modes: % \textit{display\/} or \textit{run-in\/} mode. Display section is % prepared as a separate justified paragraph having a hand indent if a % section has a number. Run-in section starts a paragraph. % \begin{center}\catcode`|=12 % \small\tabcolsep=10pt % \renewcommand\cboxstyle{\footnotesize} % \begin{tabular}{|l|c|c|}\hline % \hfill\cbox{Command}\hfill\mbox{} & % \hfill\cbox{Level}\hfill\mbox{} & % \hfill\cbox{Mode}\hfill\mbox{}\\\hline % \Strut/.8/ % \cs{part} & $-$1 or 0\footnotemark & display \\ % \cs{chapter} & 0\footnotemark & display \\ % \cs{section} & 1 & display \\ % \cs{subsection} & 2 & display \\ % \cs{subsubsection} & 3 & display \\ % \cs{paragraph} & 4 & run-in \\ % \cs{subparagraph} & 5 & run-in \\ % \hline % \end{tabular}\footnotetext[1]{The \cs{part} command has zero level % in article-like classes and has the negative level in book-like % classes. In book-like classes a part is prepared on % a separate page.}\footnotetext{The \cs{chapter} command is defined % in book-like classes only.} % \end{center} % % \DescribeMacro\startsection % The package redefines all standard sectioning commands except % the |\part| command in the book-like class. Along with the % commands shown in the table above, you can use the following % uniform notations: % \begin{quote} % |\startsection|\marg{level}\oarg{toc-entry}\marg{title}\quad or\\ % |\startsection|\marg{level}|*|\marg{title} % \end{quote} % The \meta{level} is a level of section. The first command % produces a numbered section (if~the numbering depth allows this) % and the last one produces a section without number. % As for the standard \LaTeX\ sectioning, the first variant of % the |\startsection| command additionally passes their arguments % to the section mark command (if the mark command exists) % and to the aux-file. % The last variant does no additional actions. % % \bigskip % \textbf{NOTE}: The package allows declaring additional section % levels. They, of course, have no predefined alias names as % standard section levels. % % \bigskip % \DescribeMacro\sectionstyle % The |\sectionstyle|\marg{style} command allows change % a style of subsequent display sections. The following styles % are predefined: % \begin{desclist}{\tt}{ \rm\hfill---}[hangindent*]\itemsep=0mm % \item[hangindent] standard LaTeX style (default). % \item[hangindent*] the same as |hangindent|, but ragged right. % \item[parindent] section titles are indented on |\parindent|. % \item[parindent*] the same as |parindent|, but ragged right. % \item[center] section titles are centered. % \end{desclist} % You can apply the |\sectionstyle| so many times in the document % as you want. This command complies with standard \LaTeX\ scoping % rules. % % \DescribeMacro\indentaftersection % \DescribeMacro\noindentaftersection % The paragraph indentation after a display section is controlled with % the |\indentaftersection| and |\noindentaftersection| commands. % The first one allows and the last one suppresses % indentation after section. The commands act on the subsequent % display sections in the scope of their use. % % The customization of a number tag and running head of a concrete % section is provided with so-call \textit{modifiers}. A modifier % is a command acting on the nearest sectioning command going after it. % Usually, the modifiers are placed just before a sectioning command. % All modifiers act with non-starred versions of sections. % If the next sectioning command is starred, modifiers are ignored. % % \DescribeMacro\norunninghead % The |\norunninghead| command suppresses generation of running head for the % next non-starred section, i.e.\ it skips the call of section mark command % in the next section. % % \DescribeMacro\runninghead % The |\runninghead|\marg{running-title} command overrides a text going to the % running head when a new non-starred section starts and an appropriate\linebreak % |\pagestyle| is in use. This command has higher priority % than the |\norunninghead|. % % \DescribeMacro\noheadingtag % The |\noheadingtag| command suppresses a number tag in the next section, % but all other attendant actions are executed (writing to the aux-file and % updating the running head). % % \DescribeMacro\headingtag % The |\headingtag|\marg{tag} command overrides a number tag in the next % section. It has the higher priority than |\noheadingtag|. Overridden % section tag can be referred with the |\label| command. % All fragile commands in the overridden tag should be protected. % % \DescribeMacro{\headingtag*} % The |\headingtag*|\marg{tag} command prepares a number tag as is, ignoring % the tag style, prefix, and suffix. The aux-file and running head are not % updated in this case. % % \DescribeMacro\skipwritingtoaux % The |\skipwritingtoaux| suppresses writing to aux-file for the next section % command. % % \bigskip % \textbf{NOTE}: All modifiers use global settings. % % \bigskip % \DescribeMacro\caption % \DescribeMacro{\caption*} % The captions are implemented in this package using the same technique as % the sectioning commands. There are two versions of caption command % allowed within floating environments: % \begin{quote} % |\caption|\oarg{toc-entry}\marg{title}\quad and\\ % |\caption*|\marg{title} % \end{quote} % The first one works in the same manner as the standard \LaTeX\ |\caption| % command. Its star-version prepares a caption without number and preceding % words `Figure' or `Table'. % % You can use line breaking commands in captions. But in this case, % you need to set the optional \meta{toc-entry} parameter to avoid % translation errors. % % \DescribeMacro\captionstyle % \DescribeMacro\captiontagstyle % \DescribeMacro\captionwidth % Caption appearance can be customized. You can customize ether all caption % types or only selected caption type. The following commands do this: % \begin{quote} % |\captionstyle|\oarg{type}\marg{style}\\ % |\captiontagstyle|\oarg{type}\marg{style}\\ % |\captionwidth|\oarg{type}\marg{length} % \end{quote} % If |type| is omitted, these commands are applied to all types (out of floats) % or to the current type (inside a float). If both typed and non-typed % cases are specified for a float type, typed case has a % precedence before non-typed one. The |\captionstyle| specifies a style % the caption text will be formatted: % \begin{desclist}{\tt}{}[centerlast] % \item[default] standard \LaTeX's style, % \item[para] simple paragraph, % \item[left] all lines are flushed left, % \item[center] all lines are centered, % \item[right] all lines are flushed right, or % \item[centerlast] as |para|, but the last line is centered. % \end{desclist} % The |\captiontagstyle| specifies a position of caption tag: % \begin{desclist}{\tt}{}[centerlast] % \item[para] tag is formatted together with text; % \item[left] tag is adjusted to the left in a separate line; % \item[center] tag is centered in a separate line; or % \item[right] tag is adjusted to the right in a separate line. % \end{desclist} % The |\captionwidth| specifies a width of caption. Defaults: % \begin{quote} % |\captionstyle{default}|\\ % |\captiontagstyle{para}|\\ % |\captionwidth{\linewidth}| % \end{quote} % % \bigskip % \textbf{NOTE}: The above-described section modifiers can be used with non-starred % captions. Although, the |\runninghead| and |\norunninghead| commands % have no sense with captions, but you can do them working if define % a |\figuremark| or |\tablemark| command. % % \section{Declare Sections and Captions} % % \DescribeMacro\DeclareSection % To define or redefine a section or caption command, you can use % in the preamble of your document the % following command: % \begin{quote} % |\DeclareSection|\marg{level}\marg{type}\oarg{indent}\marg{prefix}\\ % | |\marg{beforeskip}\marg{afterskip}\marg{style} % \end{quote} % \begin{desclist}{}{}[\meta{beforeskip}] % \item[\meta{level}] a section level number. Zero and negative values % are interpreted as follows: % 0 means declaring the |\chapter| or |\part| command depending on a % class used; a negative value means declaring a caption. % % \item[\meta{type}] a section type. For zero level, this % parameter is ignored. For negative level, it defines a float type % (i.e., |figure| or |table|). For positive level, it defines % a counter name. The name of marking command is composed from % the type as |\|\meta{type}|mark|. % % \item[\meta{indent}] indentation of heading from the left margin % (zero is default). Ignored for negative levels. % % \item[\meta{prefix}] a prefix inserted before a section-number tag % (usually empty). In chapter, part, or caption declaration commands, % it is inserted right before the tag name, e.g., before the |\@chapapp|, % |\partname|, |\figurename|, or |\tablename| command. % % \item[\meta{beforeskip}] the skip to leave above the heading. % % \item[\meta{afterskip}] if positive, then the skip to leave below % the heading, else negative of skip to leave to right of run-in % heading. The negative value is allowed for positive section levels % only. % % \item[\meta{style}] commands to set a style. The last command in % this argument may be a command such as |\MakeUppercase| that % takes an argument. The section heading will be supplied as the % argument to this command. So setting it to, say, % |\bfseries\MakeUppercase| would produce bold, uppercase headings. % \end{desclist} % Sections having nonnegative \meta{level} and positive \meta{afterskip} % are display sections. They are declared with the |hangindent| style % and do not obey the |\sectionstyle| command. % % \DescribeMacro{\DeclareSection*} % To declare a display section having dynamic alignment controlled with the % |\sectionstyle| command, use the star-version of the previous command: % \begin{quote} % |\DeclareSection*|\marg{level}\marg{type}\marg{prefix}\\ % | |\marg{beforeskip}\marg{afterskip}\marg{style} % \end{quote} % A negative \meta{afterskip} has no meaning in this case. % % \DescribeMacro\bff % To prepare bold section headings, % you can use the |\bff| command in the \meta{style} parameter. % It tries to set everything bold. Its definition is the following: % \begin{quote} % |\newcommand{\bff}{\normalfont\bfseries\mathversion{bold}}| % \end{quote} % % Examples of section and caption declarations: % \begin{quote} % |\DeclareSection{-2}{table}{}{0pt}{10pt}{}|\\ % |\DeclareSection{-1}{figure}{}{10pt}{0pt}{}|\\ % |\DeclareSection*{1}{section}{}%|\\ % | {3.5ex plus 1ex minus .2ex}%|\\ % | {2.3ex plus .2ex}{\Large\bff}| % \end{quote} % Here we declare the table caption command with zero skip % before it and |10pt| skip after it. On contrary, the % figure caption command produced |10pt| skip before it % and zero skip after it. The |\section| command is declared with % dynamic horizontal alignment. It is prepared in the |\Large| % font with everything bold. % % \DescribeMacro\SectionTagSuffix % The |\SectionTagSuffix|\marg{suffix} command specifies a suffix % inserted after a section number tag. For example, the command % \begin{quote} % |\SectionTagSuffix{.\quad}| % \end{quote} % sets the decimal point after every section number tag. % Sections of 0th level ignore this suffix. The default tag is |\quad|. % The command can be used in the preamble only. % % \DescribeMacro\CaptionTagSuffix % The |\CaptionTagSuffix|\marg{suffix} command specifies a suffix % inserted after a caption number tag. It can be used in the preamble only. % The default caption tag is: % \begin{quote} % |\CaptionTagSuffix{:\hskip .7em plus .2em minus .1em}| % \end{quote} % % \section{Declare TOC-Entries} % % \DescribeMacro\DeclareTOCEntry % To declare an entry of table of contents or other lists % (list of figures or list of tables), use the following command % (in the preamble only): % \begin{quote} % |\DeclareTOCEntry|\marg{level}\marg{action}\marg{prefix}\marg{prototype}\\ % | |\marg{style}\oarg{next} % \end{quote} % \begin{desclist}{}{\hfill}[\meta{prototype}] % \item[\meta{level}] a section level number. % For zero and negative level the following commands are created: % 0 means |\l@chapter| or |\l@part| depending on class used; % $-1$ means |\l@figure|; $-2$ means |\l@table|. If level % is greater than 5, the name of toc-entry command is % generated as |\l@section@|\meta{level-in-roman}, % i.e., the 6th level toc-entry is |\l@section@vi|. % % \item[\meta{action}] commands applied before entry is produced (usually empty). % % \item[\meta{prefix}] text inserted before the section number (usually empty). % % \item[\meta{prototype}] prototype of number for alignment the toc-entry body. % The hang indent of this toc-entry will be equal to the width of % \begin{quote} % \meta{prefix}\meta{prototype}\meta{numberline-suffix}. % \end{quote} % % \item[\meta{style}] commands to set a style. The last command in this argument % may be a command such as |\MakeUppercase| that takes an % argument. The produced entry will be supplied as the % argument to this command. So setting it to, say, % |\bfseries\MakeUppercase| would produce bold, % uppercase entry. This style is applied to the number also. % To apply different styles to the text of entry and to its page % number, use in this parameter the command % \begin{quote} % |\applystyle|\marg{text-style}\marg{number-style} % \end{quote} % % \item[\meta{next}] prototype for left margin adjustment for an entry of the % next level. Default is the hang indent of the current toc-entry. % \end{desclist} % A toc-entry is produced within a group. % % \DescribeMacro\NumberlineSuffix % The |\NumberlineSuffix|\marg{calc-suffix}\marg{actual-suffix} % command allows customize a skip inserted after % numbers in TOC-like entries. The \meta{calc-suffix} parameter % is used in calculations of hang indent of toc-entries and the % \meta{actual-suffix} is really inserted at the end of number. % The \marg{calc-suffix} is usually wider than the \meta{actual-suffix}. % The default is |\NumberlineSuffix{\quad}{\enskip}|. % This command is available in the preamble only. % % \DescribeMacro\PnumPrototype % The |\PnumPrototype|\marg{prototype} command is used for adjustment % the right margin of the text of toc-entries in toc-lists. % Default is |\PnumPrototype{99}|. % If your document has more than 99 pages, use % |\PnumPrototype{999}|. % This command is available in the preamble only. % % \DescribeMacro\TOCMarginDrift % The |\TOCMarginDrift|\marg{increment} command specifies a value of % right-margin drift in TOCs. The increment is applied after the |\@plus| % token in definition of right margin. Empty argument means no drift. % Examples: % \begin{quote} % |\TOCMarginDrift{2em}|\\ % |\TOCMarginDrift{1fil}| % \end{quote} % The command can be use anywhere in the document. % % \DescribeMacro\runinsectionskip % This command is useful in the \meta{action} parameter of the % toc-entry declaration to produce the skip before a toc-entry % equal to the skip before run-in sections. % % The following example shows how toc-entries are declared in books: % \begin{quote} % |\DeclareTOCEntry{-2}{}{}{9.9}{}% table|\\ % |\DeclareTOCEntry{-1}{}{}{9.9}{}% figure|\\ % |\DeclareTOCEntry{0}{\runinsectionskip\def\@dotsep{1000}%|\\ % | \aftergroup\penalty\aftergroup\@highpenalty}{}{9}{\bff}% chapter|\\ % |\DeclareTOCEntry{1}{}{}{9.9}{}[9.9]% section|\\ % |\DeclareTOCEntry{2}{}{}{9.9.9}{}[9.9.9]% subsection|\\ % |\DeclareTOCEntry{3}{}{}{}{}[\qquad]% subsubsection| % \end{quote} % The number prototype for figures and tables is `9.9' here. % The |\l@chapter| entry applies the run-in section skip before it and % redefines the |\@dotsep| command to remove dot leaders. % Using the |\aftergroup| command, it inserts the |\@highpenalty| % after this toc-entry to avoid a page break at this point. % The left margin adjustment after section and nested toc-entries % is calculated here using the prototype of widest section number. % This produces the following nesting: % \begin{flushleft} % {\bf 1\quad Chapter}\\ % \jhbox{{\bf 1\quad}}{}1.1\quad Section\\ % \jhbox{{\bf 1\quad}1.1}{}1.1.1\quad Subsection\\ % \jhbox{{\bf 1\quad}1.11.1.1}{}Subsubsection % \end{flushleft} % % \section{Declare New Float Types} % % The standard \LaTeX\ classes provide two types of floating environments: % figures and tables. If you have prepared a new floating % environment in some way (i.e., using the |float| package by Anselm % Lingnau), you can declare a caption for the new float % with the commands described in previous sections. % % \DescribeMacro\RegisterFloatType % In books, when a new chapter starts, the |\chapter| command % puts a special vertical skip to the contents of list of figures and % of list of tables. This behaviour can be easy extended to new float types % if you register them within this package. The registration is % provided with the following command: % \begin{quote} % |\RegisterFloatType|\marg{float-type} % \end{quote} % After the float type is registered, you can declare a toc-entry % for it using the negation of its registration number in the % \meta{level} parameter. The % first new float type is registered third (after the figure and table). % So, you must % use \meta{level} = $-3$ for it, $-4$ for the next registered float % type and so on. % % In the following example, we define a new float type, |program|, % and prepare the caption and toc-entry commands for it. % The caption of programs % is supposed to be used at the beginning of program. % So, we make it in the same manner as the table caption. % \begin{quote} % |\documentclass{book}|\\ % |\usepackage{float,nccsect}|\\ % |\newfloat{program}{tp}{lop}[chapter]|\\ % |\floatname{program}{Program}|\\ % |\RegisterFloatType{program}|\\ % |\DeclareSection{-3}{program}{}{0pt}{10pt}{}|\\ % |\DeclareTOCEntry{-3}{}{}{9.9}{}| % \end{quote} % % To produce a list of programs, you can then use the |\listof| % command from the |float| package as follows: % \begin{quote} % |\listof{program}{List of Programs}| % \end{quote} % \StopEventually{} % % \section{Epigraphs and Related Staff} % % \DescribeMacro\beforechapter % \DescribeMacro\epigraph % To put epigraph before any chapter, you can use two methods: % low-level |\beforechapter|\marg{anything} hook or % user-level command % \begin{quote} % |\epigraph|\oarg{width}\marg{text}\marg{author} % \end{quote} % The last one applies a special formatting to epigraph and % calls the first one. The |\beforechapter| hook inserts its % contents at the beginning of page just before a chapter % instead of spacing specified in the chapter declaration. % % \DescribeMacro\epigraphparameters % Formatting of user-level epigraph is provided with the % following command % \begin{quote} % |\epigraphparameters|\marg{style}\marg{width}\marg{height}\marg{author-style}\\ % | |\marg{after-action} % \end{quote} % Here \meta{style} is a style applied to the whole epigraph % (font selection, spacing and positioning, etc.), the \meta{width} % is the default epigraph width (can be changed in an epigraph), % the \meta{author-style} is the style applied to the author's % signature, and the \meta{after-action} is an action applied after % the epigraph (usually a vertical spacing). All styles and actions % are applied in the vertical mode. An \meta{author-style} can finish with % one-argument macro getting the author of epigraph and formatting it. % % \DescribeMacro\epigraphwidth % In |\epigraphparameters|, you can use the |\epigraphwidth| macro % which contains a selected epigraph width. % % The default style is: % \begin{quote} % |\epigraphparameters{\StartFromHeaderArea\small\raggedleft}|\\ % | {.45\linewidth}{5\baselineskip}|\\ % | {\raggedleft\itshape}{\vspace{2ex}}| % \end{quote} % % \DescribeMacro\StartFromTextArea % The |\vspace*| command applied at the beginning of page has one serious % disadvantage: it skips more space that specified in its parameter. % To remove this disadvantage, we introduce the |\StartFromTextArea| % command that % inserts a zero-height strut and allows use the |\vspace| command after it % without troubles. % % \DescribeMacro\StartFromHeaderArea % You can also extend the text area on the header if apply the % |\StartFromHeaderArea| command at the beginning of page. % Such action is useful in epigraphs: the first chapter's page usually % has an empty header and positioning an epigraph from the header % is the good practice. % % \section{The Implementation} % % \begin{macro}{\NCC@secskip} % \begin{macro}{\NCC@runskip} % The package shares the following commands with the % |nccthm| package: % \begin{quote} % |\NCC@secskip|\marg{skip} adds the \meta{skip} before a section,\\ % |\NCC@runskip| is a skip inserted before run-in sections. % \end{quote} % We protect the definitions of these commands with testing % the |nccthm| package to be already loaded. % \begin{macrocode} %<*package> \@ifpackageloaded{nccthm}{}{% \def\NCC@secskip#1{% \if@noskipsec \leavevmode \fi \par \if@nobreak \everypar{}\else \addpenalty\@secpenalty \addvspace{#1}% \fi } \def\NCC@runskip{2.75ex \@plus 1ex \@minus .2ex} } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\runinsectionskip} % This command is useful in toc-entries: % \begin{macrocode} \newcommand{\runinsectionskip}{\NCC@secskip{\NCC@runskip}} % \end{macrocode} % \end{macro} % % \subsection{The Kernel} % % We start with declaring the section controls (modifiers): % \begin{desclist}{\tt}{\hfill}[NCC@nosecmark]\raggedright % \item[NCC@nosectag] is true if |\noheadingtag| is applied; % \item[NCC@secstartag] is true if |\headingtag*|\marg{tag} is applied; % \item[\cs{NCC@sectag}] saves a value of the |\headingtag| parameter; % \item[NCC@nosecmark] is true if |\norunninghead| is applied; % \item[\cs{NCC@secmark}\rm\marg{mark-command}] executes the \meta{mark-command} % with the parameter of |\runninghead| command; % \item[NCC@noaux] is true if |\skipwritingtoaux| is applied. % \end{desclist} % \begin{macrocode} \newif\ifNCC@nosectag \newif\ifNCC@secstartag \newif\ifNCC@nosecmark \newif\ifNCC@noaux % \end{macrocode} % % \begin{macro}{\NCC@global} % We reset all controls globally, but in the |\beforechapter| % hook we need to reset them locally. So, we reset all controls % using the |\NCC@global| modifier which value is |\global| by default. % \begin{macrocode} \let\NCC@global\global % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@sec@reset@controls} % This command resets all controls to default values. % It must be applied at the end of every section command. % \begin{macrocode} \def\NCC@sec@reset@controls{% \NCC@global\NCC@nosectagfalse \NCC@global\NCC@secstartagfalse \NCC@global\let\NCC@sectag\relax \NCC@global\NCC@nosecmarkfalse \NCC@global\let\NCC@secmark\relax \NCC@global\NCC@noauxfalse } \NCC@sec@reset@controls % \end{macrocode} % \end{macro} % % \begin{macro}{\norunninghead} % \begin{macro}{\runninghead} % \begin{macro}{\noheadingtag} % \begin{macro}{\headingtag} % \begin{macro}{\headingtag*} % \begin{macro}{\skipwritingtoaux} % User interface to section controls: % \begin{macrocode} \newcommand{\norunninghead}{\NCC@global\NCC@nosecmarktrue} \newcommand*{\runninghead}[1]{\NCC@global\def\NCC@secmark##1{##1{#1}}} \newcommand{\noheadingtag}{\NCC@global\NCC@nosectagtrue} \newcommand{\headingtag}{% \@ifstar{\NCC@global\NCC@secstartagtrue\NCC@setsectag}{\NCC@setsectag}% } \def\NCC@setsectag#1{\NCC@global\def\NCC@sectag{#1}} \newcommand{\skipwritingtoaux}{\NCC@global\NCC@noauxtrue} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\NCC@makesection} % The |\NCC@makesection|\marg{type}\marg{level}\marg{toc-entry}\marg{toc-action} % produces a section or caption. It analyzes the modifiers and customizes % sections or captions. The \meta{toc-action} parameter contains an % attendant action that must be applied at the end of macro. % It writes a toc-entry to aux-file. % % The command uses the following hooks that must be prepared % before its call: % \begin{desclist}{}{}[\cs{NCC@make}\marg{action}] % \item[\cs{NCC@makesectag}\marg{value}] produces a tag using the % given value; % % \item[\cs{NCC@make}\marg{action}] makes a section or caption heading % and applies the \meta{action} after heading. Before the call % of this command, the |\@svsec| macro is prepared (it contains a % prepared tag). % \end{desclist} % We start from the case when the |\headingtag*|\marg{tag} modifier was % applied and the section tag was saved in the |\NCC@sectag| macro. % We apply the |\NCC@make| procedure with the given section tag. % Attendant actions are ignored for this case. % \begin{macrocode} \def\NCC@makesection#1#2#3#4{% \ifNCC@secstartag \let\@svsec\NCC@sectag \NCC@make{}% \else % \end{macrocode} % Prepare a tag creation command in the |\the|\meta{type} macro. % We can do some temporary changes here that will be restored % at the end of macro. The restore hook is prepared in the % |\NCC@restsec| command. % \begin{macrocode} \ifx\NCC@sectag\relax % \end{macrocode} % The |\noheadingtag| case: we temporary set the |secnumdepth| % counter to very low negative value. This prevents numbering % this section: % \begin{macrocode} \ifNCC@nosectag \edef\NCC@restsec{% \noexpand\c@secnumdepth \the\c@secnumdepth\relax }% \c@secnumdepth -1000 % \end{macrocode} % The ordinary case: No restore actions is necessary here. % \begin{macrocode} \else \let\NCC@restsec\relax \ifnum#2>\c@secnumdepth \else\refstepcounter{#1}\fi \fi % \end{macrocode} % The |\headingtag|\marg{tag} case: we temporary let the % |\the|\meta{type} macro to be equal to the |\NCC@sectag| % command produced by the |\headingtag|, % save the original value in the |\NCC@thesec| command, % and prepare the |\NCC@restsec| macro. % \begin{macrocode} \else \expandafter\let\expandafter\NCC@thesec\csname the#1\endcsname \def\NCC@restsec{% \expandafter\let\csname the#1\endcsname\NCC@thesec }% \expandafter\let\csname the#1\endcsname\NCC@sectag \protected@edef\@currentlabel{\NCC@sectag}% \fi % \end{macrocode} % % Prepare section tag in the |\@svsec| command: % \begin{macrocode} \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else \protected@edef\@svsec{% \protect\NCC@makesectag{\csname the#1\endcsname}% }% \fi % \end{macrocode} % % We cannot do the marking right now because the producing of section % can be suspended to the beginning of the nearest paragraph % (in run-in sections). So, we need to prepare a mark action % in a command that will save its state as long as necessary. % This command is |\NCC@makemark|. % \begin{macrocode} \let\NCC@makemark\@empty \@ifundefined{#1mark}{}{% \ifx\NCC@secmark\relax % \end{macrocode} % Ordinary case: prepare the section mark with the % \meta{toc-entry} parameter. % \begin{macrocode} \ifNCC@nosecmark \else \def\NCC@makemark{\csname #1mark\endcsname{#3}}% \fi % \end{macrocode} % The |\runninghead|\marg{heading} case: % pass the mark command in the parameter of |\NCC@secmark|. % We need to save the |\NCC@secmark| value in some command % and pass this command within |\NCC@makemark| because % the |\NCC@secmark| could be removed before the use. % \begin{macrocode} \else \let\NCC@savesecmark\NCC@secmark \def\NCC@makemark{% \NCC@savesecmark{\csname #1mark\endcsname}% \let\NCC@savesecmark\relax }% \fi }% % \end{macrocode} % % Make the section. We must apply the restore action at % the end action of |\NCC@make| command by the same reason that % the section making may be suspended: % \begin{macrocode} \ifNCC@noaux \NCC@make{\NCC@makemark \NCC@restsec}% \else \NCC@make{\NCC@makemark #4\NCC@restsec}% \fi % \end{macrocode} % % Reset modifiers: % \begin{macrocode} \fi \NCC@sec@reset@controls } % \end{macrocode} % \end{macro} % % \subsection{Section Making Commands} % % \begin{macro}{\indentaftersection} % \begin{macro}{\noindentaftersection} % Introduce macros controlling indentation after display sections: % \begin{macrocode} \newcommand{\indentaftersection}{\@afterindenttrue} \newcommand{\noindentaftersection}{\@afterindentfalse} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\SectionTagSuffix} % The |\SectionTagSuffix|\marg{suffix} sets a suffix after a section tag: % \begin{macrocode} \newcommand*{\SectionTagSuffix}[1]{\def\NCC@asecnum{#1}} \@onlypreamble\SectionTagSuffix % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@defaultsectag} % This command restores the making tag command to its default % value. % \begin{macrocode} \def\NCC@makesectag@default#1{#1\NCC@asecnum} \def\NCC@defaultsectag{\let\NCC@makesectag\NCC@makesectag@default} \NCC@defaultsectag % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@secname} % The |\NCC@secname|\marg{level} command generates section name % (|section|,\linebreak |subsection|, \ldots, % or |section@vi|, |section@vii|, \ldots\ for new section levels). % This name is used as the second parameter of the |\addcontentsline| % command and in the declarations of toc-entries. % \begin{macrocode} \def\NCC@secname#1{% \ifcase#1\relax \or section\or subsection\or subsubsection\or paragraph\or subparagraph\else section@\romannumeral#1\fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\@startsection} % The |\@startsection| command % has the same syntax as the original \LaTeX\ version: % \begin{quote} % |\@startsection|\marg{type}\marg{level}\marg{indent}\marg{beforeskip}\\ % | |\marg{afterskip}\marg{style} % \end{quote} % but works in a bit different way: it ignores the sign of % \meta{beforeskip}. In the original version the testing % was applied to set an appropriate |afterindent| mode. % But we change this mode using |\indentaftersection| and % |\noindentaftersection| macros. % \begin{macrocode} \def\@startsection#1#2#3#4#5#6{% \@tempskipa #4\relax \ifdim \@tempskipa <\z@ \@temskipa -\@tempskipa \fi \NCC@secskip \@tempskipa \secdef{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}{\@ssect{#3}{#4}{#5}{#6}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makesec} % We save the interface of |\@ssect| and |\@sect| commands, but % change their implementation. They are based on the following % command: % \begin{quote} % |\NCC@makesec|\marg{indent}\marg{style}\marg{heading}\marg{afterskip}\marg{action} % \end{quote} % In fact, there are two versions of this command: % the traditional version, |\NCC@makesect|, and the % version with dynamic control of section style,\linebreak |\NCC@makesecx|. % The first one is the default version. To be sure, that this % version will be used by default, we every time let % the |\NCC@makesec| to be equal to |\NCC@makesect| after % a section is produced. % \end{macro} % % \begin{macro}{\@ssect} % The starred form of section: % \begin{quote} % |\@ssect|\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{heading} % \end{quote} % \begin{macrocode} \def\@ssect#1#2#3#4#5{% \let\@svsec\@empty \NCC@makesec{#1}{#4}{#5}{#3}{}% \NCC@sec@reset@controls \let\NCC@makesec\NCC@makesect \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\@sect} % The base form of section: % \begin{quote} % |\@sect|\marg{type}\marg{level}\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\\ % | |\oarg{toc-entry}\marg{heading} % \end{quote} % \begin{macrocode} \def\@sect#1#2#3#4#5#6[#7]#8{% \def\NCC@make{\NCC@makesec{#3}{#6}{#8}{#5}}% \NCC@makesection{#1}{#2}{#7}{% \addcontentsline{toc}{\NCC@secname{#2}}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7% }% }% \let\NCC@makesec\NCC@makesect \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makesect} % The traditional section making command: % \begin{quote} % |\NCC@makesect|\marg{indent}\marg{style}\marg{heading}\marg{afterskip}\marg{action} % \end{quote} % \begin{macrocode} \def\NCC@makesect#1#2#3#4#5{% \@tempskipa #4\relax \ifdim \@tempskipa>\z@ \begingroup \normalfont #2{\@hangfrom{\hskip #1\relax\@svsec}% \interlinepenalty \@M\ignorespaces #3\@@par}% \endgroup #5% \else \def\@svsechd{{\normalfont #2{\hskip #1\relax \@svsec\ignorespaces #3}}#5}% \fi \@xsect{#4}% } \let\NCC@makesec\NCC@makesect % \end{macrocode} % \end{macro} % % \subsection{Make Sections with Dynamic Control} % % \begin{macro}{\NCC@sec} % A style of sections having dynamic control is defined by the % |\NCC@sec|\marg{tag} hook. This hook is applied inside a group % preparing a heading. % \end{macro} % % \begin{macro}{\sectionstyle} % The |\sectionstyle|\marg{style} changes a style of display sections. % In fact, it calls the |\NCC@sec@|\meta{style} command. % \begin{macrocode} \newcommand*{\sectionstyle}[1]{% \@ifundefined{NCC@sec@#1}% {\PackageError{nccsect}{Unknown section style `#1'}{}}% {\csname NCC@sec@#1\endcsname}% } \def\NCC@sec@hangindent{\def\NCC@sec##1{\@hangfrom{##1}}} \@namedef{NCC@sec@hangindent*}{% \def\NCC@sec##1{\@hangfrom{##1}\rightskip\@flushglue}% } \def\NCC@sec@parindent{\def\NCC@sec##1{\@hangfrom\indent##1}} \@namedef{NCC@sec@parindent*}{% \def\NCC@sec##1{\@hangfrom\indent\rightskip\@flushglue##1}% } \def\NCC@sec@center{\def\NCC@sec##1{\centering##1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makesecx} % The dynamic section making command: % \begin{quote} % |\NCC@makesecx|\marg{indent}\marg{style}\marg{heading}\marg{afterskip}\marg{action} % \end{quote} % It prepares only display sections and ignores the \meta{indent} parameter. % \begin{macrocode} \def\NCC@makesecx#1#2#3#4#5{% \begingroup\normalfont #2{\NCC@sec{\@svsec}\interlinepenalty \@M\ignorespaces #3\@@par}% \endgroup #5% \par \nobreak \vskip #4\relax \@afterheading \ignorespaces } % \end{macrocode} % \end{macro} % % \subsection{Make the Main Section} % % \begin{macro}{\NCC@startmainsec} % The main section is a section of zero level. % It is prepared with the following command: % \begin{quote} % |\NCC@startmainsec|\marg{alignment}\marg{prefix}\marg{beforeskip}\\ % | |\marg{afterskip}\marg{style} % \end{quote} % It starts either a new chapter or a new part depending on the class % loaded. To decide what version should be prepared, we test the % |\chapter| command on existence. % \begin{macrocode} \@ifundefined{chapter}{% % \end{macrocode} % % The case of an article-like class. Zero-level section is the |\part|. % \begin{macrocode} \def\NCC@startmainsec#1#2#3#4#5{% \def\NCC@makesectag##1{\leavevmode#2\partname\nobreakspace##1}% \NCC@secskip{#3}% \secdef{\@part{#1}{#4}{#5}}{\@spart{#1}{#4}{#5}}% } % \end{macrocode} % % \begin{macro}{\@spart} % Prepare the starred version of part: % \begin{quote} % |\@spart|\marg{alignment}\marg{afterskip}\marg{style}\marg{heading} % \end{quote} % \begin{macrocode} \def\@spart#1#2#3#4{% \let\@svsec\@empty \NCC@makepart{#1}{#3}{#4}{#2}{}% \NCC@sec@reset@controls \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\@part} % Prepare the non-starred version of part: % \begin{quote} % |\@part|\marg{alignment}\marg{afterskip}\marg{style}\oarg{toc-entry}\marg{heading} % \end{quote} % \begin{macrocode} \def\@part#1#2#3[#4]#5{% \def\NCC@make{\NCC@makepart{#1}{#3}{#5}{#2}}% \NCC@makesection{part}{\z@}{#4}{% \addcontentsline{toc}{part}{% \ifnum \c@secnumdepth>\m@ne \protect\numberline{\thepart}\fi #4% }% }% \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makepart} % This command makes a part. % \begin{quote} % |\NCC@makepart|\marg{alignment}\marg{style}\marg{heading}\marg{afterskip}\marg{action} % \end{quote} % The |\@svsec| is either |\@empty| or contains a part tag. % \begin{macrocode} \def\NCC@makepart#1#2#3#4#5{% \begingroup \normalfont \ifx\@svsec\@empty \else #1{\@svsec\@@par}\nobreak \fi \interlinepenalty \@M #1{#2{#3}\@@par}% \endgroup #5% \par\nobreak \vskip #4\relax \@afterheading \ignorespaces } % \end{macrocode} % \end{macro} % \begin{macro}{\partmark} % Define the |\partmark| if it is undefined before. % \begin{macrocode} \providecommand*\partmark[1]{\markboth{}{}} }{ % \end{macrocode} % \end{macro} % % The case of a book-like class. Zero-level section is the |\chapter|. % \begin{macrocode} \def\NCC@startmainsec#1#2#3#4#5{% \NCC@startchap \def\NCC@makesectag##1{\leavevmode#2\@chapapp\nobreakspace##1}% \secdef{\@chapter{#1}{#3}{#4}{#5}}{\@schapter{#1}{#3}{#4}{#5}}% } % \end{macrocode} % % \begin{macro}{\beforechapter} % The |\beforechapter|\marg{something} hook is applied to the nearest % chapter. An empty value of its parameter means no hook. % \begin{macrocode} \newcommand\beforechapter[1]{\gdef\NCC@beforechapter{#1}} \beforechapter{} % \end{macrocode} % \end{macro} % % \begin{macro}{\@schapter} % Prepare the starred version of chapter: % \begin{quote} % |\@schapter|\marg{alignment}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{heading} % \end{quote} % \begin{macrocode} \def\@schapter#1#2#3#4#5{% \let\@svsec\@empty \NCC@makechapter{#1}{#2}{#4}{#5}{#3}{}% \NCC@sec@reset@controls \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\@chapter} % Prepare the non-starred version of chapter: % \begin{quote} % |\@chapter|\marg{alignment}\marg{beforeskip}\marg{afterskip}\marg{style}\\ % | |\oarg{toc-entry}\marg{heading} % \end{quote} % It uses the |\NCC@infloats|\marg{action} hook that applies the specified % action for all registered float types. % \begin{macrocode} \def\@chapter#1#2#3#4[#5]#6{% \@ifundefined{if@mainmatter}{}{\if@mainmatter\else\noheadingtag\fi}% \def\NCC@make{\NCC@makechapter{#1}{#2}{#4}{#6}{#3}}% \NCC@makesection{chapter}{\z@}{#5}{% \typeout{\@chapapp\space\thechapter.}% \addcontentsline{toc}{chapter}{% \ifnum \c@secnumdepth>\m@ne \protect\numberline{\NCC@thetocchapter}\fi #5% }% \NCC@infloats{\addtocontents{\@nameuse{ext@\@captype}}% {\protect\runinsectionskip}}% }% \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@startchap} % The start chapter hook: % \begin{macrocode} \def\NCC@startchap{% \if@openright\cleardoublepage\else\clearpage\fi \thispagestyle{plain}\global\@topnum\z@ } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@thetocchapter} % The following hook allows redefine the appearance of chapter name % in the TOC: % \begin{macrocode} \def\NCC@thetocchapter{\thechapter} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makechapter} % This command makes a chapter: % \begin{quote} % |\NCC@makechapter|\marg{alignment}\marg{beforeskip}\marg{style}\marg{heading}\\ % | |\marg{afterskip}\marg{action} % \end{quote} % The |\@svsec| is either |\@empty| or contains a chapter tag. % \begin{macrocode} \def\NCC@makechapter#1#2#3#4#5#6{% \if@twocolumn \@topnewpage[\NCC@makechaphead{#1}{#2}{#3}{#4}{#5}]% \else \NCC@makechaphead{#1}{#2}{#3}{#4}{#5}% \fi #6% \@afterheading \ignorespaces } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makechaphead} % This command makes a chapter head: % \begin{quote} % |\NCC@makechaphead|\marg{alignment}\marg{beforeskip}\marg{style}\marg{heading}\\ % | |\marg{afterskip} % \end{quote} % \begin{macrocode} \def\NCC@makechaphead#1#2#3#4#5{% \ifx\NCC@beforechapter\@empty \StartFromTextArea \vspace{#2}% \else \begingroup \@twocolumnfalse \let\NCC@global\@empty \NCC@sec@reset@controls \normalfont \NCC@beforechapter \par \endgroup \beforechapter{}% \fi \begingroup \normalfont \ifx\@svsec\@empty \else #1{\@svsec\@@par}\fi \interlinepenalty \@M #1{#3{#4}\@@par}% \endgroup \par\nobreak \vskip #5\relax } % \end{macrocode} % \end{macro} % % \begin{macro}{\epigraph} % \begin{macro}{\epigraphparameters} % \begin{quote} % |\epigraph|\oarg{width}\marg{text}\marg{author}\\ % |\epigraphparameters|\marg{style}\marg{width}\marg{height}\marg{author-style}\\ % | |\marg{after-action} % \end{quote} % \begin{macrocode} \newcommand*\epigraph[1][\NCC@epigraphwidth]{\NCC@epigraph{#1}} \newcommand*\epigraphparameters[5]{% \def\NCC@epigraphwidth{#2}% \long\def\NCC@epigraph##1##2##3{ \beforechapter{\def\epigraphwidth{##1}% #1\par \NCC@makeepigraph{#3}{##2}{#4{##3}}\par #5% }% }% } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\NCC@makeepigraph} % \begin{quote} % |\NCC@makeepigraph|\marg{height}\marg{text}\marg{author} % \end{quote} % \begin{macrocode} \long\def\NCC@makeepigraph#1#2#3{% \@begin@tempboxa\vtop{\setlength{\hsize}{\epigraphwidth}% \@parboxrestore{#2\@@par}#3\@@par }% \setlength\@tempdima{#1}\advance\@tempdima -\totalheight \ifdim\@tempdima>\z@ \advance\@tempdima\depth \dp\@tempboxa\@tempdima \fi \leavevmode\box\@tempboxa \@end@tempboxa } } % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Make Captions} % % \begin{macro}{\CaptionTagSuffix} % The |\CaptionTagSuffix|\marg{suffix} sets a suffix after a caption tag: % \begin{macrocode} \newcommand*{\CaptionTagSuffix}[1]{\def\NCC@acapnum{#1}} \@onlypreamble\CaptionTagSuffix % \end{macrocode} % \end{macro} % % \begin{macro}{\captionstyle} % The |\captionstyle|\oarg{type}\marg{style} selects a style to be applied % to the caption text. Three styles are available now: |default|, |center|, % and |centerlast|. % \begin{macrocode} \newcommand*\captionstyle[1][]{% \NCC@set@capkey{style}{style}{#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\captiontagstyle} % The |\captiontagstyle|\oarg{type}\marg{style} selects a style of caption tag: % |right| or |para|. % \begin{macrocode} \newcommand*\captiontagstyle[1][]{% \NCC@set@capkey{tag}{tag style}{#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\captionwidth} % The |\captionwidth|\oarg{type}\marg{length} specifies a caption width. % Default width is |\linewidth|. % \begin{macrocode} \newcommand*\captionwidth[2][]{% \NCC@prepare@capkey{width}{#1}{\setlength{\hsize}{#2}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@set@capkey} % |\NCC@set@capkey|\marg{key}\marg{description}\marg{type}\marg{value} % \begin{macrocode} \def\NCC@set@capkey#1#2#3#4{% \@ifundefined{NCC@makecap#1@#4} {\PackageError{nccsect}{Unknown caption #2 `#4'}{}% }{% \edef\@tempa{\noexpand\NCC@prepare@capkey{#1}{#3}{% \expandafter\noexpand\csname NCC@makecap#1@#4\endcsname }% }% \@tempa }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@prepare@capkey} % |\NCC@prepare@capkey|\marg{key}\marg{type}\marg{definition} % \begin{macrocode} \def\NCC@prepare@capkey#1#2{% \def\@tempa{#2}% \ifx\@tempa\@empty \ifx\@captype\@undefined \else \let\@tempa\@captype \fi \fi \expandafter\def\csname NCC@cap#1@\@tempa\endcsname } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@apply@cap} % |\NCC@apply@cap|\marg{key} % \begin{macrocode} \def\NCC@apply@cap#1{% \@ifundefined{NCC@cap#1@\@captype}% {\let\@tempa\@empty}{\let\@tempa\@captype}% \csname NCC@cap#1@\@tempa\endcsname } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@startcaption} % This command starts a caption: % \begin{quote} % |\NCC@startcaption|\marg{beforeskip}\marg{afterskip}\marg{style} % \end{quote} % \begin{macrocode} \def\NCC@startcaption#1#2#3{% \secdef{\NCC@caption{#1}{#2}{#3}}{\NCC@scaption{#1}{#2}{#3}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@scaption} % Starred version of caption: % \begin{quote} % |\NCC@scaption|\marg{beforeskip}\marg{afterskip}\marg{style}\marg{text} % \end{quote} % \begin{macrocode} \long\def\NCC@scaption#1#2#3#4{% \let\@svsec\@empty \NCC@makecaption{#3}{#1}{#4}{#2}{}% \NCC@sec@reset@controls \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@caption} % Non-starred version of caption: % \begin{quote} % |\NCC@caption|\marg{beforeskip}\marg{afterskip}\marg{style}\oarg{toc-entry}\marg{text} % \end{quote} % \begin{macrocode} \long\def\NCC@caption#1#2#3[#4]#5{% \def\NCC@make{\NCC@makecaption{#3}{#1}{#5}{#2}}% \NCC@makesection{\@captype}{\z@}{#4}{% \begingroup \let\centering\@empty \addcontentsline{\@nameuse{ext@\@captype}}{\@captype}{% \ifnum \c@secnumdepth>\m@ne \protect\numberline{\@nameuse{the\@captype}}\fi #4% }% \endgroup }% \NCC@defaultsectag } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecaption} % This command makes a caption: % \begin{quote} % |\NCC@makecaption|\marg{style}\marg{beforeskip}\marg{text}\marg{afterskip}\marg{action} % \end{quote} % The |\@svsec| is either |\@empty| or contains a caption tag. % \begin{macrocode} \long\def\NCC@makecaption#1#2#3#4#5{% \begingroup\par\normalfont #1{}\addvspace{#2}\noindent % \end{macrocode} % Calculate in |\@tempcnta| caption variants: % 0~-- no caption, 1~-- caption tag only, 2~-- caption text only, % 3~-- both caption tag and text are nonempty. % \begin{macrocode} \ifx\@svsec\@empty \@tempcnta\z@ \else \@tempcnta\@ne \fi \def\@tempa{#3}% \ifx\@tempa\@empty \else \advance\@tempcnta\tw@ \fi % \end{macrocode} % Put caption in a parbox aligned at the top line. % \begin{macrocode} \ifnum\@tempcnta=\z@ \else \vtop{\NCC@apply@cap{width}\@parboxrestore \NCC@apply@cap{tag}{#3}\@@par}\par % \end{macrocode} % We avoid insert zero skip after parbox to allow captions of % side-by-side figures to be aligned at their top line. % \begin{macrocode} \setlength\@tempskipa{#4}% \ifdim\@tempskipa=\z@ \else \vskip \@tempskipa\fi \fi \endgroup #5% } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecaptag@para} % The |\NCC@makecaptag@para|\marg{text} prepares run-in tag. % \begin{macrocode} \long\def\NCC@makecaptag@para#1{% \ifnum\@tempcnta<\thr@@ \let\NCC@acapnum\@empty\fi \NCC@apply@cap{style}{{\@svsec}\ignorespaces#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecaptag@left} % The |\NCC@makecaptag@left|\marg{text} prepares flush-left tag. % \begin{macrocode} \def\NCC@makecaptag@left{\NCC@separate@captag\raggedright} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecaptag@center} % The |\NCC@makecaptag@center|\marg{text} prepares centered tag. % \begin{macrocode} \def\NCC@makecaptag@center{\NCC@separate@captag\centering} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecaptag@right} % The |\NCC@makecaptag@right|\marg{text} prepares flush-right tag. % \begin{macrocode} \def\NCC@makecaptag@right{\NCC@separate@captag\raggedleft} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@separate@captag} % The |\NCC@separate@captag|\marg{style}\marg{text} prepares a % caption tag in a separate line. % \begin{macrocode} \long\def\NCC@separate@captag#1#2{% \ifodd\@tempcnta {\let\NCC@acapnum\@empty #1\@svsec\@@par}% \fi \ifnum\@tempcnta>\@ne \ifnum\@tempcnta=\thr@@ \vskip .5ex\fi \NCC@apply@cap{style}{#2}% \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecapstyle@default} % The |\NCC@makecapstyle@default|\marg{text} prepares caption text % in default \LaTeX's style. % \begin{macrocode} \long\def\NCC@makecapstyle@default#1{% \setbox\@tempboxa\vtop{\hsize\linewidth\@parboxrestore#1\@@par}% \ifdim\dp\@tempboxa<\baselineskip \centering#1% \else \box\@tempboxa \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecapstyle@para} % The |\NCC@makecapstyle@para|\marg{text} prepares ordinary caption. % \begin{macrocode} \long\def\NCC@makecapstyle@para#1{#1} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecapstyle@left} % The |\NCC@makecapstyle@left|\marg{text} prepares flush-left caption. % \begin{macrocode} \long\def\NCC@makecapstyle@left#1{\raggedright#1} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecapstyle@right} % The |\NCC@makecapstyle@right|\marg{text} prepares flush-right caption. % \begin{macrocode} \long\def\NCC@makecapstyle@right#1{\raggedleft#1} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecapstyle@center} % The |\NCC@makecapstyle@center|\marg{text} prepares centered caption. % \begin{macrocode} \long\def\NCC@makecapstyle@center#1{\centering#1} % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@makecapstyle@centerlast} % The |\NCC@makecapstyle@centerlast|\marg{text} prepares caption with % last line centered. % \begin{macrocode} \long\def\NCC@makecapstyle@centerlast#1{% \leftskip\z@\@plus 1fil% \rightskip\z@\@plus -1fil% \parfillskip\z@\@plus 2fil\relax#1% } % \end{macrocode} % \end{macro} % % \begin{macro}{\RegisterFloatType} % The |\RegisterFloatType|\marg{type} command registers a float type: % \begin{macrocode} \newcommand*{\RegisterFloatType}[1]{% \edef\NCC@floatlist{\NCC@floatlist{#1}}% } \let\NCC@floatlist\@empty \@onlypreamble\RegisterFloatType % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@infloats} % The |\NCC@infloats|\marg{action} command applies the given \meta{action} % to all registered float types. During the cycle, % the |\@captype| contains a name of float and % the |\@tempcnta| is equal to its registration number % (1~for the figure float, 2~for the table float, and so on). % \begin{macrocode} \def\NCC@infloats#1{% \@tempcnta\z@ \let\NCC@temp \@captype \expandafter \@tfor \expandafter \@captype \expandafter :\expandafter =\NCC@floatlist \do {\advance\@tempcnta\@ne #1}% \let\@captype\NCC@temp } % \end{macrocode} % \end{macro} % % \subsection{Declare Sections and Captions} % % \begin{macro}{\DeclareSection} % Now we can implement the |\DeclareSection| command. % It generates: % \begin{desclist}{}{} % \item[\cs{NCC@mainsection}] command if \meta{level} = 0; % \item[\cs{NCC@section}\meta{level-in-roman}] command if \meta{level} $>$ 0; % \item[\cs{NCC@cap@}\meta{float-type}] command if \meta{level} $<$ 0. % \end{desclist} % \begin{macrocode} \newcommand{\DeclareSection}{\@ifstar{\NCC@dsecx}{\NCC@dsec}} \def\NCC@dsec#1#2{% \@ifnextchar[{\NCC@dsect{#1}{#2}}{\NCC@dsect{#1}{#2}[\z@skip]}% } \@onlypreamble\DeclareSection \@onlypreamble\NCC@dsec % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@dsect} % The non-starred version of section declaration command % prepares display sections with traditional formatting: % \begin{quote} % |\NCC@dsect|\marg{level}\marg{type}\oarg{indent}\marg{prefix}\marg{beforeskip}\\ % | |\marg{afterskip}\marg{style} % \end{quote} % It is also used for generation of run-in sections % and captions. % \begin{macrocode} \def\NCC@dsect#1#2[#3]#4#5#6#7{% \ifnum#1>\z@ \expandafter\def\csname NCC@section\romannumeral#1\endcsname{% \def\NCC@makesectag####1{#4####1\NCC@asecnum}% \let\NCC@makesec\NCC@makesect \@startsection{#2}{#1}{#3}{#5}{#6}{#7}}% \else \ifnum#1=\z@ \def\NCC@mainsection{% \NCC@startmainsec{\@hangfrom{\hskip #3}\rightskip\@flushglue}% {#4}{#5}{#6}{#7}% }% \else \NCC@dsecf{#2}{#4}{#5}{#6}{#7}% \fi \fi } \@onlypreamble\NCC@dsect % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@dsecx} % The starred version of section declaration command % prepares display sections with dynamic formatting: % \begin{quote} % |\NCC@dsecx|\marg{level}\marg{type}\marg{prefix}\marg{beforeskip}\marg{afterskip}\marg{style} % \end{quote} % It can be also used for generation of captions. % \begin{macrocode} \def\NCC@dsecx#1#2#3#4#5#6{% \ifnum#1>\z@ \expandafter\def\csname NCC@section\romannumeral#1\endcsname{% \def\NCC@makesectag####1{#3####1\NCC@asecnum}% \let\NCC@makesec\NCC@makesecx \@startsection{#2}{#1}{\z@}{#4}{#5}{#6}}% \else \ifnum#1=\z@ \def\NCC@mainsection{% \NCC@startmainsec{\NCC@sec{}\rightskip\@flushglue}% {#3}{#4}{#5}{#6}% }% \else \NCC@dsecf{#2}{#3}{#4}{#5}{#6}% \fi \fi } \@onlypreamble\NCC@dsecx % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@dsecf} % This command declares captions of floats: % \begin{quote} % |\NCC@dsecf|\marg{type}\marg{prefix}\marg{beforeskip}\marg{afterskip}\marg{style} % \end{quote} % \begin{macrocode} \def\NCC@dsecf#1#2#3#4#5{% \expandafter\def\csname NCC@cap@#1\endcsname{% \def\NCC@makesectag####1{#2{\csname #1name\endcsname}% \nobreakspace####1\NCC@acapnum}% \NCC@startcaption{#3}{#4}{#5}% }% } \@onlypreamble\NCC@dsectf % \end{macrocode} % \end{macro} % % \begin{macro}{\@makecaption} % We emulate here the |\@makecaption{\fnum@|\meta{type}|}|\marg{caption} % command to provide the compatibility with packages using it. % It calls the |\NCC@cap@|\meta{type} command using the type specified % in |\@captype| command. The counter is already stepped % before this command and all necessary things are written % to aux. Therefore, we turn off writing to aux and decrease a value of % the float counter by |-1| because it will be stepped within again. % \begin{macrocode} \long\def\@makecaption#1#2{% \begingroup \skipwritingtoaux \addtocounter\@captype\m@ne \csname NCC@cap@\@captype\endcsname[]{#2}% \endgroup } % \end{macrocode} % \end{macro} % % Add patches to the |supertabular| and |longtable| packages if they are used: % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{supertabular}{% \long\def\ST@caption#1[#2]#3{\par% \addcontentsline{\csname ext@#1\endcsname}{#1}% {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% \def\@captype{#1}% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par }% }{}% \@ifpackageloaded{longtable}{% \def\LT@makecaption#1#2#3{% \LT@mcol\LT@cols c{\hbox to\z@{\hss \parbox[t]\LTcapwidth{\def\@captype{table}% \ifx#1\@gobble \NCC@cap@table*{#3}% \else \@makecaption{\fnum@table}{#3}% \fi }% \hss }}% }% }{}% } % \end{macrocode} % % \subsection{Declare TOC-Entries} % % \begin{macro}{\DeclareTOCEntry} % The toc-entries declaration command: % \begin{quote} % |\DeclareTOCEntry|\marg{level}\marg{action}\marg{prefix}\marg{prototype}\\ % | |\marg{style}\oarg{next} % \end{quote} % \begin{macrocode} \newcommand*{\DeclareTOCEntry}[5]{% \@ifnextchar[{\NCC@dtoc{#1}{#2}{#3}{#4}{#5}}% {\NCC@dtoc{#1}{#2}{#3}{#4}{#5}% [{#3#4\let\NCC@do\@firstoftwo\NCC@atocnum}]}% } \def\NCC@dtoc#1#2#3#4#5[#6]{% % \end{macrocode} % Declare a toc-entry command for a registered float. % We scan the registration list and find the necessary % float type comparing its registration number with the negation % of level. The generated command is |\l@|\meta{float-type}: % \begin{macrocode} \ifnum#1<\z@ \@tempswatrue \NCC@infloats{% \ifnum#1=-\@tempcnta \expandafter\def\csname l@\@captype\endcsname {\NCC@tocentry\z@{#2}{#3}{#4}{#5}}% \@tempswafalse \@break@tfor \fi }% % \end{macrocode} % Incorrect level number. Generate an error. % \begin{macrocode} \if@tempswa \@tempcnta#1\relax \@tempcnta -\@tempcnta \PackageError{nccsect} {Float type registration number \the\@tempcnta\space is out of range}{}% \fi \else % \end{macrocode} % Prepare in |\@tempa| a command name: |\l@section| or |\l@subsection| % or \ldots\ or |\l@subparagraph| or |\l@section@vi| or \ldots: % \begin{macrocode} \ifnum#1>\z@ \edef\@tempa{\noexpand\def\expandafter\noexpand \csname l@\NCC@secname{#1}\endcsname}% % \end{macrocode} % or |\l@part| or |\l@chapter|: % \begin{macrocode} \else \@ifundefined{chapter}{\def\@tempa{\def\l@part}}% {\def\@tempa{\def\l@chapter}}% \fi % \end{macrocode} % Declare the toc-entry: % \begin{macrocode} \@tempa{\NCC@tocentry{#1}{#2}{#3}{#4}{#5}}% % \end{macrocode} % Prepare in the |\l@tocskip@|\meta{next-level-in-roman} command % the left margin adjustment command: % \begin{macrocode} \@tempcnta #1\relax \advance\@tempcnta\@ne \expandafter\def\csname l@tocskip@\romannumeral\@tempcnta \endcsname{\NCC@tocadj{#5{#6}}}% \fi } \@onlypreamble\DeclareTOCEntry \@onlypreamble\NCC@dtoc % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@tocentry} % This command makes a toc-entry: % \begin{quote} % |\NCC@tocentry|\marg{level}\marg{action}\marg{prefix}\marg{prototype}\\ % | |\marg{style}\marg{entry}\marg{page-number} % \end{quote} % \begin{macrocode} \def\NCC@tocentry#1#2#3#4#5#6#7{% \ifnum #1>\c@tocdepth \else \par\begingroup\normalfont #2% \let\applystyle\@firstoftwo % \end{macrocode} % Calculate the left margin in the |\@tempdimb| register % applying the |\l@tocskip@i|, \ldots, |\l@tocskip@|\meta{level-in-roman} % commands: % \begin{macrocode} \@tempdimb\z@ \@tempcnta #1\relax \@whilenum \@tempcnta >\z@\do {\@nameuse{l@tocskip@\romannumeral \@tempcnta}% \advance\@tempcnta\m@ne}% % \end{macrocode} % Prepare the |\NCC@maketocnum|\marg{tag} command creating % a number-line tag: % \begin{macrocode} \def\NCC@maketocnum##1{\NCC@do{#5}{}{#3##1\NCC@atocnum}}% % \end{macrocode} % Calculate the hang indent value in |\@tempdima|: % \begin{macrocode} \settowidth\@tempdima{\let\NCC@do\@firstoftwo\NCC@maketocnum{#4}}% % \end{macrocode} % Produce the toc-entry: % \begin{macrocode} \@dottedtocline{#1}{\@tempdimb}{\@tempdima}% {\let\NCC@do\@secondoftwo#5{\ignorespaces#6\unskip}}% {\let\applystyle\@secondoftwo#5{#7}}% % \end{macrocode} % Allow break after toc-entry: % \begin{macrocode} \@nobreakfalse \endgroup \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@tocadj} % The command increases |\@tempdimb| on the width of the argument: % \begin{macrocode} \def\NCC@tocadj#1{\settowidth\@tempdima{#1}\advance\@tempdimb\@tempdima} % \end{macrocode} % \end{macro} % % \begin{macro}{\numberline} % Redefine the |\numberline|\marg{tag} command to work correct % if the width of tag is greater than |\@tempdima|. The % tag is prepared with the |\NCC@maketocnum|\marg{tag} command. % \begin{macrocode} \def\numberline#1{% \setbox\@tempboxa\hbox{\NCC@maketocnum{#1}}% \ifdim \wd\@tempboxa > \@tempdima \box\@tempboxa \else \hb@xt@\@tempdima{\unhbox\@tempboxa\hfil}% \fi \ignorespaces } % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@maketocnum} % The default implementation of the |\NCC@maketocnum|\marg{tag} command. % We must define it because the |\numberline| command must % work out of scope of toc-entries. % \begin{macrocode} \def\NCC@maketocnum#1{#1\let\NCC@do\@secondoftwo\NCC@atocnum} % \end{macrocode} % \end{macro} % % \begin{macro}{\NumberlineSuffix} % The |\NumberlineSuffix|\marg{calc-suffix}\marg{actual-suffix} % command saves suffices inserted after number tag in the |\numberline| % command. It saves it in the |\NCC@atocnum| hook as parameters of % |\NCC@do| command. Letting the last one to |\@firstoftwo| or % |\@secondoftwo|, we select the \meta{calc-suffix} or \meta{actual-suffix} % respectively. % \begin{macrocode} \newcommand*{\NumberlineSuffix}[2]{\def\NCC@atocnum{\NCC@do{#1}{#2}}} \@onlypreamble\NumberlineSuffix % \end{macrocode} % \end{macro} % % \begin{macro}{\TOCMarginDrift} % The |\TOCMarginDrift|\marg{drift} specifies a drift of right margin % in TOC. % \begin{macrocode} \newcommand*\TOCMarginDrift[1]{% \def\@tempa{#1}% \ifx\@tempa\@empty \let\NCC@tocdrift\@empty \else \def\NCC@tocdrift{\@plus #1\relax}\fi } \TOCMarginDrift{} % \end{macrocode} % \end{macro} % % \begin{macro}{\PnumPrototype} % The |\PnumPrototype|\marg{prototype} command saves the page number % prototype in the |\NCC@pnum| hook and applies the |\NCC@setpnum| % command. % \begin{macrocode} \newcommand*{\PnumPrototype}[1]{\def\NCC@pnum{#1}\NCC@setpnum} \@onlypreamble\PnumPrototype % \end{macrocode} % \end{macro} % % \begin{macro}{\NCC@setpnum} % The |\NCC@setpnum| command calculates the page number widths in % |\@pnumwidth| and the toc right margin in |\@tocrmarg|. % If the toc-style is customizable, we recommend to apply this % command right after toc-styling commands to update margins % for the new toc-style. % \begin{macrocode} \def\NCC@setpnum{% \settowidth\@tempdima{\NCC@pnum}% \edef\@pnumwidth{\the\@tempdima}% \advance\@tempdima 1em \edef\@tocrmarg{\the\@tempdima \noexpand\NCC@tocdrift}% } % \end{macrocode} % \end{macro} % % \subsection{Service and Defaults} % % \begin{macro}{\StartFromTextArea} % The command is applied at the beginning of page % to set current position exactly at the first line % of text area. % \begin{macrocode} \newcommand\StartFromTextArea{\par {\parskip\z@ \strut\par}\vskip -\baselineskip } % \end{macrocode} % \end{macro} % % \begin{macro}{\StartFromHeaderArea} % The command is applied at the beginning of page % to set current position exactly at the header line. % \begin{macrocode} \newcommand\StartFromHeaderArea{% \StartFromTextArea \vskip -\headsep \vskip -\ht\strutbox } % \end{macrocode} % \end{macro} % % \begin{macro}{\bff} % The |\bff| command tries to set everything bold. % \begin{macrocode} \newcommand{\bff}{\normalfont\bfseries\mathversion{bold}} % \end{macrocode} % \end{macro} % % \begin{macro}{\startsection} % Define the |\startsection| command: % \begin{macrocode} \newcommand*{\startsection}[1]{% \ifnum#1>\z@ \def\@tempa{\csname NCC@section\romannumeral#1\endcsname}% \else \ifnum#1=\z@ \def\@tempa{\NCC@mainsection}% \else \def\@tempa{\part}% \fi \fi \@tempa } % \end{macrocode} % \end{macro} % % \begin{macro}{\section} % \begin{macro}{\subsection} % \begin{macro}{\subsubsection} % \begin{macro}{\paragraph} % \begin{macro}{\subparagraph} % Set aliases for the positive section levels: % \begin{macrocode} \def\section{\startsection\@ne} \def\subsection{\startsection\tw@} \def\subsubsection{\startsection\thr@@} \def\paragraph{\startsection4} \def\subparagraph{\startsection5} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\caption} % Redefine the |\caption| command. We do this at the beginning % of document to reject possible redefinitions of captions % in other packages such as |float|. I think this is not the % |float|'s responsibility to decide where a caption must go on: % before or after the float body. And what about complicated % floats consisting of side floats and etc.? We also reset to zero % the |\abovecaptionskip| and |\belowcaptionskip| registers if they % are specified to provide partial compatibility with the |float| % package. If the registers are not specified (as in |ncc| class), % they are emulated with macros. % \begin{macrocode} \AtBeginDocument{% \def\caption{% \ifx\@captype\@undefined \@latex@error{\noexpand\caption outside float}\@ehd \expandafter\@gobble \else \expandafter\@firstofone \fi {\csname NCC@cap@\@captype\endcsname}% }% \@ifundefined{abovecaptionskip}{\def\abovecaptionskip{\z@}}% {\abovecaptionskip\z@}% \@ifundefined{belowcaptionskip}{\def\belowcaptionskip{\z@}}% {\belowcaptionskip\z@}% } % \end{macrocode} % \end{macro} % % Register standard floats: % \begin{macrocode} \RegisterFloatType{figure} \RegisterFloatType{table} % \end{macrocode} % % Declare all sections and captions except the main section: % \begin{macrocode} \DeclareSection{-2}{table}{}{\z@}{10pt}{} \DeclareSection{-1}{figure}{}{10pt}{\z@}{} \DeclareSection*1{section}{}% {3.5ex \@plus 1ex \@minus .2ex}% {2.3ex \@plus .2ex}{\Large\bff} \DeclareSection*2{subsection}{}% {3.25ex \@plus 1ex \@minus .2ex}% {1.5ex \@plus .2ex}{\large\bff} \DeclareSection*3{subsubsection}{}% {3ex \@plus 1ex \@minus .2ex}% {1.5ex \@plus .2ex}{\normalsize\bff} \DeclareSection4{paragraph}{}% {\NCC@runskip}{-1em}{\normalsize\bff} \DeclareSection5{subparagraph}[\parindent]{}% {\NCC@runskip}{-1em}{\normalsize\bff} \@ifundefined{chapter}{ % \end{macrocode} % % \begin{macro}{\part} % Declare the main section and toc-entries for the % article-like style: % \begin{macrocode} \def\part{\startsection\z@} \DeclareSection*0{part}{\Large\bff}% {5ex \@plus 1ex \@minus .2ex}% {4ex \@plus .2ex}{\huge\bff} \DeclareTOCEntry{-2}{}{}{9}{}% table \DeclareTOCEntry{-1}{}{}{9}{}% figure \DeclareTOCEntry0{\runinsectionskip\def\@dotsep{1000}}{}{III}{\bff}[] \DeclareTOCEntry1{\runinsectionskip}{}{9}{} \DeclareTOCEntry2{}{}{9.9}{} \DeclareTOCEntry3{}{}{9.9.9}{} }{ % \end{macrocode} % \end{macro} % % \begin{macro}{\chapter} % Declare the main section, toc-entries for the % book-like style, and specify default epigraph parameters: % \begin{macrocode} \def\chapter{\startsection\z@} \DeclareSection*0{chapter}{\vspace{3ex}\huge\bff}{10ex}% {8ex \@plus .2ex}{\Huge\bff} \DeclareTOCEntry{-2}{}{}{9.9}{}% table \DeclareTOCEntry{-1}{}{}{9.9}{}% figure \DeclareTOCEntry0{\runinsectionskip\def\@dotsep{1000}% \aftergroup\penalty\aftergroup\@highpenalty}{}{9}{\bff} \DeclareTOCEntry1{}{}{9.9}{}[9.9] \DeclareTOCEntry2{}{}{9.9.9}{}[9.9.9] \DeclareTOCEntry3{}{}{}{}[\qquad] \epigraphparameters{\StartFromHeaderArea\small\raggedleft}% {.45\linewidth}{5\baselineskip}% {\raggedleft\itshape}{\vspace{2ex}} } % \end{macrocode} % \end{macro} % % Declare other toc-entries: % \begin{macrocode} \DeclareTOCEntry4{}{}{}{}[\qquad] \DeclareTOCEntry5{}{}{}{}[\qquad] % \end{macrocode} % % Set defaults: % \begin{macrocode} \noindentaftersection \sectionstyle{hangindent} \SectionTagSuffix{\quad} \captionwidth{\linewidth} \captionstyle{default} \captiontagstyle{para} \CaptionTagSuffix{:\hskip .7em \@plus .2em \@minus .1em} \NumberlineSuffix{\quad}{\enskip} \PnumPrototype{99} % % \end{macrocode} \endinput