summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/ncctools
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/ncctools')
-rw-r--r--Master/texmf-dist/source/latex/ncctools/afterpackage.dtx118
-rw-r--r--Master/texmf-dist/source/latex/ncctools/dcounter.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/desclist.dtx3
-rw-r--r--Master/texmf-dist/source/latex/ncctools/extdash.dtx5
-rw-r--r--Master/texmf-dist/source/latex/ncctools/manyfoot.dtx3
-rw-r--r--Master/texmf-dist/source/latex/ncctools/mboxfill.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccbbb.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccboxes.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/ncccomma.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/ncccropbox.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/ncccropmark.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccfancyhdr.dtx7
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccfloats.dtx326
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccfoots.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccmath.dtx3
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccparskip.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccpic.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccrules.dtx3
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccsect.dtx1451
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccstretch.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/nccthm.dtx26
-rw-r--r--Master/texmf-dist/source/latex/ncctools/ncctools.ins5
-rw-r--r--Master/texmf-dist/source/latex/ncctools/textarea.dtx236
-rw-r--r--Master/texmf-dist/source/latex/ncctools/tocenter.dtx1
-rw-r--r--Master/texmf-dist/source/latex/ncctools/topsection.dtx133
-rw-r--r--Master/texmf-dist/source/latex/ncctools/watermark.dtx1
26 files changed, 1962 insertions, 370 deletions
diff --git a/Master/texmf-dist/source/latex/ncctools/afterpackage.dtx b/Master/texmf-dist/source/latex/ncctools/afterpackage.dtx
new file mode 100644
index 00000000000..4fbd30ce141
--- /dev/null
+++ b/Master/texmf-dist/source/latex/ncctools/afterpackage.dtx
@@ -0,0 +1,118 @@
+% \iffalse
+%%
+%% File: afterpackage.dtx Copyright (C) 2005, 2006 by Alexander I. Rozhenko
+%%
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{afterpackage}
+%<package> [2006/01/17 v1.1 Apply Commands After Package (NCC)]
+%
+% \changes{v1.0}{2005/12/25}{Initial version}
+% \changes{v1.1}{2006/01/17}{The package renamed to `afterpackage'}
+%
+%<*driver>
+\let\makeindex\relax
+\documentclass{ltxdoc}
+\usepackage{afterpackage}
+\GetFileInfo{afterpackage.sty}
+\begin{document}
+\title{The \textsf{afterpackage} package\thanks{This file
+ has version number \fileversion, last
+ revised \filedate.}}
+\author{Alexander I. Rozhenko\\rozhenko@oapmg.sscc.ru}
+\date{\filedate}
+\maketitle
+\DocInput{afterpackage.dtx}
+\end{document}
+%</driver>
+% \fi
+% The package allows specify what additional commands should be applied
+% to a package after its loading. To describe the usability of
+% the package, consider the task of customization of a number of
+% packages. Let we need to apply some package-specific code after loading
+% packages such as customization of their defaults or hooks.
+% To do this, we need to load all required packages and then apply the
+% related staff to them. But, sometimes loading of all required packages is
+% impossible or unnecessary because packages can have options or some of
+% customized packages are rarely useful.
+%
+% The main idea of using this package is to specify how other packages
+% can be customized in such a way that their customization is applied when
+% and if customized packages are loaded. All the customization is applied
+% in the preamble only.
+%
+% \DescribeMacro\AfterPackage
+% To customize a package, load the \textbf{afterpackage} package and
+% insert any number of the following commands anywhere in the preamble:
+% \begin{quote}
+% |\AfterPackage|\marg{package name}\marg{commands}
+% \end{quote}
+% The command works as follows: it tests the required package to be
+% already loaded; if the package is loaded, it directly applies \meta{commands};
+% otherwise, it collects \meta{commands} in a special macro. The specified
+% macro will be applied later when the respective package will be loaded.
+% This operation is executed when the package loading finishes and all
+% end-of-package hooks are applied. So, the \meta{commands} are applied
+% \emph{after the end} of respective package.
+%
+% \StopEventually{}
+%
+% \section{The Implementation}
+%
+% \begin{macro}{\AfterPackage}
+% The command tests the |\ver@|\meta{filename} command to be
+% defined and considers either collect commands in a special macro
+% or apply them directly.
+% \begin{macrocode}
+%<*package>
+\newcommand*\AfterPackage[1]{%
+ \expandafter\ifx\csname ver@#1.\@pkgextension\endcsname\relax
+ \@ifundefined{#1.\@pkgextension-@dd}{%
+ \expandafter\let\csname#1.\@pkgextension-@dd\endcsname\@empty
+ \expandafter\@onlypreamble\csname#1.\@pkgextension-@dd\endcsname
+ }{}%
+ \wlog{After Package Info: Collect commands for #1\on@line}%
+ \def\@tempa{%
+ \expandafter\g@addto@macro\csname#1.\@pkgextension-@dd\endcsname}%
+ \else
+ \ATP@apply@info{#1}%
+ \let\@tempa\@firstofone
+ \fi
+ \@tempa
+}
+\@onlypreamble\AfterPackage
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@popfilename}
+% To apply collected commands to a package, we use the |\@popfilename| hook.
+% This hook is applied after loading a package. It pops a name of previous
+% package or class which was active before loading a package. We save
+% the original value of |\@popfilename| hook in a special macro and
+% redefine it to execute the |\|\meta{filename}|-@dd| hook before pop of
+% the previous filename.
+% \begin{macrocode}
+\let\ATP@popfilename\@popfilename
+\@onlypreamble\ATP@popfilename
+\def\@popfilename{%
+ \@ifundefined{\@currname.\@currext-@dd}{}{%
+ \ATP@apply@info{\@currname}%
+ \csname\@currname.\@currext-@dd\endcsname
+ \expandafter\let\csname\@currname.\@currext-@dd\endcsname\relax
+ }%
+ \ATP@popfilename
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ATP@apply@info}
+% This information message is logged when commands are applied. Its parameter
+% contains a name of package which commands are customized.
+% \begin{macrocode}
+\def\ATP@apply@info#1{%
+ \wlog{After Package Info: Apply commands to #1\on@line}%
+}
+\@onlypreamble\ATP@apply@info
+%</package>
+% \end{macrocode}
+% \end{macro}
+\endinput
diff --git a/Master/texmf-dist/source/latex/ncctools/dcounter.dtx b/Master/texmf-dist/source/latex/ncctools/dcounter.dtx
index bc0997f5d06..785ce5d9113 100644
--- a/Master/texmf-dist/source/latex/ncctools/dcounter.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/dcounter.dtx
@@ -11,6 +11,7 @@
% \changes{v1.2}{2005/04/25}{Emulate dynamic style for non-dynamic counters}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{dcounter}
\GetFileInfo{dcounter.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/desclist.dtx b/Master/texmf-dist/source/latex/ncctools/desclist.dtx
index b9498e8913e..de6a911f2d9 100644
--- a/Master/texmf-dist/source/latex/ncctools/desclist.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/desclist.dtx
@@ -11,6 +11,7 @@
% \changes{v1.1}{2004/11/23}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{desclist}
\GetFileInfo{desclist.sty}
@@ -29,6 +30,8 @@
% the |description| environment to provide an optional parameter
% as a prototype for calculation the hang indent of the list.
%
+% \tableofcontents
+%
% \section{User Interface}
%
% \DescribeMacro{desclist}
diff --git a/Master/texmf-dist/source/latex/ncctools/extdash.dtx b/Master/texmf-dist/source/latex/ncctools/extdash.dtx
index 7723fa0a5f3..52e192a811d 100644
--- a/Master/texmf-dist/source/latex/ncctools/extdash.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/extdash.dtx
@@ -11,6 +11,7 @@
% \changes{v1.2}{2005/01/29}{Change spaces surround em-dash}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{extdash}
\GetFileInfo{extdash.sty}
@@ -30,6 +31,8 @@
% words dashed by \emph{em-dash}. Some additional commands and
% shortcuts are also introduced.
%
+% \tableofcontents
+%
% \section{User Interface}
%
% \DescribeMacro{\Hyphdash}
@@ -202,7 +205,7 @@
% \begin{macro}{\BarOrDash}
% The commands |\HyphOrDash| and |\BarOrDash| will be called by |\-| and
% |\=| commands. They choose the corresponding shortcut or the original
-% commands saved in |\EXD@hyph| and |EXD@dash|.
+% commands saved in |\EXD@hyph| and |\EXD@dash|.
% \begin{macrocode}
\DeclareRobustCommand{\HyphOrDash}{%
\let\EXD@break\@empty
diff --git a/Master/texmf-dist/source/latex/ncctools/manyfoot.dtx b/Master/texmf-dist/source/latex/ncctools/manyfoot.dtx
index 470a7b605b2..42abc84677c 100644
--- a/Master/texmf-dist/source/latex/ncctools/manyfoot.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/manyfoot.dtx
@@ -30,6 +30,7 @@
% \changes{v1.10}{2005/09/11}{Remove overflow in calculation the fudge factor}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage[para]{manyfoot}
\DeclareNewFootnote{A}
@@ -73,6 +74,8 @@
% for the idea of this improvement). It allows a customization of
% footnote rules to be inserted before footnote levels.
%
+% \tableofcontents
+%
% \section{User Interface}
%
% \DescribeMacro\extrafootnoterule
diff --git a/Master/texmf-dist/source/latex/ncctools/mboxfill.dtx b/Master/texmf-dist/source/latex/ncctools/mboxfill.dtx
index 1a4793b38d8..cd831649fe7 100644
--- a/Master/texmf-dist/source/latex/ncctools/mboxfill.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/mboxfill.dtx
@@ -9,6 +9,7 @@
% \changes{v1.0}{2005/05/13}{This version was uploaded to CTAN}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{mboxfill}
\GetFileInfo{mboxfill.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccbbb.dtx b/Master/texmf-dist/source/latex/ncctools/nccbbb.dtx
index 6f470c3cfd0..2337fdc20db 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccbbb.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccbbb.dtx
@@ -11,6 +11,7 @@
% \changes{v1.1}{2004/11/24}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccbbb}
\GetFileInfo{nccbbb.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccboxes.dtx b/Master/texmf-dist/source/latex/ncctools/nccboxes.dtx
index f0a761fd3d6..da1a1b8ff02 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccboxes.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccboxes.dtx
@@ -15,6 +15,7 @@
% \changes{v1.2}{2005/02/07}{Allow lengthes in the Strut parameter}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccboxes}
\GetFileInfo{nccboxes.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/ncccomma.dtx b/Master/texmf-dist/source/latex/ncctools/ncccomma.dtx
index 8126358aadd..8488370b2f5 100644
--- a/Master/texmf-dist/source/latex/ncctools/ncccomma.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/ncccomma.dtx
@@ -9,6 +9,7 @@
% \changes{v1.0}{2005/02/10}{Initial version}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{ncccomma}
\GetFileInfo{ncccomma.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/ncccropbox.dtx b/Master/texmf-dist/source/latex/ncctools/ncccropbox.dtx
index d562379d492..e0c80dbd484 100644
--- a/Master/texmf-dist/source/latex/ncctools/ncccropbox.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/ncccropbox.dtx
@@ -11,6 +11,7 @@
% \changes{v1.1}{2004/11/24}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{ncccropbox}
\GetFileInfo{ncccropbox.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/ncccropmark.dtx b/Master/texmf-dist/source/latex/ncctools/ncccropmark.dtx
index 54e4d082ebc..735bb5d75ac 100644
--- a/Master/texmf-dist/source/latex/ncctools/ncccropmark.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/ncccropmark.dtx
@@ -12,6 +12,7 @@
% \changes{v1.1}{2004/11/29}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{ncccropmark,watermark}
\GetFileInfo{ncccropmark.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccfancyhdr.dtx b/Master/texmf-dist/source/latex/ncctools/nccfancyhdr.dtx
index dab851e4811..877e367184c 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccfancyhdr.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccfancyhdr.dtx
@@ -17,6 +17,7 @@
% \changes{v1.1}{2004/12/07}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccboxes}
\usepackage[headings]{nccfancyhdr}
@@ -67,6 +68,8 @@
% complicated. All these disadvantages of |fancyhdr| set off me to
% prepare a new version of |fancyhdr| packaged named as the |nccfancyhdr|.
%
+% \tableofcontents
+%
% \section{Using the Package}
%
% \thispagestyle{plain}
@@ -89,7 +92,7 @@
% \end{quote}
% loads the |nccfancyhdr| package and redefines the |plain| and |headings|
% styles on the base of |fancy| page style. It also sets the last style
-% in the list (e.g.\ |headings| style) as a default page style.\pagebreak
+% in the list (e.g.\ |headings| style) as a default page style.
%
% \section{Rule Control}
%
@@ -150,7 +153,7 @@
% expanded on the marginal area. To simplify control of the |\headwidth|,
% two service commands are introduced in the package. The |\normalheaders|
% command sets the |\headwidth| to the |\textwidth|. The
-% |\extendedheaders| enlarged the headers and footers on the whole marginal area:
+% |\extendedheaders| enlarges the headers and footers on the whole marginal area:
% in two-column mode, header and footer are expanded to both margins and, in
% one-column mode, header and footer are expanded to the
% outer margin, but, if reverse margin mode is on, they are expanded to
diff --git a/Master/texmf-dist/source/latex/ncctools/nccfloats.dtx b/Master/texmf-dist/source/latex/ncctools/nccfloats.dtx
index b23f6debe6c..bcf55b5e2e4 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccfloats.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccfloats.dtx
@@ -1,17 +1,21 @@
% \iffalse
%%
-%% File: nccfloats.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko
+%% File: nccfloats.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
%%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{nccfloats}
-%<package> [2004/12/05 v1.1 More Float Management (NCC)]
+%<package> [2006/01/07 v1.2 More Float Management (NCC)]
%
% \changes{v1.00}{2002/03/23}{This version is uploaded to CTAN}
% \changes{v1.01}{2002/05/17}{Handling of side floats improved}
% \changes{v1.1}{2004/12/05}{Width parameters can have units now}
% \changes{v1.1}{2004/12/05}{Documentation was prepared}
+% \changes{v1.2}{2006/01/07}{Extend |\FloatStyle| syntax}
+% \changes{v1.2}{2006/01/07}{Cover base floats with |\FloatStyle|}
+% \changes{v1.2}{2006/01/07}{Introduce |\newminifloat| command}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{desclist,nccfloats}
\GetFileInfo{nccfloats.sty}
@@ -30,26 +34,47 @@
% The standard \LaTeX\ floating environments, namely |figure|
% and |table|, allow user to place floating material in a
% document. But they do not introduce a style in which this
-% material must be prepared. In this package, envelop commands are
-% developed which join a style with a float and more
-% features are introduced, namely
-% mini-figures, mini-tables, side-figures, and side-tables.
+% material must be formatted. In this package, styles are
+% joined with floats and mini-floats are introduced. Mini-floats
+% are prepared at a mini-page and allow captions within.
+% Basing on mini-floats, a number of service commands for
+% figures and tables are defined. The ability to create
+% other types of mini-floats is introduced with the
+% |\newminifloat| command.
+%
+% \tableofcontents
%
% \section{Basic Commands}
%
-% \DescribeMacro{\FloatingStyle}
-% The |\FloatingStyle|\marg{style} command sets a style of
-% floats in the document. It affects on the material prepared with
-% commands described below. The default style is
+% \DescribeMacro{\FloatStyle}
+% The |\FloatStyle|\oarg{type}\marg{style} command sets a style for
+% the float of the given \meta{type}. If the \meta{type} is omitted,
+% the default style is specified. It will be applied to a float or
+% mini-float if no specialized style was defined.
+% This command is available in the preamble only.
+%
+% To specify the style of a mini-float and of service commands based on it,
+% add the `|mini|' prefix to the float type. The default styles are
% \begin{quote}
-% |\FloatingStyle{\footnotesize\centering}|
+% |\FloatStyle{}|\\
+% |\FloatStyle[minifigure]{\footnotesize\centering}|\\
+% |\FloatStyle[minitable]{\footnotesize\centering}|
% \end{quote}
-% This command is available in the preamble only.
+% This means that the formatting of floats prepared with standard
+% |figure| and |table| environments does not changed, but service
+% commands based on mini-figures and mini-tables use a special
+% formatting with |\footnotesize| font and the centered alignment.
+%
+% \DescribeMacro\normalfloatstyle
+% This command is applied inside floats or mini-floats to reset
+% formatting style of subsequent floating material to the standard
+% formatting with paragraph alignment and the normal font of
+% normal size.
%
% \DescribeMacro{\minifig}
% \DescribeMacro{\minitabl}
% We start with the basic commands, namely |\minifig| and
-% |\minitabl|. They prepare a material in a minipage and allow
+% |\minitabl|. They prepare a material in a mini-page and allow
% using the |\caption| command in the body. Their syntax is
% similar to the |\parbox| command:
% \begin{quote}
@@ -57,11 +82,11 @@
% |\minitabl|\oarg{pos}\oarg{height}\oarg{inner-pos}\marg{width}\marg{body}
% \end{quote}
% The \meta{pos} is a vertical alignment parameter for
-% minipage (|t|, |b|, or |c|) with respect to
-% surrounding text; the \meta{height} is a minipage height
+% mini-page (|t|, |b|, or |c|) with respect to
+% surrounding text; the \meta{height} is a mini-page height
% required; the \meta{inner-pos} is a vertical alignment
-% of text inside the minipage (|t|, |b|, |c|, or |s|);
-% and the \meta{width} is the minipage width.
+% of text inside the mini-page (|t|, |b|, |c|, or |s|);
+% and the \meta{width} is the mini-page width.
% The \meta{body} is prepared in the style specified by the
% |\FloatingStyle| command and can contain the |\caption| command inside.
%
@@ -87,17 +112,17 @@
% |\sidetabl|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{table}\marg{text}\\
% |\sidetabl*|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{table}\marg{text}
% \end{quote}
-% For simplicity, we further use the term \textit{minifloat\/} for the
+% We use the term \textit{mini-float} for the
% small illustrating material (figure or table), however
% taking into account that it is not a float at all. It is inserted in
% the main flow next to a paragraph box specified in the last
% parameter of above described commands.
%
-% The no-star forms of above described commands place a minifloat
+% The no-star forms of above described commands place a mini-float
% next to the specified text on the outer side of page (to the
% right for odd page and to the left for even page). In two-column
-% or one-side mode, minifloat is always posed to the right. The
-% star-forms provide the reverse placement. By default, minifloat
+% or one-side mode, mini-float is always posed to the right. The
+% star-forms provide the reverse placement. By default, mini-float
% is vertically centered with respect to the text and the
% |\strut| command is inserted at the beginning and at the end
% of the \meta{text} to provide normal baseline
@@ -107,14 +132,14 @@
% All parameters in square and round brackets are optional and mean
% the following:
% \begin{desclist}{}{}[\meta{pos}]
-% \item[\meta{pos}] specifies minifloat alignment (|t|,
+% \item[\meta{pos}] specifies mini-float alignment (|t|,
% |b|, or |c|; default is |c|) with respect to text
% box and can contain additional chars controlling the text body
% preparation: |j| means the last line of the text to be
% justified to the right and |n| means suppressing of struts
% insertion (they should be inserted manually if necessary);
%
-% \item[$w_1$] is the width of minifloat; and
+% \item[$w_1$] is the width of mini-float; and
%
% \item[$w_2$] is the width of the text box.
% \end{desclist}
@@ -123,16 +148,16 @@
% the width value is considered as a multiple of |\unitlength|
% (similarly to the use of length dimensions in the picture environment).
%
-% If both width parameters are absent, the widths are calculated as\linebreak
-% |(\linewidth-1.5em)/2|. If $w_2$ is absent, the text body
-% width is calculated as |\linewidth-|$w_1$|-1.5em|.
+% If both width parameters are absent, the width of both mini-float and
+% text body is calculated as |(\linewidth-1.5em)/2|. If $w_2$ is absent,
+% the text body width is calculated as |\linewidth-|$w_1$|-1.5em|.
%
% The placement of side-floats in the document consists in the following
% steps:
% \begin{enumerate}
% \item Decide where you want to insert a side-float;
% \item Insert a |\sidefig| or |\sidetabl| command after a word that finishes
-% the line before the future side-float position;
+% the line before the supposed side-float position;
% \item Specify a width of float in its parameter and set the top alignment
% as the \meta{pos} parameter (e.g.\ |\sidefig[t](|$w_1$|)|);
% \item Prepare the side-float in the first mandatory parameter of the command
@@ -142,24 +167,24 @@
% \item Find what part of the text is redundant in the \meta{text} parameter;
% \item Move it after the close brace;
% \item If the same paragraph continues after the close brace, add the |j|
-% letter to the \meta{pos} parameter. Also change the top alignment
-% to the centered alignment;
+% letter to the \meta{pos} parameter. Also change the |t| alignment
+% to |c| alignment in the \meta{pos} parameter;
% \item Translate the document once more;
% \item If the side-float has a wrong placement (this can appear when paragraph
% with a side-float begins at the end of page), insert the star after
-% the side-float command.
+% the side-float command and translate the document once more.
% \end{enumerate}
%
% \DescribeMacro{\ifleftsidefloat}
% While preparing a side-float, it is sometimes necessary to
-% provide conditional placement depending on the side a minifloat
+% provide conditional placement depending on the side a mini-float
% is posed. The command
% \begin{quote}
% |\ifleftsidefloat|\marg{left-clause}\marg{right-clause}
% \end{quote}
% provides this. It is useful in parameters of |\sidefig| or
% |\sidetabl| and processes \meta{left-clause} if the
-% minifloat is posed to the left and \meta{right-clause}
+% mini-float is posed to the left and \meta{right-clause}
% otherwise.
%
% Side-floats can be also used within floating environments to pos
@@ -188,7 +213,7 @@
%
% The |\fig| and |\tabl| commands envelop the |figure|
% and |table| environments respectively. Their star-forms
-% envelop corresponding starred |figure*| or |table*| environments.
+% envelop |figure*| or |table*| environments respectively.
%
% \section{Two Floating Figures or Tables Side by Side}
%
@@ -217,8 +242,30 @@
%
% In the |\tabls| command, boxes of the left and right bodies are
% top-aligned, but, in the |\figs| command, the bottom alignment is
-% used. The star-forms of this commands are based on the corresponding
-% starred |figure*| or |table*| environments.
+% used. The star-forms of this commands are based on the |figure*|
+% or |table*| environments respectively.
+%
+% \section{Declare a Mini-float and Service Commands}
+%
+% \DescribeMacro\newminifloat
+% If a new type of float is introduced, the respective mini-float
+% and service commands can be helpful for it. To prepare them, use
+% the following declaration:
+% \begin{quote}
+% |\newminifloat|\marg{gen}\marg{type}\marg{placement}\marg{pos}
+% \end{quote}
+% Here \meta{gen} is a root for command names to be generated, \meta{type}
+% is a float type, \meta{placement} is a default placement on the page,
+% and \meta{pos} is a vertical alignment for pair of floats.
+%
+% This command declares 4 commands: |\mini|\meta{gen}, |\side|\meta{gen},
+% |\|\meta{gen}, and |\|\meta{gen}|s|. For example, the commands
+% described in previous sections are declared as follows:
+% \begin{quote}
+% |\newminifloat{fig}{figure}{ht}{b}|\\
+% |\newminifloat{tabl}{table}{ht}{t}|
+% \end{quote}
+%
% \StopEventually{}
%
% \section{The Implementation}
@@ -230,31 +277,74 @@
\RequirePackage{nccboxes}[2002/03/20]
% \end{macrocode}
%
+% \subsection{Float Style}
+%
% \begin{macro}{\FloatStyle}
-% \begin{macro}{\minifig}
-% \begin{macro}{\minitabl}
-% At the first, we define the basic commands.
+% |\FloatStyle|\oarg{type}\marg{style} specifies a style for
+% a given float type.
% \begin{macrocode}
-\newcommand*{\FloatStyle}[1]{\def\NCC@fltstyle{#1}}
+\newcommand*{\FloatStyle}[2][]{%
+ \expandafter\def\csname NCC@fltstyle@#1\endcsname{#2}}
\@onlypreamble\FloatStyle
-\newcommand{\minifig}{\begingroup\def\@captype{figure}\NCC@minifloat}
-\newcommand{\minitabl}{\begingroup\def\@captype{table}\NCC@minifloat}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@setfltstyle}
+% |\NCC@setfltstyle|\marg{prefix} applies a style for a
+% float of |\@captype| type. While selection a style to be
+% applied it adds the given \meta{prefix} to the float type.
+% \begin{macrocode}
+\def\NCC@setfltstyle#1{%
+ \edef\@tempa{NCC@fltstyle@#1\@captype}%
+ \@ifundefined{\@tempa}{\NCC@fltstyle@}{\csname\@tempa\endcsname}%
+}
+% \end{macrocode}
+% We add this style with empty prefix to the |\@floatboxreset|
+% hook which is applied at the end of preamble of a float.
+% \begin{macrocode}
+\g@addto@macro\@floatboxreset{\NCC@setfltstyle{}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\normalfloatstyle}
+% Reset a float style to par-box formatting with normal font of the
+% normal size.
+% \begin{macrocode}
+\newcommand\normalfloatstyle{%
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \let\\\@normalcr
+ \reset@font \normalsize
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{The Kernel}
+%
+% \begin{macro}{\NCC@minifloat}
+% The base for mini-floats
+% \begin{quote}
+% |\NCC@minifloat|\oarg{pos}\oarg{height}\oarg{inner-pos}\marg{width}\marg{body}
+% \end{quote}
+% It finishes a mini-float with extra |\endgroup| command.
+% A |\@captype| should be specified before it.
+% \begin{macrocode}
\newcommand*\NCC@minifloat[1][c]{%
\@ifnextchar[{\NCC@mflt{#1}}{\NCC@@mflt{#1}\relax[s]}}
\def\NCC@mflt#1[#2]{%
\@ifnextchar[{\NCC@@mflt{#1}{#2}}{\NCC@mflt{#1}{#2}[#1]}}
\long\def\NCC@@mflt#1#2[#3]#4#5{%
- \@iiiminipage{#1}{#2}[#3]{#4}\normalfont
- \NCC@fltstyle #5\endminipage\endgroup
+ \@iiiminipage{#1}{#2}[#3]{#4}\normalfloatstyle
+ \NCC@setfltstyle{mini}#5\endminipage\endgroup
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \begin{macro}{\NCC@pair}
-% The |\NCC@pair|\marg{c1}\marg{c2}\marg{def-dist}\marg{def-place}|*|\oarg{place}|(|$w_1$|)(|$w_2$|)|
-% command executes \meta{c1}\marg{place}|{|$w_1$|}{|$w_2$|}| if star is absent or
+% The command
+% \begin{quote}
+% |\NCC@pair|\marg{c1}\marg{c2}\marg{def-dist}\marg{def-place}|*|\oarg{place}|(|$w_1$|)(|$w_2$|)|
+% \end{quote}
+% executes \meta{c1}\marg{place}|{|$w_1$|}{|$w_2$|}| if star is absent or
% \meta{c2}\marg{place}|{|$w_1$|}{|$w_2$|}| if star presents.
% Four first parameters are mandatory. Others a optional.
% The \meta{def-dist} parameter contains a default distance
@@ -275,15 +365,12 @@
%
% \begin{macro}{\NCC@setwidth}
% The |\NCC@setwidth|\marg{register}\marg{width} command sets
-% the given \meta{width} to the dimen \meta{register}. If units
+% the given \meta{width} for the \meta{register}. If units
% in \meta{width} are omitted, the |\unitlength| unit is used.
% In other words, if \meta{width} is a real number, it is considered
% as a multiple of |\unitlength|.
% \begin{macrocode}
-\def\NCC@setwidth#1#2{%
- \afterassignment\NCC@setwidth@#1#2\unitlength\relax
-}
-\def\NCC@setwidth@#1\relax{}
+\def\NCC@setwidth#1#2{\@defaultunits#1#2\unitlength\relax\@nnil}
% \end{macrocode}
% \end{macro}
%
@@ -315,8 +402,10 @@
% \end{macrocode}
% \end{macro}
%
+% \subsection{Side Floats}
+%
% \begin{macro}{\ifleftsidefloat}
-% This command is used in parameters of |\sidefig| or |\sidetabl|.
+% This command is used in parameters of side-floats.
% \begin{macrocode}
\newif\ifNCC@smfltleft
\newcommand{\ifleftsidefloat}{%
@@ -329,15 +418,22 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\sidefig}
-% \begin{macro}{\sidetabl}
+% \begin{macro}{\NCC@sidemfloat}
+% The command
+% \begin{quote}
+% |\NCC@sidemfloat|\marg{command}|*|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{mini-float}\marg{text}
+% \end{quote}
+% is used for preparing a side-float. The \meta{command} parameter
+% contains a |\mini|\meta{gen} command. The \meta{pos} parameter
+% specifies vertical alignment and additional flags. The
+% $w_1$ and $w_2$ parameters (if present) specify widthes of
+% \meta{mini-float} and \meta{text} boxes. Starred version
+% reverses the position of side-float and text boxes.
% The implementation of these commands is based
% on the |\NCC@pair| command that parses all optional
% parameters. Finally the |\NCC@smflt| command is
% executed.
% \begin{macrocode}
-\newcommand{\sidefig}{\NCC@sidemfloat{\minifig}}
-\newcommand{\sidetabl}{\NCC@sidemfloat{\minitabl}}
\def\NCC@sidemfloat#1{%
\NCC@smfltleftfalse
\if@twocolumn \else
@@ -352,16 +448,14 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\NCC@smflt}
-% The |\NCC@smflt|\marg{command}\marg{pos}|{|$w_1$|}{|$w_2$|}|\marg{minifloat}\marg{text}
-% prepares a side-float. The \meta{command} parameter contains
-% a |\minifig| or |\minitabl| command. The \meta{pos} parameter
-% specifies vertical alignment and additional flags. The
-% $w_1$ and $w_2$ parameters (if present) specify widthes of
-% \meta{minifloat} and \meta{text} boxes. The |\@tempdimc| register
-% contains the default distance between the minifloat and text.
+% The command
+% \begin{quote}
+% |\NCC@smflt|\marg{command}\marg{pos}|{|$w_1$|}{|$w_2$|}|\marg{mini-float}\marg{text}
+% \end{quote}
+% prepares a side-float. The |\@tempdimc| register
+% contains the default distance between the mini-float and text.
% \begin{macrocode}
\long\def\NCC@smflt#1#2#3#4#5#6{%
% \end{macrocode}
@@ -437,15 +531,19 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\fig}
-% \begin{macro}{\tabl}
-% The implementation of these commands is quite simple:
+% \subsection{Service Commands}
+%
+% \begin{macro}{\NCC@float}
+% The command
+% \begin{quote}
+% |\NCC@float|\marg{type}\marg{def-place}|*|\oarg{placement}|(|$w$|)|\marg{body}
+% \end{quote}
+% is the envelope for a mini-float inside a float. The \meta{def-place}
+% is the default placement specifier.
% \begin{macrocode}
-\newcommand{\fig}{\NCC@float{figure}}
-\newcommand{\tabl}{\NCC@float{table}}
-\def\NCC@float#1{\@ifstar{\NCC@flt{#1*}}{\NCC@flt{#1}}}
-\def\NCC@flt#1{\@ifnextchar[{\NCC@flt@{#1}}{\NCC@flt@{#1}[ht]}}
-\def\NCC@flt@#1[#2]{\begin{#1}[#2]\centering
+\def\NCC@float#1#2{\@ifstar{\NCC@flt{#1*}{#2}}{\NCC@flt{#1}{#2}}}
+\def\NCC@flt#1#2{\@ifnextchar[{\NCC@flt@{#1}}{\NCC@flt@{#1}[#2]}}
+\def\NCC@flt@#1[#2]{\begin{#1}[#2]\normalfloatstyle\centering
\@ifnextchar({\NCC@@flt{#1}}{\NCC@@flt{#1}()}}
\long\def\NCC@@flt#1(#2)#3{%
\if!#2!\@tempdima\linewidth \else \NCC@setwidth\@tempdima{#2}\fi
@@ -454,33 +552,37 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\figs}
-% \begin{macro}{\tabls}
-% The implementation of these commands is based
+% \begin{macro}{\NCC@floats}
+% The command
+% \begin{quote}
+% |\NCC@floats|\marg{type}\marg{pos}\marg{def-place}|*|\oarg{placement}|(|$w_1$|)(|$w_2$|)|\\
+% | |\marg{body1}\marg{body2}
+% \end{quote}
+% is the envelope for a pair of mini-floats inside a float. The implementation
+% of these commands is based
% on the |\NCC@pair| command that parses all optional
% parameters. Finally the |\NCC@flts| command is
% executed.
% \begin{macrocode}
-\newcommand{\figs}{\NCC@floats{figure}b}
-\newcommand{\tabls}{\NCC@floats{table}t}
-\def\NCC@floats#1#2{%
- \NCC@pair{\NCC@@flts{#1}{#2}}{\NCC@@flts{#1*}{#2}}{1em}{ht}}
+\def\NCC@floats#1#2#3{%
+ \NCC@pair{\NCC@@flts{#1}{#2}}{\NCC@@flts{#1*}{#2}}{1em}{#3}}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\NCC@flts}
-% The |\NCC@flts|\marg{env}\marg{pos}\marg{placement}|{|$w_1$|}{|$w_2$|}|\marg{body1}\marg{body2}
-% command prepares a pair of floats within \meta{env} environment.
-% The \meta{pos} contains relative alignment of floats.
+% The command
+% \begin{quote}
+% |\NCC@flts|\marg{type}\marg{pos}\marg{placement}|{|$w_1$|}{|$w_2$|}|\marg{body1}\marg{body2}
+% \end{quote}
+% prepares a pair of floats within \meta{type} environment.
+% The \meta{pos} contains relative vertical alignment of floats.
% The $w_1$ and $w_2$ parameters (if present) specify widthes of
% floats. The |\@tempdimc| register contains the default distance
% between floats.
% \begin{macrocode}
\long\def\NCC@@flts#1#2#3#4#5#6#7{%
- \begin{#1}[#3]\NCC@wcalc{#4}{#5}%
+ \begin{#1}[#3]\normalfloatstyle\NCC@wcalc{#4}{#5}%
\begingroup\NCC@minifloat[#2]\@tempdima{#6}%
\nobreak\hskip\@tempdimc
\begingroup\NCC@minifloat[#2]\@tempdimb{#7}%
@@ -489,9 +591,57 @@
% \end{macrocode}
% \end{macro}
%
-% Defaults:
+% \subsection{Declare a New Mini-float and Service Commands}
+%
+% \begin{macro}{\newminifloat}
+% The command
+% \begin{quote}
+% |\newminifloat|\marg{gen}\marg{type}\marg{def-place}\marg{pos}
+% \end{quote}
+% declares a new mini-float and 3 service commands.
+% \begin{macrocode}
+\newcommand*\newminifloat[4]{%
+ \edef\@tempa{%
+% \end{macrocode}
+% Prepare |\mini|\meta{gen} definition:
+% \begin{macrocode}
+ \noexpand\newcommand\expandafter\noexpand\csname mini#1\endcsname{%
+ \noexpand\begingroup\noexpand\def\noexpand\@captype{#2}%
+ \noexpand\NCC@minifloat}%
+% \end{macrocode}
+% Prepare |\side|\meta{gen} definition:
+% \begin{macrocode}
+ \noexpand\newcommand\expandafter\noexpand\csname side#1\endcsname{%
+ \noexpand\NCC@sidemfloat{%
+ \expandafter\noexpand\csname mini#1\endcsname}}%
+% \end{macrocode}
+% Prepare |\|\meta{gen} definition:
+% \begin{macrocode}
+ \noexpand\newcommand\expandafter\noexpand\csname #1\endcsname{%
+ \noexpand\NCC@float{#2}{#3}}%
+% \end{macrocode}
+% Prepare |\|\meta{gen}|s| definition:
+% \begin{macrocode}
+ \noexpand\newcommand\expandafter\noexpand\csname #1s\endcsname{%
+ \noexpand\NCC@floats{#2}{#4}{#3}}%
+ }%
+% \end{macrocode}
+% Define all commands:
+% \begin{macrocode}
+ \@tempa
+}
+\@onlypreamble\newminifloat
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Base Mini-floats and Defaults}
+%
% \begin{macrocode}
-\FloatStyle{\footnotesize\centering}
+\newminifloat{fig}{figure}{ht}{b}
+\newminifloat{tabl}{table}{ht}{t}
+\FloatStyle{}
+\FloatStyle[minifigure]{\footnotesize\centering}
+\FloatStyle[minitable]{\footnotesize\centering}
%</package>
% \end{macrocode}
\endinput
diff --git a/Master/texmf-dist/source/latex/ncctools/nccfoots.dtx b/Master/texmf-dist/source/latex/ncctools/nccfoots.dtx
index 29e2d82d251..c428928314b 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccfoots.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccfoots.dtx
@@ -11,6 +11,7 @@
% \changes{v1.2}{2005/02/03}{\NCC@makemark rename to \NCC@makefnmark}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccfoots}
\GetFileInfo{nccfoots.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccmath.dtx b/Master/texmf-dist/source/latex/ncctools/nccmath.dtx
index 78512699c7d..5007e8e92b4 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccmath.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccmath.dtx
@@ -18,6 +18,7 @@
% \changes{v1.2}{2005/02/21}{Avoid conflicts with the |array| package}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccmath,desclist}
\GetFileInfo{nccmath.sty}
@@ -41,6 +42,8 @@
% |equation| environment. All options are passed
% to the |amsmath| package.
%
+% \tableofcontents
+%
% \section{Improvement to the amsmath}
%
% \DescribeMacro{eqnarray}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccparskip.dtx b/Master/texmf-dist/source/latex/ncctools/nccparskip.dtx
index 24ac87568d3..dc340ce731e 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccparskip.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccparskip.dtx
@@ -11,6 +11,7 @@
% \changes{v1.1}{2004/12/08}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccparskip}
\SetParskip{6pt plus 1pt minus .4pt}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccpic.dtx b/Master/texmf-dist/source/latex/ncctools/nccpic.dtx
index 37cd498e7ed..0fd12072fcc 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccpic.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccpic.dtx
@@ -14,6 +14,7 @@
% \changes{v1.2}{2005/03/06}{Correct extension lists}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccpic,desclist}
\GetFileInfo{nccpic.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccrules.dtx b/Master/texmf-dist/source/latex/ncctools/nccrules.dtx
index 3e613426a5d..0542215c436 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccrules.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccrules.dtx
@@ -9,6 +9,7 @@
% \changes{v1.0}{2005/05/13}{This version was uploaded to CTAN}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccrules}
\newfootnoterule{starred}{\mboxfill[1.5\width][s]{$*$}}
@@ -37,6 +38,8 @@
% rule with an arbitrary contents and |\newfootnotedashrule| creates
% a footnote rule based on dash rule.
%
+% \tableofcontents
+%
% \section{User Interface}
%
% \subsection{Dash Rules}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccsect.dtx b/Master/texmf-dist/source/latex/ncctools/nccsect.dtx
index 980915c91a0..0729288c8ea 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccsect.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccsect.dtx
@@ -1,10 +1,10 @@
% \iffalse
%%
-%% File: nccsect.dtx Copyright (C) 2002--2005 by Alexander I. Rozhenko
+%% File: nccsect.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
%%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{nccsect}
-%<package> [2005/06/15 v1.3 Extended Section, Caption, and TOC Handling (NCC)]
+%<package> [2006/01/19 v1.5 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}
@@ -21,7 +21,7 @@
% \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/20}{Add |\StartFromTextArea| 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|}
@@ -29,15 +29,46 @@
% \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}
+% \changes{v1.4}{2005/12/26}{Conditionally define |\StartFromTextArea| and |\StartFromHeaderArea|}
+% \changes{v1.4}{2005/12/28}{|\sectionstyle| now has a |type| parameter}
+% \changes{v1.4}{2005/12/28}{New section styles: hangparindent, hangparindent*}
+% \changes{v1.4}{2005/12/28}{|\NCC@makechapfinal| hook introduced}
+% \changes{v1.4}{2005/12/28}{|\NCC@makeparttitle|, |\NCC@makechaptitle| hooks}
+% \changes{v1.4}{2005/12/28}{The scope of declarations in |\@svsec| is localized}
+% \changes{v1.4}{2005/12/28}{|\aftersectionvspace| introduced}
+% \changes{v1.4}{2005/12/29}{Add |\DeclarePart| and |\DeclareTOCPart| commands}
+% \changes{v1.4}{2005/12/30}{Make the package completely independent on standard commands}
+% \changes{v1.4}{2005/12/31}{Add more hooks and fix |\MakeUppercase| related bugs}
+% \changes{v1.4}{2006/01/01}{Introduce |\RunningSectionSuffux| command}
+% \changes{v1.4}{2006/01/01}{Introduce |\NCC@preparesectag| hook}
+% \changes{v1.4}{2006/01/01}{Remove |\NCC@defaultsectag| hook}
+% \changes{v1.4}{2006/01/01}{|\NCC@nexttocnum|, |\NCC@preparetocnum| hooks}
+% \changes{v1.4}{2006/01/03}{The |\norunningsuffix| modifier introduced}
+% \changes{v1.5}{2006/01/06}{Introduce |\SetTOCStyle| and |\ChapterPrefixStyle|}
+% \changes{v1.5}{2006/01/17}{Replace addtopackage to afterpackage}
+% \changes{v1.5}{2006/01/17}{Remove \protect before \numberline, because it is robust now}
+% \changes{v1.5}{2006/01/19}{Allow caption width be greater than a line width}
+% \changes{v1.5}{2006/01/19}{Compatibility with the xtab package added}
+% \changes{v1.5}{2006/01/19}{Add |\newplainsectionstyle|, |\newhangsectionstyle|}
+% \changes{v1.5}{2006/01/19}{Add |\adjustsectionmargins|}
+% \changes{v1.5}{2006/01/19}{Introduce |centerlast| section style}
+% \changes{v1.5}{2006/01/19}{Introduce |\sectiontagsuffix| command}
+% \changes{v1.5}{2006/01/19}{Introduce |\captiontagsuffix| command}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccsect,nccboxes,desclist}
\GetFileInfo{nccsect.sty}
+\newhangsectionstyle{margin}{2in}[r]{-2in}{0pt plus 1fil}
+\newhangsectionstyle{list}{1in}{0pt}{1in plus 1fil}
+\newplainsectionstyle{flushright}{0pt}[r]{1in plus 1fil}{0pt}
\begin{document}
\title{The \textsf{nccsect} package\thanks{This file
has version number \fileversion, last
- revised \filedate.}}
+ revised \filedate.}\ \thanks{Great thanks to Denis G. Samsonenko
+ \texttt{<d.g.samsonenko@gmail.com>} who proposed many significant
+ improvements to the package.}}
\author{Alexander I. Rozhenko\\rozhenko@oapmg.sscc.ru}
\date{\filedate}
\maketitle
@@ -46,16 +77,18 @@
%</driver>
% \fi
%
+% \tableofcontents
+%
% \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
+% The package provides a new implementation of sections, captions,
+% and toc-entries independent on the \LaTeX\ kernel. The reasons for this
% 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
+% with hang 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.
@@ -95,7 +128,7 @@
% 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
+% must depend on higher level skips. For example, if we
% change skips for a section entry, the skips for subsection entries
% should be adjusted automatically.
%
@@ -111,9 +144,9 @@
% 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.
+% \textit{display\/} or \textit{running\/} mode. Display section is
+% prepared as a separate justified paragraph having a hang indent if a
+% section has a number. Running section starts a paragraph.
% \begin{center}\catcode`|=12
% \small\tabcolsep=10pt
% \renewcommand\cboxstyle{\footnotesize}
@@ -127,8 +160,8 @@
% \cs{section} & 1 & display \\
% \cs{subsection} & 2 & display \\
% \cs{subsubsection} & 3 & display \\
-% \cs{paragraph} & 4 & run-in \\
-% \cs{subparagraph} & 5 & run-in \\
+% \cs{paragraph} & 4 & running \\
+% \cs{subparagraph} & 5 & running \\
% \hline
% \end{tabular}\footnotetext[1]{The \cs{part} command has zero level
% in article-like classes and has the negative level in book-like
@@ -138,15 +171,15 @@
% \end{center}
%
% \DescribeMacro\startsection
-% The package redefines all standard sectioning commands except
-% the |\part| command in the book-like class. Along with the
+% The package redefines all standard sectioning commands. 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
+% The \meta{level} is a level of section. A negative level produces
+% a part. 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
@@ -162,20 +195,48 @@
%
% \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.
+% The |\sectionstyle|\oarg{type}\marg{style} command allows change
+% a style of subsequent display sections of the given \meta{type}:
+% \begin{desclist}{\tt}{\quad}[subsubsection]\itemsep=0mm
+% \item[main] the section of zero level (|\part| or |\chapter|);
+% \item[section] the |\section|;
+% \item[subsection] the |\subsection|;
+% \item[subsubsection] the |\subsubsection|;
+% \item[paragraph] the |\paragraph|;
+% \item[subparagraph] the |\subparagraph|;
+% \item[section@vi] the section of 6th level, and so on.
+% \end{desclist}
+% If the \meta{type} parameter is omitted, the command acts on
+% all subsequent display sections expect those having a specialized style.
+% The following styles are predefined:
+% \begin{desclist}{\tt}{\quad}[hangparindent*]\itemsep=0mm
+% \item[hangindent] standard LaTeX style (default);
+% \item[hangindent*] the same as |hangindent|, but ragged right;
+% \item[parindent] title indented on |\parindent|;
+% \item[parindent*] the same as |parindent|, but ragged right;
+% \item[hangparindent] |\parindent| indented with hang number;
+% \item[hangparindent*] the same as |hangparindent|, but ragged right;
+% \item[center] centered title;
+% \item[centerlast] justified title without indent whose last line is 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.
%
+% \bigskip
+% \textbf{NOTE}: The section style acts on display sections that were
+% prepared with the dynamic alignment (see Section~\ref{s:decl}). By default,
+% the sections of levels from 0 to 3 have the dynamic alignment. The
+% section of zero level has no hang indentation.
+%
+% \bigskip
+% \DescribeMacro\sectiontagsuffix
+% The |\sectiontagsuffix|\oarg{type}\marg{style} command allows change
+% a suffix inserted after number tag for sections of the given \meta{type}.
+% If the \meta{type} parameter is omitted, the command acts on
+% all subsequent sections expect those having a specialized tag suffix.
+%
+% \bigskip
% \DescribeMacro\indentaftersection
% \DescribeMacro\noindentaftersection
% The paragraph indentation after a display section is controlled with
@@ -184,7 +245,39 @@
% 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
+% \DescribeMacro\aftersectionvspace
+% If a document contains two subsequent sectioning commands (for example,
+% |\section| and |\subsection|) the distance between their titles is
+% equal to the skip after the first sectioning command. Sometimes
+% it is necessary to insert another vertical space here. To override
+% the space inserted between sections, use the command
+% \begin{quote}
+% |\aftersectionvspace|\marg{distance}
+% \end{quote}
+% This command replaces the space inserted by a previous sectioning
+% command with the |\vspace|\marg{distance}. It works in the only case when
+% goes right after a command producing a display section. Otherwise, the
+% specified \meta{distance}
+% is ignored. The following example shows how to customize the
+% |\subsection| command in such a way that the distance between it and
+% a previous |\section| will be |3ex plus .5ex minus .2ex|:
+% \begin{quote}
+% |\renewcommand\subsection{%|\\
+% | \aftersectionvspace{3ex plus .5ex minus .2ex}%|\\
+% | \startsection{2}}|
+% \end{quote}
+%
+% \DescribeMacro\adjustsectionmargins
+% Margins of a display section can be adjusted using the command
+% \begin{quote}
+% |\adjustsectionmargins|\marg{left skip}\marg{right skip}
+% \end{quote}
+% The \meta{left skip} and \meta{right skip} are added to the left and
+% right margins of the subsequent section if it is a display section.
+% Otherwise, this command is ignored.
+%
+% \bigskip
+% \textbf{Modifiers.} 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.
@@ -192,29 +285,29 @@
% If the next sectioning command is starred, modifiers are ignored.
%
% \DescribeMacro\norunninghead
-% The |\norunninghead| command suppresses generation of running head for the
+% The |\norunninghead| modifier 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
+% The |\runninghead|\marg{running-title} modifier 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,
+% The |\noheadingtag| modifier 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
+% The |\headingtag|\marg{tag} modifier 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 |\headingtag*|\marg{tag} modifier 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.
%
@@ -236,65 +329,183 @@
% |\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
+% command. Its starred 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}\\
+% |\captiontagsuffix|\oarg{type}\marg{suffix}\\
% |\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
+% If \meta{type} is omitted and these commands appear out of float
+% environments, they are applied to all types.
+% A command without \meta{type} applied within a float environment
+% is considered as a command having the type of this environment. Typed
+% version of a command has a precedence before a non-typed one.
+%
+% \medskip\noindent
+% \DescribeMacro\captionstyle
+% specifies a style
% the caption text will be formatted:
-% \begin{desclist}{\tt}{}[centerlast]
+% \begin{desclist}{\tt}{\quad}[centerlast]\itemsep=0mm
% \item[default] standard \LaTeX's style,
-% \item[para] simple paragraph,
+% \item[para] simple paragraph without paragraph indent,
% \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
+%
+% \medskip\noindent
+% \DescribeMacro\captiontagstyle
+% specifies a position of caption tag:
+% \begin{desclist}{\tt}{\quad}[centerlast]\itemsep=0mm
+% \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:
+%
+% \medskip\noindent
+% \DescribeMacro\captiontagsuffix
+% specifies a suffix after caption tag.
+%
+% \medskip\noindent
+% \DescribeMacro\captionwidth
+% specifies a width of caption.
+%
+% \medskip\noindent
+% Defaults:
% \begin{quote}
% |\captionstyle{default}|\\
% |\captiontagstyle{para}|\\
+% |\captiontagsuffix{:\hspace{0.7em plus 0.2em minus 0.1em}}|\\
% |\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.
+% a |\figuremark{}| or |\tablemark{}| command.
%
-% \section{Declare Sections and Captions}
+% \bigskip
+% \DescribeMacro\SetTOCStyle
+% The |\SetTOCStyle|\marg{declarations} command allows customize
+% the table of contents and other content lists. For example, the declaration
+% \begin{quote}
+% |\SetTOCStyle{\small}|
+% \end{quote}
+% specifies that content lists will be prepared with the |\small| font.
+% This command is allowed in the preamble only.
+%
+% \DescribeMacro\ChapterPrefixStyle
+% The appearance of Chapter/Appendix prefix in a table of contents and
+% in a running head can be customized using the command
+% \begin{quote}
+% |\ChapterPrefixStyle|\marg{appearance list}
+% \end{quote}
+% The \meta{appearance list} can contain up to two words, namely
+% |header| and/or |toc|, delimited with a comma. Using them, you can
+% set a prefix-style for the header and/or the table of contents, respectively.
+% By default, the prefix-style is specified for the header only. This command
+% is allowed for book-like classes in which the |\chapter| command is
+% defined. It can be used in the preamble only.
+%
+% \section{Create New Section Styles}
+%
+% Along with 8 predefined section styles, you can easy create more styles.
+%
+% \DescribeMacro\newplainsectionstyle
+% The command
+% \begin{quote}
+% |\newplainsectionstyle|\marg{name}\marg{indent}\oarg{pos}\\
+% | |\marg{left skip}\marg{right skip}
+% \end{quote}
+% creates a new paragraph-like section style with the given \meta{name}.
+% It has the \meta{indent} paragraph indent
+% and margins specified with \meta{left skip} and \meta{right skip} lengths.
+% To prepare a centered style, the optional \meta{pos} parameter
+% should be equal to |[c]|. In this case, left and right margins must
+% have an additional |1fil| glue. If optional parameter is |[r]|, the
+% left margin must have an additional |1fil| glue.
+%
+% Four of predefined section styles are created using this command as follows:
+% \begin{quote}
+% |\newplainsectionstyle{parindent}{0pt}{\parindent}{0pt}|\\
+% |\newplainsectionstyle{parindent*}{0pt}{\parindent}{0pt plus 1fil}|\\
+% |\newplainsectionstyle{center}{0pt}[c]{0pt plus 1fil}{0pt plus 1fil}|\\
+% |\newplainsectionstyle{centerlast}{0pt}[c]{0pt plus 1fil}{0pt plus -1fil}|
+% \end{quote}
+%
+% \DescribeMacro\newhangsectionstyle
+% The command
+% \begin{quote}
+% |\newhangsectionstyle|\marg{name}\marg{min tag width}\oarg{pos}\\
+% | |\marg{left skip}\marg{right skip}
+% \end{quote}
+% creates a new hang-indented section style with the given \meta{name}.
+% The \meta{min tag width} length specifies a minimum width of the section
+% tag. If a width of section tag is less than this parameter value,
+% a white space will be inserted surround the tag to have the required
+% width. The method of inserting a white space is the same as in the
+% |\makebox| command. It is controlled with the optional \meta{pos}
+% parameter (|l|, |c|, or |r|; |l| default). Other parameters have
+% the same meaning as in the previous command.
+%
+% Four of predefined section styles are created using this command as follows:
+% \begin{quote}
+% |\newhangsectionstyle{hangindent}{0pt}{0pt}{0pt}|\\
+% |\newhangsectionstyle{hangindent*}{0pt}{0pt}{0pt plus 1fil}|\\
+% |\newhangsectionstyle{hangparindent}{0pt}{\parindent}{0pt}|\\
+% |\newhangsectionstyle{hangparindent*}{0pt}{\parindent}{0pt plus 1fil}|
+% \end{quote}
+%
+% The following examples shows possibilities of these commands:
+%
+% \skipwritingtoaux
+% \sectionstyle[subsection]{margin}
+% \subsection{This subsection was prepared in the margin style}
+%
+% The definition of the |margin| style is the following:
+% \begin{quote}
+% |\newhangsectionstyle{margin}{2in}[r]{-2in}{0pt plus 1fil}|
+% \end{quote}
+%
+% \skipwritingtoaux
+% \sectionstyle[subsection]{list}
+% \subsection{This subsection was prepared in the list style}
+%
+% The definition of the |list| style is the following:
+% \begin{quote}
+% |\newhangsectionstyle{list}{1in}{0pt}{1in plus 1fil}|
+% \end{quote}
+%
+% \skipwritingtoaux
+% \sectionstyle[subsection]{flushright}
+% \subsection{This subsection was prepared in the flushright style}
+%
+% The definition of the |flushright| style is the following:
+% \begin{quote}
+% |\newplainsectionstyle{flushright}{0pt}[r]{1in plus 1fil}{0pt}|
+% \end{quote}
+% \sectionstyle[subsection]{hangindent}
+%
+% \section{Declare Sections and Captions\label{s:decl}}
%
% \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}
+% |\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
@@ -319,7 +530,7 @@
% \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
+% the heading, else negative of skip to leave to right of running
% heading. The negative value is allowed for positive section levels
% only.
%
@@ -337,8 +548,8 @@
% 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}
+% |\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.
%
@@ -360,13 +571,13 @@
% \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
+% figure caption command produces |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
+% The |\SectionTagSuffix|\marg{suffix} command specifies a default suffix
% inserted after a section number tag. For example, the command
% \begin{quote}
% |\SectionTagSuffix{.\quad}|
@@ -375,12 +586,22 @@
% Sections of 0th level ignore this suffix. The default tag is |\quad|.
% The command can be used in the preamble only.
%
+% \DescribeMacro\RunningSectionSuffix
+% The |\RunningSectionSuffix|\marg{suffix} command specifies a suffix
+% inserted after a running section title right before the skip after
+% section. It can be used in the preamble only.
+% The default value is an empty suffix.
+%
+% \DescribeMacro\norunningsuffix
+% To remove the suffix after a running section, put the
+% |\norunningsuffix| modifier in the parameter of running section.
+%
% \DescribeMacro\CaptionTagSuffix
-% The |\CaptionTagSuffix|\marg{suffix} command specifies a suffix
+% The |\CaptionTagSuffix|\marg{suffix} command specifies a default 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}|
+% |\CaptionTagSuffix{:\hspace{0.7em plus 0.2em minus 0.1em}}|
% \end{quote}
%
% \section{Declare TOC-Entries}
@@ -400,7 +621,7 @@
% $-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|.
+% i.e., the toc-entry of 6th level is |\l@section@vi|.
%
% \item[\meta{action}] commands applied before entry is produced (usually empty).
%
@@ -409,7 +630,7 @@
% \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}.
+% \meta{style}|{|\meta{prefix}\meta{prototype}\meta{numberline-suffix}|}|
% \end{quote}
%
% \item[\meta{style}] commands to set a style. The last command in this argument
@@ -417,7 +638,8 @@
% 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.
+% uppercase entry. This style is applied to the number also and to the
+% page number.
% To apply different styles to the text of entry and to its page
% number, use in this parameter the command
% \begin{quote}
@@ -590,10 +812,108 @@
% |\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.
+% is the good practice.{\sloppy\par}
+%
+% \section{Declare Part}
+%
+% The |\part| command in book-like classes is the only sectioning command
+% that cannot be prepared with the |\DeclareSection| command. So, we add
+% special declarations to provide parts in books with features of other
+% sectioning commands.
+%
+% \DescribeMacro\DeclarePart
+% To redefine the |\part| in books, use the following declaration:
+% \begin{quote}
+% |\DeclarePart|\marg{before}\marg{after}\marg{prefix}\marg{style}
+% \end{quote}
+% \begin{desclist}{}{}[\meta{before}]
+% \item[\meta{before}] an action applied before a part at the beginning of
+% page. It usually specifies a vertical skip |\vfil| and a
+% paragraph style to be applied to the part number tag and title.
+% \item[\meta{after}] an action applied after the part. It usually contains
+% |\vfil| and page finishing commands.
+% \item[\meta{prefix}] a prefix inserted before a part tag. It contains
+% style commands to be applied to the tag and the |\vspace| command
+% specifying a distance between the part tag and title.
+% The |\partname| command goes right after the prefix.
+% \item[\meta{style}] a style to be applied to the part title. It can end
+% with |\MakeUppercase|.
+% \end{desclist}
+%
+% The default declaration of the |\part| is the following:
+% \begin{quote}
+% |\DeclarePart{\StartFromTextArea\vfil\centering}%|\\
+% | {\vfil\newpage \if@twoside\if@openright|\\
+% | \mbox{}\thispagestyle{empty}\newpage\fi\fi}%|\\
+% | {\vspace{4ex}\huge\bff}{\Huge\bff}|
+% \end{quote}
+% The |\StartFromTextArea| command prevents ignoring a vertical space
+% at the beginning of page. All paragraphs of part title are centered
+% horizontally using the |\centering| declaration, and the title
+% is centered vertically using |\vfil| commands
+% before and after it. A page after the part is made empty in two-side
+% mode if it is even. The space after the part tag is set to |4ex|.
+%
+% In Russian typesetting tradition, the part can be prepared in the
+% same manner as a chapter, i.e.\ a text going after a part is prepared
+% on the same page with the part title. It is easy to re-declare
+% the part in such style.
+% Let us start a part from the header and delimit it from the text
+% with a decorative line. The following declaration does this:
+% \begin{quote}
+% |\DeclarePart{\StartFromHeaderArea\centering}|\\
+% | {\vspace{2mm}\noindent\hrulefill\par|\\
+% | \addvspace{5mm}}|\\
+% | {\vspace{.5em}\LARGE\bff}{\Huge\bff}|
+% \end{quote}
+% But when a chapter goes right after a part, we need to place the part and
+% chapter titles together
+% on the same page. This can be applied using the |\beforechapter| hook:
+% \begin{quote}
+% |\beforechapter{\part|\marg{part title}|}|\\
+% |\chapter|\marg{chapter title}
+% \end{quote}
+% Modifiers stored in the parameter of |\beforechapter| hook will act on
+% the |\part| command. Modifiers outside of |\beforechapter| will act on
+% the |\chapter| command.
+%
+% \DescribeMacro\DeclareTOCPart
+% To produce a toc-entry command for a part, the following declaration is
+% specified for book-like classes:
+% \begin{quote}
+% |\DeclareTOCPart|\marg{action}\oarg{afterskip}\marg{prefix}\marg{prototype}\marg{style}
+% \end{quote}%
+% \begin{desclist}{}{}[\meta{afterskip}]
+% \item[\meta{action}] an action applied before the part toc-entry. It usually
+% a skip before part. It is recommended to prepare it with |\NCC@secskip|
+% command.
+% \item[\meta{afterskip}] a skip after this entry. If it is omitted,
+% the default |\NCC@runskip| value is applied after this entry.
+% \item[\meta{prefix}] a prefix inserted before a part tag (usually empty).
+% \item[\meta{prototype}] a prototype of part tag used for calculation the
+% hang indent in this entry.
+% \item[\meta{style}] a style applied to the whole text of entry and to
+% the page number. The |\MakeUppercase| is allowed to finish this
+% parameter. The |\applystyle| command can be used inside it to
+% apply different styles to the toc-entry and the page number.
+% \end{desclist}
+%
+% The default declaration of the part toc-entry is the following:
+% \begin{quote}
+% |\DeclareTOCPart{\NCC@secskip{4ex \@plus .2ex}%|\\
+% | \def\@dotsep{1000}}%|\\
+% | {}{\partname\ II}{\large\bff}|\\
+% \end{quote}
%
% \section{The Implementation}
%
+% The \textbf{afterpackage} package is used to add compatibility
+% commands.
+% \begin{macrocode}
+%<*package>
+\RequirePackage{afterpackage}
+% \end{macrocode}
+%
% \begin{macro}{\NCC@secskip}
% \begin{macro}{\NCC@runskip}
% The package shares the following commands with the
@@ -605,7 +925,6 @@
% 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
@@ -630,7 +949,7 @@
% \subsection{The Kernel}
%
% We start with declaring the section controls (modifiers):
-% \begin{desclist}{\tt}{\hfill}[NCC@nosecmark]\raggedright
+% \begin{desclist}{\tt}{\hfill}[NCC@secstartag]\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;
@@ -705,8 +1024,8 @@
% 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@makesectag}\marg{value}] produces a tag in |\@svsec|
+% 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
@@ -840,43 +1159,73 @@
% \end{macro}
%
% \begin{macro}{\SectionTagSuffix}
-% The |\SectionTagSuffix|\marg{suffix} sets a suffix after a section tag:
+% The |\SectionTagSuffix|\marg{suffix} sets a default 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{macro}{\sectiontagsuffix}
+% |\sectiontagsuffix|\oarg{type}\marg{suffix} changes a suffix after section
+% tag that will be used for sections of the given
+% \meta{type}. If \meta{type} is omitted, the specified suffix will be used
+% in text flow for all sections having no special suffix.
% \begin{macrocode}
-\def\NCC@makesectag@default#1{#1\NCC@asecnum}
-\def\NCC@defaultsectag{\let\NCC@makesectag\NCC@makesectag@default}
-\NCC@defaultsectag
+\newcommand*\sectiontagsuffix[2][]{%
+ \expandafter\def\csname NCC@asecnum@#1\endcsname{\def\NCC@asecnum{#2}}%
+}
+\let\NCC@asecnum@\@empty
+\def\NCC@setsectionsuffix#1{%
+ \edef\@tempa{NCC@asecnum@\NCC@secname{#1}}%
+ \@ifundefined{\@tempa}{%
+ \let\NCC@asecnumset\NCC@asecnum@
+ }{%
+ \expandafter\let\expandafter\NCC@asecnumset\csname\@tempa\endcsname
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RunningSectionSuffix}
+% The |\RunningSectionSuffix|\marg{suffix} sets a suffix after a title
+% of a running section:
+% \begin{macrocode}
+\newcommand*{\RunningSectionSuffix}[1]{\def\NCC@asectitle{\unskip#1}}
+\@onlypreamble\RunningSectionSuffix
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@preparesectag}
+% The |\NCC@preparesectag|\marg{style}\marg{before} hook prepares the
+% |\NCC@makesectag| command:
+% \begin{macrocode}
+\def\NCC@preparesectag#1#2{\def\NCC@makesectag##1{#1#2##1\NCC@asecnum}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NCC@secname}
% The |\NCC@secname|\marg{level} command generates section name
-% (|section|,\linebreak |subsection|, \ldots,
+% (|main|, |section|, |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.
+% command, in the declarations of toc-entries, and in the style
+% selection command.
% \begin{macrocode}
\def\NCC@secname#1{%
- \ifcase#1\relax \or section\or subsection\or subsubsection\or
+ \ifcase#1main\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{macro}{\NCC@startsection}
+% The |\NCC@startsection| command
+% has the same syntax as its non-NCC prototype:
% \begin{quote}
-% |\@startsection|\marg{type}\marg{level}\marg{indent}\marg{beforeskip}\\
-% | |\marg{afterskip}\marg{style}
+% |\NCC@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
@@ -884,18 +1233,18 @@
% But we change this mode using |\indentaftersection| and
% |\noindentaftersection| macros.
% \begin{macrocode}
-\def\@startsection#1#2#3#4#5#6{%
+\def\NCC@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}}%
+ \secdef{\NCC@sect{#1}{#2}{#3}{#4}{#5}{#6}}{\NCC@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
+% The interface of |\NCC@ssect| and |\NCC@sect| commands is similar to their
+% \LaTeX's prototypes. They are based on the following
% command:
% \begin{quote}
% |\NCC@makesec|\marg{indent}\marg{style}\marg{heading}\marg{afterskip}\marg{action}
@@ -903,47 +1252,41 @@
% 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.
+% One of them should be selected before applying the |\NCC@ssect| and |\NCC@sect|
+% commands.
% \end{macro}
%
-% \begin{macro}{\@ssect}
+% \begin{macro}{\NCC@ssect}
% The starred form of section:
% \begin{quote}
-% |\@ssect|\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{heading}
+% |\NCC@ssect|\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{heading}
% \end{quote}
% \begin{macrocode}
-\def\@ssect#1#2#3#4#5{%
+\def\NCC@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}
+% \begin{macro}{\NCC@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}
+% |\NCC@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@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}%
+ \numberline{\csname the#1\endcsname}%
\fi
#7%
}%
}%
- \let\NCC@makesec\NCC@makesect
- \NCC@defaultsectag
}
% \end{macrocode}
% \end{macro}
@@ -958,46 +1301,211 @@
\@tempskipa #4\relax
\ifdim \@tempskipa>\z@
\begingroup \normalfont
- #2{\@hangfrom{\hskip #1\relax\@svsec}%
- \interlinepenalty \@M\ignorespaces #3\@@par}%
+ \NCC@asecnumset
+% \end{macrocode}
+% The |\NCC@secttitle|\marg{style}\marg{tag}\marg{title} hook prepares
+% traditional display section:
+% \begin{macrocode}
+ \NCC@secttitle{#2}{\NCC@hangfrom{\hskip #1\relax\@svsec}}%
+ {\interlinepenalty \@M\ignorespaces #3\@@par}
\endgroup
#5%
\else
- \def\@svsechd{{\normalfont #2{\hskip #1\relax
- \@svsec\ignorespaces #3}}#5}%
+% \end{macrocode}
+% The |\NCC@secptitle|\marg{style}\marg{tag}\marg{title} hook prepares
+% running section. The |\norunningsuffix| modifier applied in the
+% parameter of running section removes a suffix after section title.
+% \begin{macrocode}
+ \def\@svsechd{{\normalfont
+ \NCC@asecnumset
+ \def\norunningsuffix{\protect\NCC@nosecsuffix}%
+ \NCC@secptitle{#2}{\hskip #1\relax{\@svsec}}%
+ {\ignorespaces #3\NCC@asectitle}#5}}%
\fi
\@xsect{#4}%
}
-\let\NCC@makesec\NCC@makesect
+\def\NCC@secttitle#1#2#3{#1{#2#3}}
+\def\NCC@secptitle#1#2#3{#1{#2#3}}
+\newcommand*\norunningsuffix{}
+\def\NCC@nosecsuffix{\let\NCC@asectitle\@empty}
% \end{macrocode}
% \end{macro}
%
-% \subsection{Make Sections with Dynamic Control}
+% \subsection{Create Section Styles}
+%
+% \begin{macro}{\NCC@hangfrom}
+% |\NCC@hangfrom|\marg{section tag} works as
+% the \LaTeX's |\@hangfrom| command, but its margins can be adjusted
+% with the |\adjustsectionmargins| command.
+% \begin{macrocode}
+\def\NCC@hangfrom{%
+ \NCC@setsecmargins{\z@skip}{\z@skip}\NCC@hangsecstyle{\z@}{}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@setsecmargins}
+% |\NCC@setsecmargins|\marg{left skip}\marg{right skip} sets
+% section margins and applies the hook that can be defined by the
+% |\adjustsectionmargins| command.
+% \begin{macrocode}
+\def\NCC@setsecmargins#1#2{%
+ \leftskip\z@skip \rightskip\z@skip
+ \parfillskip\@flushglue
+ \let\\\@normalcr
+ \NCC@adjsecmargins{#1}{#2}%
+ \NCC@secmarginshook
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@adjsecmargins}
+% |\NCC@adjsecmargins|\marg{left skip}\marg{right skip} adjusts
+% section margins. The |\parfillskip| value is also adjusted to
+% a difference between stretchabilities of the \meta{left skip}
+% and the \meta{right skip}. Using this trick, we can easy specify
+% the |centerlast| style just setting the stretchability of the
+% \meta{right skip} as a negation of the \meta{left skip} stretchability.
+% To extract a stretchability from a skip, we simply add it multiplied
+% by |-1| (while multiplication the stretchability is removed!).
+% \begin{macrocode}
+\def\NCC@adjsecmargins#1#2{%
+ \setlength\@tempskipa{#1}\advance\leftskip\@tempskipa
+ \setlength\@tempskipb{#2}\advance\rightskip\@tempskipb
+ \advance\@tempskipa -1\@tempskipa \advance\@tempskipb -1\@tempskipb
+ \advance\@tempskipa -\@tempskipb \advance\parfillskip\@tempskipa
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@hangsecstyle}
+% |\NCC@hangsecstyle|\marg{min tag width}\marg{pos}\marg{section tag}
+% starts a hang paragraph and prints its tag. The \meta{min tag width}
+% specifies a minimum width of hang indent and \meta{pos} specifies
+% an alignment of \meta{section tag} (|l|, |c|, |r|) if its width
+% is less than the minimum width.
+% \begin{macrocode}
+\def\NCC@hangsecstyle#1#2#3{%
+ \setlength\@tempdima{#1}%
+ \setbox\@tempboxa\hbox{#3}%
+ \ifdim \wd\@tempboxa > \@tempdima
+ \hangindent\wd\@tempboxa \noindent \box\@tempboxa
+ \else
+ \hangindent\@tempdima
+ \noindent \makebox[\@tempdima][#2]{\unhbox\@tempboxa}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\adjustsectionmargins}
+% |\adjustsectionmargins|\marg{left skip}\marg{right skip}
+% defines the |\NCC@secmarginshook| macro to be applied after
+% margins are set. To be sure this hook will be applied only once,
+% we release it in the |\NCC@sec@reset@controls| hook.
+% \begin{macrocode}
+\newcommand*\adjustsectionmargins[2]{%
+ \NCC@global\def\NCC@secmarginshook{\NCC@adjsecmargins{#1}{#2}}
+}
+\g@addto@macro\NCC@sec@reset@controls{%
+ \NCC@global\let\NCC@secmarginshook\@empty
+}
+\let\NCC@secmarginshook\@empty
+% \end{macrocode}
+% \end{macro}
%
% \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.
+% preparing a heading. All section style commands redefine this hook.
% \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{macro}{\newplainsectionstyle}
+% |\newplainsectionstyle|\marg{name}\marg{indent}\oarg{pos}\marg{left skip}\marg{right skip}
% \begin{macrocode}
-\newcommand*{\sectionstyle}[1]{%
- \@ifundefined{NCC@sec@#1}%
- {\PackageError{nccsect}{Unknown section style `#1'}{}}%
- {\csname NCC@sec@#1\endcsname}%
+\newcommand*\newplainsectionstyle[2]{%
+ \@ifnextchar[{\NCC@newplainsec{#1}{#2}}{\NCC@newplainsec{#1}{#2}[l]}%
}
-\def\NCC@sec@hangindent{\def\NCC@sec##1{\@hangfrom{##1}}}
-\@namedef{NCC@sec@hangindent*}{%
- \def\NCC@sec##1{\@hangfrom{##1}\rightskip\@flushglue}%
+\def\NCC@newplainsec#1#2[#3]#4#5{%
+ \def\@tempa{#3}\def\@tempb{c}%
+ \ifx\@tempa\@tempb
+ \expandafter\newcommand\csname NCC@sec@#1\endcsname
+ {\def\NCC@sec{\NCC@setsecmargins{#4}{#5}%
+ \let\\\@centercr \advance\parfillskip -\@flushglue
+ \setlength\parindent{#2}}}%
+ \else
+ \def\@tempb{r}%
+ \ifx\@tempa\@tempb
+ \expandafter\newcommand\csname NCC@sec@#1\endcsname
+ {\def\NCC@sec{\NCC@setsecmargins{#4}{#5}%
+ \let\\\@centercr \advance\parfillskip -\@flushglue
+ \advance\parfillskip -\@flushglue
+ \setlength\parindent{#2}}}%
+ \else
+ \expandafter\newcommand\csname NCC@sec@#1\endcsname
+ {\def\NCC@sec{\NCC@setsecmargins{#4}{#5}\setlength\parindent{#2}}}%
+ \fi
+ \fi
}
-\def\NCC@sec@parindent{\def\NCC@sec##1{\@hangfrom\indent##1}}
-\@namedef{NCC@sec@parindent*}{%
- \def\NCC@sec##1{\@hangfrom\indent\rightskip\@flushglue##1}%
+\@onlypreamble\newplainsectionstyle
+\@onlypreamble\NCC@newplainsec
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newhangsectionstyle}
+% |\newhangsectionstyle|\marg{name}\marg{min tag width}\oarg{pos}\marg{left skip}\marg{right skip}
+% \begin{macrocode}
+\newcommand*\newhangsectionstyle[2]{%
+ \@ifnextchar[{\NCC@newhangsec{#1}{#2}}{\NCC@newhangsec{#1}{#2}[l]}%
+}
+\def\NCC@newhangsec#1#2[#3]#4#5{%
+ \expandafter\newcommand\csname NCC@sec@#1\endcsname
+ {\def\NCC@sec{\NCC@setsecmargins{#4}{#5}\NCC@hangsecstyle{#2}{#3}}}%
+}
+\@onlypreamble\newhangsectionstyle
+\@onlypreamble\NCC@newhangsec
+% \end{macrocode}
+% \end{macro}
+%
+% Specify predefined section styles. The |\@flushglue| is equal to |0pt plus 1fil|.
+% \begin{macrocode}
+\newhangsectionstyle{hangindent}{\z@}{\z@skip}{\z@skip}
+\newhangsectionstyle{hangindent*}{\z@}{\z@skip}{\@flushglue}
+\newhangsectionstyle{hangparindent}{\z@}{\parindent}{\z@skip}
+\newhangsectionstyle{hangparindent*}{\z@}{\parindent}{\@flushglue}
+\newplainsectionstyle{parindent}{\z@}{\parindent}{\z@skip}
+\newplainsectionstyle{parindent*}{\z@}{\parindent}{\@flushglue}
+\newplainsectionstyle{center}{\z@}[c]{\@flushglue}{\@flushglue}
+\newplainsectionstyle{centerlast}{\z@}[c]{\@flushglue}{-\@flushglue}
+% \end{macrocode}
+%
+% \subsection{Make Sections with Dynamic Control}
+%
+% \begin{macro}{\sectionstyle}
+% The |\sectionstyle|\oarg{type}\marg{style} changes a style
+% for display sections of the given \meta{type}.
+% \begin{macrocode}
+\newcommand*{\sectionstyle}[2][]{%
+ \@ifundefined{NCC@sec@#2}{%
+ \PackageError{nccsect}{Unknown section style `#2'}{}%
+ }{%
+ \expandafter\def\csname NCC@secstyle@#1\endcsname{%
+ \csname NCC@sec@#2\endcsname
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@setsectionstyle}
+% The |\NCC@setsectionstyle|\marg{level} set a style for the
+% given section level. If a style for the given level is
+% undefined, the default style is selected.
+% \begin{macrocode}
+\def\NCC@setsectionstyle#1{%
+ \edef\@tempa{NCC@secstyle@\NCC@secname{#1}}%
+ \@ifundefined{\@tempa}{\NCC@secstyle@}{\csname\@tempa\endcsname}%
}
-\def\NCC@sec@center{\def\NCC@sec##1{\centering##1}}
% \end{macrocode}
% \end{macro}
%
@@ -1010,15 +1518,30 @@
% \begin{macrocode}
\def\NCC@makesecx#1#2#3#4#5{%
\begingroup\normalfont
- #2{\NCC@sec{\@svsec}\interlinepenalty \@M\ignorespaces #3\@@par}%
+ \NCC@asecnumset
+% \end{macrocode}
+% The |\NCC@secxtitle|\marg{style}\marg{tag}\marg{title} hook prepares
+% display section with dynamic control. The |\NCC@sec| macro is protected
+% to prevent its expansion by |\MakeUppercase|.
+% \begin{macrocode}
+ \NCC@secxtitle{#2}{\protect\NCC@sec{\@svsec}}
+ {\interlinepenalty \@M\ignorespaces #3\@@par}%
\endgroup #5%
\par \nobreak \vskip #4\relax \@afterheading \ignorespaces
}
+\def\NCC@secxtitle#1#2#3{#1{#2#3}}
% \end{macrocode}
% \end{macro}
%
% \subsection{Make the Main Section}
%
+% \begin{macro}{\partmark}
+% Define the |\partmark| if it is undefined yet.
+% \begin{macrocode}
+\providecommand*\partmark[1]{\markboth{}{}}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\NCC@startmainsec}
% The main section is a section of zero level.
% It is prepared with the following command:
@@ -1036,42 +1559,40 @@
% 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@preparesectag{\leavevmode#2}{\partname\nobreakspace}%
\NCC@secskip{#3}%
- \secdef{\@part{#1}{#4}{#5}}{\@spart{#1}{#4}{#5}}%
+ \secdef{\NCC@part{#1}{#4}{#5}}{\NCC@spart{#1}{#4}{#5}}%
}
% \end{macrocode}
%
-% \begin{macro}{\@spart}
+% \begin{macro}{\NCC@spart}
% Prepare the starred version of part:
% \begin{quote}
-% |\@spart|\marg{alignment}\marg{afterskip}\marg{style}\marg{heading}
+% |\NCC@spart|\marg{alignment}\marg{afterskip}\marg{style}\marg{heading}
% \end{quote}
% \begin{macrocode}
- \def\@spart#1#2#3#4{%
+ \def\NCC@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}
+% \begin{macro}{\NCC@part}
% Prepare the non-starred version of part:
% \begin{quote}
-% |\@part|\marg{alignment}\marg{afterskip}\marg{style}\oarg{toc-entry}\marg{heading}
+% |\NCC@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@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
+ \ifnum \c@secnumdepth>\m@ne \numberline{\thepart}\fi
#4%
}%
}%
- \NCC@defaultsectag
}
% \end{macrocode}
% \end{macro}
@@ -1085,18 +1606,36 @@
% \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}%
+ \NCC@asecnumset
+ \NCC@makeparttitle{#1}{#2}{#3}%
\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{macro}{\NCC@makeparttitle}
+% This command makes a part title itself. The |\NCC@secmain| hook contains
+% the dynamic alignment style or nothing.
+% \begin{quote}
+% |\NCC@makeparttitle|\marg{alignment}\marg{style}\marg{heading}
+% \end{quote}
+% \begin{macrocode}
+ \def\NCC@makeparttitle#1#2#3{%
+ \ifx\@svsec\@empty \else
+ \NCC@secmain#1{\let\NCC@asecnum\@empty\@svsec\@@par}\nobreak
+ \fi
+ \interlinepenalty \@M \NCC@secmain#1{#2{#3\@@par}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@partsection}
+% Define the |\NCC@partsection| to be equal to the |\NCC@mainsection| command
+% which will be specified later when a main section will be declared.
% \begin{macrocode}
- \providecommand*\partmark[1]{\markboth{}{}}
+ \def\NCC@partsection{\NCC@mainsection}
}{
% \end{macrocode}
% \end{macro}
@@ -1105,69 +1644,67 @@
% \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}}%
+ \NCC@preparesectag{\leavevmode#2}{\@chapapp\nobreakspace}%
+ \secdef{\NCC@chapter{#1}{#3}{#4}{#5}}{\NCC@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{macro}{\NCC@startchap}
+% The start chapter hook:
% \begin{macrocode}
- \newcommand\beforechapter[1]{\gdef\NCC@beforechapter{#1}}
- \beforechapter{}
+ \def\NCC@startchap{%
+ \if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{plain}\global\@topnum\z@
+ }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@schapter}
+% \begin{macro}{\NCC@schapter}
% Prepare the starred version of chapter:
% \begin{quote}
-% |\@schapter|\marg{alignment}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{heading}
+% |\NCC@schapter|\marg{alignment}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{heading}
% \end{quote}
% \begin{macrocode}
- \def\@schapter#1#2#3#4#5{%
+ \def\NCC@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}
+% \begin{macro}{\NCC@chapter}
% Prepare the non-starred version of chapter:
% \begin{quote}
-% |\@chapter|\marg{alignment}\marg{beforeskip}\marg{afterskip}\marg{style}\\
-% | |\oarg{toc-entry}\marg{heading}
+% |\NCC@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{%
+ \def\NCC@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
+ \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{macro}{\beforechapter}
+% The |\beforechapter|\marg{something} hook is applied to the nearest
+% chapter. An empty value of its parameter means no hook.
% \begin{macrocode}
- \def\NCC@startchap{%
- \if@openright\cleardoublepage\else\clearpage\fi
- \thispagestyle{plain}\global\@topnum\z@
- }
+ \newcommand\beforechapter[1]{\gdef\NCC@beforechapter{#1}}
+ \beforechapter{}
% \end{macrocode}
% \end{macro}
%
@@ -1193,13 +1730,36 @@
\else
\NCC@makechaphead{#1}{#2}{#3}{#4}{#5}%
\fi
- #6%
+ \NCC@makechapfinal{#6}%
\@afterheading
\ignorespaces
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\NCC@makechapfinal}
+% \begin{macro}{\NCC@makechapfinalgobble}
+% The |\NCC@makechapfinal| hook applies a final action which can contain the
+% |\chaptermark| command. Its default value is to put the parameter as is.
+% If you let this command to be equal to the |\NCC@makechapfinalgobble|, the
+% chapter mark will contain no chapter name.
+% \begin{macrocode}
+ \let\NCC@makechapfinal\@firstofone
+ \def\NCC@makechapfinalgobble#1{%
+ \let\NCC@makechapmark\NCC@makemark
+ \def\NCC@makemark{%
+ \let\NCC@temp\@chapapp
+ \let\@chapapp\@gobble
+ \NCC@makechapmark
+ \let\@chapapp\NCC@temp
+ }%
+ #1%
+ }
+ \@onlypreamble\NCC@makechapfinalgobble
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\NCC@makechaphead}
% This command makes a chapter head:
% \begin{quote}
@@ -1209,7 +1769,7 @@
% \begin{macrocode}
\def\NCC@makechaphead#1#2#3#4#5{%
\ifx\NCC@beforechapter\@empty
- \StartFromTextArea \vspace{#2}%
+ \StartFromTextArea \vskip #2%
\else
\begingroup
\@twocolumnfalse
@@ -1220,14 +1780,31 @@
\beforechapter{}%
\fi
\begingroup \normalfont
- \ifx\@svsec\@empty \else #1{\@svsec\@@par}\fi
- \interlinepenalty \@M #1{#3{#4}\@@par}%
+ \NCC@asecnumset
+ \NCC@makechaptitle{#1}{#3}{#4}%
\endgroup
\par\nobreak \vskip #5\relax
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\NCC@makechaptitle}
+% This command makes a chapter title itself:
+% \begin{quote}
+% |\NCC@makechaptitle|\marg{alignment}\marg{style}\marg{heading}
+% \end{quote}
+% The |\NCC@secmain| hook contains the dynamic alignment style
+% or nothing.
+% \begin{macrocode}
+ \def\NCC@makechaptitle#1#2#3{%
+ \ifx\@svsec\@empty \else
+ \NCC@secmain#1{\let\NCC@asecnum\@empty\@svsec\@@par}%
+ \fi
+ \interlinepenalty \@M \NCC@secmain#1{#2{#3\@@par}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\epigraph}
% \begin{macro}{\epigraphparameters}
% \begin{quote}
@@ -1268,23 +1845,144 @@
\leavevmode\box\@tempboxa
\@end@tempboxa
}
-}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
+% \subsection{Make Part in Book-like Classes}
+%
+% \begin{macro}{\NCC@startpart}
+% The start-part hook:
+% \begin{macrocode}
+ \def\NCC@startpart{%
+ \if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{plain}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@spart}
+% Prepare the starred version of part:
+% \begin{quote}
+% |\NCC@spart|\marg{before}\marg{after}\marg{style}\marg{heading}
+% \end{quote}
+% \begin{macrocode}
+ \def\NCC@spart#1#2#3#4{%
+ \let\@svsec\@empty
+ \NCC@makepart{#1}{#3}{#4}{#2}{}%
+ \NCC@sec@reset@controls
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@part}
+% Prepare the non-starred version of part:
+% \begin{quote}
+% |\NCC@part|\marg{before}\marg{after}\marg{style}\oarg{toc-entry}\marg{heading}
+% \end{quote}
+% \begin{macrocode}
+ \def\NCC@part#1#2#3[#4]#5{%
+ \def\NCC@make{\NCC@makepart{#1}{#3}{#5}{#2}}%
+ \NCC@makesection{part}{\m@ne}{#4}{%
+ \addcontentsline{toc}{part}{%
+ \ifnum \c@secnumdepth>-2
+ \numberline{\NCC@thetocpart}\fi
+ #4%
+ }%
+ }%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@thetocpart}
+% The following hook allows redefine the appearance of part name
+% in the TOC:
+% \begin{macrocode}
+ \def\NCC@thetocpart{\thepart}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@makepart}
+% This command makes a part:
+% \begin{quote}
+% |\NCC@makepart|\marg{before}\marg{style}\marg{heading}\marg{after}\marg{action}
+% \end{quote}
+% The |\@svsec| is either |\@empty| or contains a part tag.
+% \begin{macrocode}
+ \def\NCC@makepart#1#2#3#4#5{%
+ \if@twocolumn \onecolumn \@tempswatrue \else \@tempswafalse \fi
+ \begingroup\normalfont
+ \NCC@asecnum@
+ \NCC@makeparttitle{#1}{#2}{#3}%
+ \endgroup
+ \NCC@makepartfinal{#5}#4%
+ \if@tempswa \twocolumn \fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@makepartfinal}
+% \begin{macro}{\NCC@makepartfinalgobble}
+% The |\NCC@makepartfinal| hook applies a final action which can contain the
+% |\partmark| command. Its default value is to put the parameter as is.
+% If you let this command to be equal to the |\NCC@makepartfinalgobble|, the
+% chapter mark will contain no chapter name.
+% \begin{macrocode}
+ \let\NCC@makepartfinal\@firstofone
+ \def\NCC@makepartfinalgobble#1{%
+ \let\NCC@makepartmark\NCC@makemark
+ \def\NCC@makemark{%
+ \let\NCC@temp\partname
+ \let\partname\@gobble
+ \NCC@makepartmark
+ \let\partname\NCC@temp
+ }%
+ #1%
+ }
+ \@onlypreamble\NCC@makepartfinalgobble
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\NCC@makeparttitle}
+% This command makes a part title itself:
+% \begin{quote}
+% |\NCC@makeparttitle|\marg{before}\marg{style}\marg{heading}
+% \end{quote}
+% \begin{macrocode}
+ \def\NCC@makeparttitle#1#2#3{#1%
+ \ifx\@svsec\@empty \else
+ {\let\NCC@asecnum\@empty\@svsec\@@par}\nobreak \fi
+ \interlinepenalty \@M #2{#3\@@par}
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Make Captions}
%
% \begin{macro}{\CaptionTagSuffix}
-% The |\CaptionTagSuffix|\marg{suffix} sets a suffix after a caption tag:
+% |\CaptionTagSuffix|\marg{suffix} sets a default suffix after caption tag:
% \begin{macrocode}
\newcommand*{\CaptionTagSuffix}[1]{\def\NCC@acapnum{#1}}
\@onlypreamble\CaptionTagSuffix
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\captiontagsuffix}
+% |\captiontagsuffix|\oarg{type}\marg{suffix} changes a suffix after caption
+% tag.
+% \begin{macrocode}
+\newcommand*\captiontagsuffix[2][]{%
+ \NCC@prepare@capkey{suffix}{#1}{\def\NCC@acapnum{#2}}%
+}
+\let\NCC@capsuffix@\@empty
+% \end{macrocode}
+% \end{macro}
+
+%
% \begin{macro}{\captionstyle}
-% The |\captionstyle|\oarg{type}\marg{style} selects a style to be applied
+% |\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}
@@ -1295,7 +1993,7 @@
% \end{macro}
%
% \begin{macro}{\captiontagstyle}
-% The |\captiontagstyle|\oarg{type}\marg{style} selects a style of caption tag:
+% |\captiontagstyle|\oarg{type}\marg{style} selects a style of caption tag:
% |right| or |para|.
% \begin{macrocode}
\newcommand*\captiontagstyle[1][]{%
@@ -1305,11 +2003,11 @@
% \end{macro}
%
% \begin{macro}{\captionwidth}
-% The |\captionwidth|\oarg{type}\marg{length} specifies a caption width.
-% Default width is |\linewidth|.
+% The |\captionwidth|\oarg{type}\marg{length} specifies a caption width
+% in |\@tempdima|. Default width is |\linewidth|.
% \begin{macrocode}
\newcommand*\captionwidth[2][]{%
- \NCC@prepare@capkey{width}{#1}{\setlength{\hsize}{#2}}%
+ \NCC@prepare@capkey{width}{#1}{\setlength{\@tempdima}{#2}}%
}
% \end{macrocode}
% \end{macro}
@@ -1377,7 +2075,6 @@
\let\@svsec\@empty
\NCC@makecaption{#3}{#1}{#4}{#2}{}%
\NCC@sec@reset@controls
- \NCC@defaultsectag
}
% \end{macrocode}
% \end{macro}
@@ -1395,12 +2092,11 @@
\let\centering\@empty
\addcontentsline{\@nameuse{ext@\@captype}}{\@captype}{%
\ifnum \c@secnumdepth>\m@ne
- \protect\numberline{\@nameuse{the\@captype}}\fi
+ \numberline{\@nameuse{the\@captype}}\fi
#4%
}%
\endgroup
}%
- \NCC@defaultsectag
}
% \end{macrocode}
% \end{macro}
@@ -1427,8 +2123,9 @@
% 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
+ \NCC@apply@cap{suffix}%
+ \NCC@apply@cap{width}%
+ \NCC@vtopcap{\@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.
@@ -1442,6 +2139,48 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\NCC@vtopcap}
+% |\NCC@vtopcap|\marg{text} places a text in a vertical
+% top-aligned box. Its width is prepared in |\@tempdima|
+% before this macro. If its width is greater than the
+% |\linewidth|, we allow overlap the box out of line.
+% The overlapping directions are calculated from stretches of
+% paragraph marginal skips.
+% \begin{macrocode}
+\def\NCC@vtopcap#1{%
+ \ifdim\@tempdima>\linewidth
+ \@tempskipa \leftskip \advance\@tempskipa -1\@tempskipa
+ \@tempskipb \rightskip \advance\@tempskipb \parfillskip
+ \advance\@tempskipb -1\@tempskipb
+ \vtop{\hb@xt@\linewidth{%
+ \NCC@ifzeroskip\@tempskipa{}{\hss}%
+ \vtop{\hsize\@tempdima#1}%
+ \NCC@ifzeroskip\@tempskipb{}{\hss}%
+ }}%
+ \else
+ \vtop{\hsize\@tempdima#1}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@ifzeroskip}
+% |\NCC@ifzeroskip|\marg{register}\marg{true-clause}\marg{false-clause}
+% executes the \meta{true-clause} if the value of skip register
+% is exactly zero skip without stretchability. Otherwise, the
+% \meta{false-clause} is executed.
+% \begin{macrocode}
+\def\NCC@ifzeroskip#1{%
+ \edef\@tempa{\the#1}\edef\@tempb{\the\z@skip}%
+ \ifx\@tempa\@tempb
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\NCC@makecaptag@para}
% The |\NCC@makecaptag@para|\marg{text} prepares run-in tag.
% \begin{macrocode}
@@ -1534,8 +2273,7 @@
% last line centered.
% \begin{macrocode}
\long\def\NCC@makecapstyle@centerlast#1{%
- \leftskip\z@\@plus 1fil%
- \rightskip\z@\@plus -1fil%
+ \leftskip\@flushglue \rightskip -\@flushglue
\parfillskip\z@\@plus 2fil\relax#1%
}
% \end{macrocode}
@@ -1603,13 +2341,21 @@
\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}%
+ \NCC@setsectionsuffix{#1}%
+ \NCC@preparesectag{#4}{}%
\let\NCC@makesec\NCC@makesect
- \@startsection{#2}{#1}{#3}{#5}{#6}{#7}}%
+ \NCC@startsection{#2}{#1}{#3}{#5}{#6}{#7}}%
\else
\ifnum#1=\z@
\def\NCC@mainsection{%
- \NCC@startmainsec{\@hangfrom{\hskip #3}\rightskip\@flushglue}%
+ \NCC@setsectionsuffix\z@
+ \let\NCC@secmain\@empty
+% \end{macrocode}
+% The empty |\NCC@secmain| means standard alignment of main section
+% \begin{macrocode}
+ \NCC@startmainsec{%
+ \NCC@hangfrom{\hskip #3}\NCC@adjsecmargins{}\@flushglue
+ \ignorespaces}%
{#4}{#5}{#6}{#7}%
}%
\else
@@ -1627,19 +2373,30 @@
% \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.
+% It can also be 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}%
+ \NCC@setsectionsuffix{#1}%
+ \NCC@setsectionstyle{#1}%
+ \NCC@preparesectag{#3}{}%
\let\NCC@makesec\NCC@makesecx
- \@startsection{#2}{#1}{\z@}{#4}{#5}{#6}}%
+ \NCC@startsection{#2}{#1}{\z@}{#4}{#5}{#6}}%
\else
\ifnum#1=\z@
+% \end{macrocode}
+% The non-empty |\NCC@secmain| hook means the dynamic alignment.
+% We also redefine the dynamic section style |\NCC@sec| in such a way that the
+% right skip stretchability will be |1fil| if the section style has
+% no flush glue.
+% \begin{macrocode}
\def\NCC@mainsection{%
- \NCC@startmainsec{\NCC@sec{}\rightskip\@flushglue}%
- {#3}{#4}{#5}{#6}%
+ \NCC@setsectionsuffix\z@
+ \NCC@setsectionstyle\z@
+ \let\NCC@secsave\NCC@sec \let\NCC@sec\NCC@secflush
+ \def\NCC@secmain{\protect\NCC@sec{}}%
+ \NCC@startmainsec{}{#3}{#4}{#5}{#6}%
}%
\else
\NCC@dsecf{#2}{#3}{#4}{#5}{#6}%
@@ -1650,6 +2407,27 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\NCC@secflush}
+% |\NCC@secflush|\marg{tag} applies a section style saved in the
+% |\NCC@secsave| macro and adjusts |\rightskip| and |\parfillskip|
+% if left and right margins have no stretchability in sum.
+% To adjust the right skip, we do the same tricks as in
+% |\NCC@adjsecmargins|.
+% \begin{macrocode}
+\def\NCC@secflush#1{\NCC@secsave{#1}%
+ \@tempskipa\leftskip \advance\@tempskipa\rightskip
+ \advance\@tempskipa -1\@tempskipa
+ \NCC@ifzeroskip\@tempskipa{%
+ \@tempskipa 1\rightskip \advance\@tempskipa -\rightskip
+ \advance\@tempskipa \@flushglue
+ \advance\rightskip \@tempskipa
+ \advance\parfillskip -\@tempskipa
+ }{}%
+ \ignorespaces
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\NCC@dsecf}
% This command declares captions of floats:
% \begin{quote}
@@ -1667,6 +2445,28 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\DeclarePart}
+% In book-like classes, a part is declared in a special way:
+% \begin{quote}
+% |\DeclarePart|\marg{before}\marg{after}\marg{prefix}\marg{style}
+% \end{quote}
+% Long parameters are allowed in this declaration.
+% \begin{macrocode}
+\@ifundefined{chapter}{}{%
+ \newcommand\DeclarePart[4]{%
+ \def\NCC@partsection{%
+ \NCC@startpart
+ \NCC@preparesectag{\leavevmode#3}{\partname\nobreakspace}%
+ \secdef{\NCC@part{#1}{#2}{#4}}{\NCC@spart{#1}{#2}{#4}}%
+ }%
+ }
+ \@onlypreamble\DeclarePart
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Caption Patches}
+%
% \begin{macro}{\@makecaption}
% We emulate here the |\@makecaption{\fnum@|\meta{type}|}|\marg{caption}
% command to provide the compatibility with packages using it.
@@ -1686,29 +2486,50 @@
% \end{macrocode}
% \end{macro}
%
-% Add patches to the |supertabular| and |longtable| packages if they are used:
+% Add patch to the \textbf{supertabular} package:
% \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}}%
+\AfterPackage{supertabular}{%
+ \long\def\ST@caption#1[#2]#3{\par%
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup\centering
\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
- }}%
- }%
- }{}%
+ \endgroup
+ }
+}
+% \end{macrocode}
+%
+% Add patch to the \textbf{xtab} package:
+% \begin{macrocode}
+\AfterPackage{xtab}{%
+ \long\def\ST@caption#1[#2]#3{\par%
+ \@initisotab
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup\centering
+ \def\@captype{#1}%
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup
+ \global\advance\ST@pageleft -\PWSTcapht
+ \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}%
+ }
+}
+% \end{macrocode}
+%
+% Add patch to the \textbf{longtable} package:
+% \begin{macrocode}
+\AfterPackage{longtable}{%
+ \def\LT@makecaption#1#2#3{%
+ \LT@mcol\LT@cols c{\hbox to\z@{\hss
+ \parbox[t]\LTcapwidth{\centering\def\@captype{table}%
+ \ifx#1\@gobble \NCC@cap@table*{#3}%
+ \else \@makecaption{\fnum@table}{#3}%
+ \fi
+ }%
+ \hss
+ }}%
+ }
}
% \end{macrocode}
%
@@ -1723,8 +2544,7 @@
% \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}]}%
+ {\NCC@dtoc{#1}{#2}{#3}{#4}{#5}[\NCC@nexttocnum{#3}{#4}]}%
}
\def\NCC@dtoc#1#2#3#4#5[#6]{%
% \end{macrocode}
@@ -1749,7 +2569,7 @@
\if@tempswa
\@tempcnta#1\relax
\@tempcnta -\@tempcnta
- \PackageError{nccsect}
+ \PackageError{nccsect}%
{Float type registration number \the\@tempcnta\space
is out of range}{}%
\fi
@@ -1774,15 +2594,65 @@
\@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:
+% the left margin adjustment command. The
+% |\NCC@tocnumprototype|\marg{style}\marg{prototype} hook
+% applies a style to the prototype of toc-entry number.
% \begin{macrocode}
\@tempcnta #1\relax \advance\@tempcnta\@ne
\expandafter\def\csname l@tocskip@\romannumeral\@tempcnta
- \endcsname{\NCC@tocadj{#5{#6}}}%
+ \endcsname{\NCC@tocadj{\NCC@tocnumprototype{#5}{#6}}}%
\fi
}
\@onlypreamble\DeclareTOCEntry
\@onlypreamble\NCC@dtoc
+\def\NCC@nexttocnum#1#2{#1#2\NCC@atocnum}
+\def\NCC@tocnumprototype#1#2{\let\applystyle\@firstoftwo#1{#2}}
+% \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{\let\NCC@atocdo\@firstoftwo#1}%
+ \advance\@tempdimb\@tempdima
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareTOCPart}
+% Part toc-entry declaration in book-like classes. If optional
+% \meta{afterskip} is omitted, the default |\NCC@runskip| value
+% is applied after this entry.
+% \begin{quote}
+% |\DeclareTOCPart|\marg{action}\oarg{afterskip}\marg{prefix}\marg{prototype}\marg{style}
+% \end{quote}
+% \begin{macrocode}
+\@ifundefined{chapter}{}{%
+ \newcommand*\DeclareTOCPart[1]{%
+ \@ifnextchar[{\NCC@dtocpart{#1}}{\NCC@dtocpart{#1}[\NCC@runskip]}%
+ }
+ \def\NCC@dtocpart#1[#2]#3#4#5{%
+ \def\l@part##1##2{%
+ \NCC@tocentry{-1}{%
+% \end{macrocode}
+% We temporary add |1fil| to the toc right margin to prepare
+% a ragged right toc-entry.
+% \begin{macrocode}
+ \TOCMarginDrift{1fil}%
+% \end{macrocode}
+% Breaks before part are preferred.
+% \begin{macrocode}
+ \addpenalty{-\@highpenalty}#1%
+ }{#3}{#4}{#5}{##1}{\hss##2}%
+ \nobreak \vskip #2\relax
+ \@nobreaktrue
+ \everypar{\@nobreakfalse\everypar{}}%
+ }%
+ }
+ \@onlypreamble\DeclareTOCPart
+ \@onlypreamble\NCC@dtocpart
+}
% \end{macrocode}
% \end{macro}
%
@@ -1807,19 +2677,21 @@
{\@nameuse{l@tocskip@\romannumeral \@tempcnta}%
\advance\@tempcnta\m@ne}%
% \end{macrocode}
-% Prepare the |\NCC@maketocnum|\marg{tag} command creating
+% The |\NCC@preparetocnum|\marg{style}\marg{prefix} hook prepares
+% the |\NCC@maketocnum|\marg{tag} command creating
% a number-line tag:
% \begin{macrocode}
- \def\NCC@maketocnum##1{\NCC@do{#5}{}{#3##1\NCC@atocnum}}%
+ \NCC@preparetocnum{#5}{#3}%
% \end{macrocode}
% Calculate the hang indent value in |\@tempdima|:
% \begin{macrocode}
- \settowidth\@tempdima{\let\NCC@do\@firstoftwo\NCC@maketocnum{#4}}%
+ \settowidth\@tempdima{\let\NCC@atocdo\@firstoftwo\NCC@maketocnum{#4}}%
% \end{macrocode}
-% Produce the toc-entry:
+% Produce the toc-entry. The |\NCC@tocentrytitle|\marg{style}\marg{title}
+% hook applies the style to the toc-entry title.
% \begin{macrocode}
\@dottedtocline{#1}{\@tempdimb}{\@tempdima}%
- {\let\NCC@do\@secondoftwo#5{\ignorespaces#6\unskip}}%
+ {\let\NCC@atocdo\@secondoftwo\NCC@tocentrytitle{#5}{#6\unskip}}%
{\let\applystyle\@secondoftwo#5{#7}}%
% \end{macrocode}
% Allow break after toc-entry:
@@ -1828,13 +2700,10 @@
\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}
+\def\NCC@preparetocnum#1#2{%
+ \def\NCC@maketocnum##1{\NCC@atocdo{#1}{}{#2##1\NCC@atocnum}}%
+}
+\def\NCC@tocentrytitle#1#2{#1{\ignorespaces#2}}
% \end{macrocode}
% \end{macro}
%
@@ -1843,7 +2712,7 @@
% 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{%
+\DeclareRobustCommand*\numberline[1]{%
\setbox\@tempboxa\hbox{\NCC@maketocnum{#1}}%
\ifdim \wd\@tempboxa > \@tempdima
\box\@tempboxa
@@ -1860,7 +2729,8 @@
% 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}
+\def\NCC@maketocnum#1{#1\NCC@atocnum}
+\let\NCC@atocdo\@secondoftwo
% \end{macrocode}
% \end{macro}
%
@@ -1868,17 +2738,17 @@
% 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
+% |\NCC@atocdo| 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}}}
+\newcommand*{\NumberlineSuffix}[2]{\def\NCC@atocnum{\NCC@atocdo{#1}{#2}}}
\@onlypreamble\NumberlineSuffix
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\TOCMarginDrift}
-% The |\TOCMarginDrift|\marg{drift} specifies a drift of right margin
+% The |\TOCMarginDrift|\marg{drift} specifies allowed drift of right margin
% in TOC.
% \begin{macrocode}
\newcommand*\TOCMarginDrift[1]{%
@@ -1886,7 +2756,6 @@
\ifx\@tempa\@empty \let\NCC@tocdrift\@empty
\else \def\NCC@tocdrift{\@plus #1\relax}\fi
}
-\TOCMarginDrift{}
% \end{macrocode}
% \end{macro}
%
@@ -1897,16 +2766,6 @@
% \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}%
@@ -1916,29 +2775,46 @@
% \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{macro}{\SetTOCStyle}
+% The toc-style hook is embedded into the |\@starttoc| command.
+% We also recalculate the page number prototype and update
+% margins when a toc starts.
% \begin{macrocode}
-\newcommand\StartFromTextArea{\par
- {\parskip\z@ \strut\par}\vskip -\baselineskip
+\newcommand*{\SetTOCStyle}[1]{\def\NCC@tocstyle{#1}}
+\@onlypreamble\SetTOCStyle
+\let\NCC@latexstarttoc\@starttoc
+\def\@starttoc#1{%
+ \begingroup
+ \normalfont \NCC@tocstyle \NCC@setpnum
+ \NCC@latexstarttoc{#1}%
+ \endgroup
}
% \end{macrocode}
% \end{macro}
%
+% \subsection{Service and Defaults}
+%
+% \begin{macro}{\StartFromTextArea}
% \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
+% These commands are applied at the beginning of page
+% to set current position exactly at the first line
+% of text area or at the header line, respectively.
+% Both these commands are defined in two packages: in this one and in
+% the \textbf{textarea}. To be sure that the commands are specified
+% in these packages only, we mutually test packages to be loaded.
+% \begin{macrocode}
+\@ifpackageloaded{textarea}{}{%
+ \newcommand\StartFromTextArea{\par
+ {\parskip\z@ \strut\par}\vskip -\baselineskip
+ }
+ \newcommand\StartFromHeaderArea{%
+ \StartFromTextArea
+ \vskip -\headsep \vskip -\ht\strutbox
+ }
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\bff}
% The |\bff| command tries to set everything bold.
@@ -1947,8 +2823,21 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\aftersectionvspace}
+% This command eliminates a vertical space inserted after a previous
+% section and inserts a vertical space specified.
+% \begin{macrocode}
+\newcommand*\aftersectionvspace[1]{%
+ \ifvmode \if@nobreak
+ \vskip -\lastskip \vskip #1\relax
+ \fi \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\startsection}
-% Define the |\startsection| command:
+% Define the |\startsection| command. In article-class,
+% both zero and negative levels refer to the same part section.
% \begin{macrocode}
\newcommand*{\startsection}[1]{%
\ifnum#1>\z@
@@ -1957,7 +2846,7 @@
\ifnum#1=\z@
\def\@tempa{\NCC@mainsection}%
\else
- \def\@tempa{\part}%
+ \def\@tempa{\NCC@partsection}%
\fi
\fi
\@tempa
@@ -1965,13 +2854,16 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\part}
% \begin{macro}{\section}
% \begin{macro}{\subsection}
% \begin{macro}{\subsubsection}
% \begin{macro}{\paragraph}
% \begin{macro}{\subparagraph}
-% Set aliases for the positive section levels:
+% Set aliases for almost all section levels, except chapter.
+% The part is called here as a section of a negative level.
% \begin{macrocode}
+\def\part{\startsection\m@ne}
\def\section{\startsection\@ne}
\def\subsection{\startsection\tw@}
\def\subsubsection{\startsection\thr@@}
@@ -1983,6 +2875,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\caption}
% Redefine the |\caption| command. We do this at the beginning
@@ -2014,13 +2907,13 @@
% \end{macrocode}
% \end{macro}
%
-% Register standard floats:
+% Registration of standard floats:
% \begin{macrocode}
\RegisterFloatType{figure}
\RegisterFloatType{table}
% \end{macrocode}
%
-% Declare all sections and captions except the main section:
+% Declare all sections and captions except the part and chapter:
% \begin{macrocode}
\DeclareSection{-2}{table}{}{\z@}{10pt}{}
\DeclareSection{-1}{figure}{}{10pt}{\z@}{}
@@ -2040,11 +2933,8 @@
\@ifundefined{chapter}{
% \end{macrocode}
%
-% \begin{macro}{\part}
-% Declare the main section and toc-entries for the
-% article-like style:
+% Declare the part 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}
@@ -2056,17 +2946,43 @@
\DeclareTOCEntry3{}{}{9.9.9}{}
}{
% \end{macrocode}
+%
+% \begin{macro}{\ChapterPrefixStyle}
+% Specify the appearance of chapter prefix in the toc and the header.
+% \begin{macrocode}
+ \newcommand*{\ChapterPrefixStyle}[1]{%
+ \def\NCC@thetocchapter{\thechapter}%
+ \let\NCC@makechapfinal\NCC@makechapfinalgobble
+ \@for\@tempa:=#1\do{%
+ \@ifundefined{NCC@chapin@\@tempa}{%
+ \PackageError{nccsect}{Unknown style `\@tempa'\MessageBreak
+ Only the `toc' and `header' styles are allowed}{}%
+ }{\csname NCC@chapin@\@tempa\endcsname}%
+ }%
+ }
+ \def\NCC@chapin@toc{\def\NCC@thetocchapter{\@chapapp\ \thechapter}}
+ \def\NCC@chapin@header{\let\NCC@makechapfinal\@firstofone}
+ \@onlypreamble\ChapterPrefixStyle
+ \@onlypreamble\NCC@chapin@toc
+ \@onlypreamble\NCC@chapin@header
+% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\chapter}
-% Declare the main section, toc-entries for the
+% Declare the part, the chapter, toc-entries for the
% book-like style, and specify default epigraph parameters:
% \begin{macrocode}
\def\chapter{\startsection\z@}
+ \DeclarePart{\StartFromTextArea\vfil\centering}%
+ {\vfil\newpage \if@twoside\if@openright
+ \mbox{}\thispagestyle{empty}\newpage\fi\fi}%
+ {\vspace{4ex}\huge\bff}{\Huge\bff}
\DeclareSection*0{chapter}{\vspace{3ex}\huge\bff}{10ex}%
{8ex \@plus .2ex}{\Huge\bff}
\DeclareTOCEntry{-2}{}{}{9.9}{}% table
\DeclareTOCEntry{-1}{}{}{9.9}{}% figure
+ \DeclareTOCPart{\NCC@secskip{4ex \@plus .2ex}\def\@dotsep{1000}}
+ {}{II}{\large\bff}
\DeclareTOCEntry0{\runinsectionskip\def\@dotsep{1000}%
\aftergroup\penalty\aftergroup\@highpenalty}{}{9}{\bff}
\DeclareTOCEntry1{}{}{9.9}{}[9.9]
@@ -2090,12 +3006,15 @@
\noindentaftersection
\sectionstyle{hangindent}
\SectionTagSuffix{\quad}
+\RunningSectionSuffix{}
\captionwidth{\linewidth}
\captionstyle{default}
\captiontagstyle{para}
\CaptionTagSuffix{:\hskip .7em \@plus .2em \@minus .1em}
\NumberlineSuffix{\quad}{\enskip}
\PnumPrototype{99}
+\TOCMarginDrift{}
+\SetTOCStyle{}
%</package>
% \end{macrocode}
\endinput
diff --git a/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx b/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx
index 8d942ef80e6..f4d53ea7e32 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx
@@ -9,6 +9,7 @@
% \changes{v1.0}{2004/11/30}{This version was uploaded to CTAN}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{nccstretch}
\GetFileInfo{nccstretch.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/nccthm.dtx b/Master/texmf-dist/source/latex/ncctools/nccthm.dtx
index 033ec5d7d84..deb6b6ac1b7 100644
--- a/Master/texmf-dist/source/latex/ncctools/nccthm.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/nccthm.dtx
@@ -17,6 +17,7 @@
% \changes{v1.1}{2004/12/16}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{desclist}
\usepackage[blackqed,whiteqed]{nccthm}
@@ -42,10 +43,12 @@
%</driver>
% \fi
%
+% \tableofcontents
+%
% \section{Overview}
%
% This is yet another extension of the \LaTeX\ theorem making
-% environment. Further, we'll call the \textit{theorem\/}
+% environment. Further, we'll call the \textit{theorem}
% any mathematical statement consisting of one or more paragraphs,
% and starting with a header containing an optional number.
% A theorem is set off from the main text with an extra space.
@@ -56,7 +59,7 @@
% |nccthm| package is distinct in the following:
%
% \paragraph{1} All new theorem environments generated with the
-% |nccthm| package use the \textit{dynamic counters\/} (see |dcounter|
+% |nccthm| package use the \textit{dynamic counters} (see |dcounter|
% package from this bungle for more details). As a result, this allows
% a package writer to generate predefined theorems
% and do not think on how they will be numbered, because the
@@ -85,30 +88,30 @@
% \paragraph{2} We have divided all theorem modification features into
% three orthogonal groups.
%
-% A \textit{type\/} defines font shapes used in the theorem.
-% Two types are predefined: \textit{theorem\/} and \textit{remark}.
+% A \textit{type} defines font shapes used in the theorem.
+% Two types are predefined: \textit{theorem} and \textit{remark}.
% You can define more types or redefine existing types.
%
-% A \textit{mode\/} defines the precedence of number in the header.
+% A \textit{mode} defines the precedence of number in the header.
% In standard mode, a number goes after a theorem title.
% The reverse mode (number starts header), named here the
-% \textit{APAR\/} mode, is special. All theorems using this mode
+% \textit{APAR} mode, is special. All theorems using this mode
% are counted with the same |apar| counter. To generate theorems
% in the standard mode, the |\newtheorem| command is used.
-% The |\newtheorem*| command is used for generation \textit{apar\/}
+% The |\newtheorem*| command is used for generation \textit{apar}
% theorems.
%
-% A \textit{style\/} specifies the appearance of theorems.
+% A \textit{style} specifies the appearance of theorems.
% It consists of three modifiers: \textit{breaking},
% \textit{indentation},
% and \textit{marginal numbering}. The breaking modifier determines
% the separation of theorem header from theorem body (run-in header
% or line break after header). The indentation modifier has two
-% values: \textit{noindent\/} and \textit{parindent}. It
+% values: \textit{noindent} and \textit{parindent}. It
% defines an indentation style of a theorem header.
% The marginal numbering modifier affects on apar theorems:
-% in \textit{margin\/} style, the number of an apar theorem
-% is typed on margins; in \textit{nomargin\/}
+% in \textit{margin} style, the number of an apar theorem
+% is typed on margins; in \textit{nomargin}
% style, the number starts a paragraph.
%
% The breaking modifier is controlled with special commands but other
@@ -165,7 +168,6 @@
% as its tag (|\tag*{\qedsymbol}| when use the
% |amsmath| package).
%
-%
% \DescribeMacro{\blackqed}
% \DescribeMacro{\blackqedsymbol}
% If you load the package with the `|blackqed|' option, two
diff --git a/Master/texmf-dist/source/latex/ncctools/ncctools.ins b/Master/texmf-dist/source/latex/ncctools/ncctools.ins
index 065bff23055..63ed2a13b02 100644
--- a/Master/texmf-dist/source/latex/ncctools/ncctools.ins
+++ b/Master/texmf-dist/source/latex/ncctools/ncctools.ins
@@ -1,4 +1,4 @@
-%% Copyright 1998--2004 by Alexander I. Rozhenko.
+%% Copyright 1998--2006 by Alexander I. Rozhenko.
%%
%% This file is part of the `ncctools' bundle.
%%
@@ -39,6 +39,7 @@ see the README file distributed with the ncctools bundle.
%%%%%%%%%%%%%% Generate packages
+\SimplePackage{afterpackage}
\SimplePackage{dcounter}
\SimplePackage{desclist}
\SimplePackage{extdash}
@@ -59,7 +60,9 @@ see the README file distributed with the ncctools bundle.
\SimplePackage{nccsect}
\SimplePackage{nccstretch}
\SimplePackage{nccthm}
+\SimplePackage{textarea}
\SimplePackage{tocenter}
+\SimplePackage{topsection}
\SimplePackage{watermark}
\Msg{***********************************************************}
diff --git a/Master/texmf-dist/source/latex/ncctools/textarea.dtx b/Master/texmf-dist/source/latex/ncctools/textarea.dtx
new file mode 100644
index 00000000000..b19e259ace7
--- /dev/null
+++ b/Master/texmf-dist/source/latex/ncctools/textarea.dtx
@@ -0,0 +1,236 @@
+% \iffalse
+%%
+%% File: textarea.dtx Copyright (C) 2005 by Alexander I. Rozhenko
+%%
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{textarea}
+%<package> [2005/12/26 v1.0 Text area control (NCC)]
+%
+% \changes{v1.0}{2005/12/26}{Initial version}
+%
+%<*driver>
+\let\makeindex\relax
+\documentclass{ltxdoc}
+\usepackage{textarea}
+\GetFileInfo{textarea.sty}
+\begin{document}
+\title{The \textsf{textarea} package\thanks{This file
+ has version number \fileversion, last
+ revised \filedate.}}
+\author{Alexander I. Rozhenko\\rozhenko@oapmg.sscc.ru}
+\date{\filedate}
+\maketitle
+\DocInput{textarea.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% The package allows expand the text area of a document on other
+% areas: footer, header, and margin. There are two ways for such
+% expansion --- temporary expansion of a current page on the header using
+% a special negative vertical skip, or global change of page layout
+% parameters with possibility of later restoration them to the original
+% values. All these actions should be applied at the beginning of page.
+%
+% \section{User Interface}
+%
+% \DescribeMacro\StartFromTextArea
+% Applied at the beginning of page, it allows using the non-starred
+% form of the |\vspace| command after it. The introduced command provides
+% exact vertical skips at the beginning of page. Unlike it, the standard
+% \LaTeX's |\vspace*| command skips more space at the beginning of page
+% than it is required in its parameter. So, using the
+% |\StartFromTextArea| command prevents
+% incorrect spacing at the beginning of page.
+%
+% \DescribeMacro\StartFromHeaderArea
+% Applied at the beginning of page, it adjusts the beginning of text area
+% to the header area by inserting a negative vertical skip. The header
+% of this page should be empty. Otherwise, the consequent text will
+% overprint the header.
+%
+% \DescribeMacro{\ExpandTextArea\oarg{hfm}}
+% Expands the text area on other areas of page by changing page layout
+% parameters. It can be used in one-column mode only.
+% The letters in optional argument mean the following: |h| (header),
+% |f| (footer), and |m| (margins). If an optional argument is omitted
+% or equals to |[*]|, the temporary expansion to the header is applied
+% with the |\StartFromHeaderArea| command. Anyway, you can use the
+% non-starred form of the |\vspace| command after expansion of the
+% text area.
+%
+% When a text area is expanded (non-temporary), the repeated call of
+% this command is disallowed.
+%
+% \DescribeMacro\RestoreTextArea
+% Restores page layout parameters to their previous values. After that,
+% the |\ExpandTextArea| command can be applied again.
+%
+% \DescribeMacro\NCC@restoretextarea
+% This hook can be used to provide an automatic restoration of the text
+% area. In \textbf{ncc} class, we use it as follows: set it empty at
+% the beginning of |titlepage| environment and call this command at
+% the end of |titlepage| environment. So, if the text area will be
+% expanded within the |titlepage| environment, it will be automatically
+% restored at the end of it.
+%
+% \StopEventually{}
+%
+% \section{The Implementation}
+%
+% \begin{macro}{\StartFromTextArea}
+% \begin{macro}{\StartFromHeaderArea}
+% Both these commands are defined in two packages: in this and in
+% \textbf{nccsect}. To be sure that the commands are specified
+% in these packages only, we mutually test packages to be loaded.
+% \begin{macrocode}
+%<*package>
+\@ifpackageloaded{nccsect}{}{%
+ \newcommand\StartFromTextArea{\par
+ {\parskip\z@ \strut\par}\vskip -\baselineskip
+ }
+ \newcommand\StartFromHeaderArea{%
+ \StartFromTextArea
+ \vskip -\headsep \vskip -\ht\strutbox
+ }
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\RestoreTextArea}
+% This command is usually empty. But it is globally redefined
+% when the layout of page is modified by the |\ExpandTextArea|
+% command.
+% \begin{macrocode}
+\newcommand*\RestoreTextArea{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ExpandTextArea}
+% This command should be applied at the beginning of page
+% in one-column mode only.
+% \begin{macrocode}
+\newcommand*\ExpandTextArea[1][*]{%
+ \if@twocolumn
+ \PackageError{textarea}%
+ {The \string\ExpandTextArea\space command\MessageBreak
+ cannot work in two-column mode}{}%
+% \end{macrocode}
+% Test for temporary expansion mode and do it.
+% \begin{macrocode}
+ \else
+ \def\@tempa{*}\edef\@tempb{#1}%
+ \ifx\@tempa\@tempb
+ \StartFromHeaderArea
+% \end{macrocode}
+% Otherwise, apply the permanent expansion but in the only case if
+% it was not already applied.
+% \begin{macrocode}
+ \else
+ \ifx\RestoreTextArea\@empty
+% \end{macrocode}
+% |\NCC@|\meta{x} hooks will be applied right here to modify the layout and
+% |\NCC@resore@|\meta{x} hooks will applied later when the original layout
+% will be restored.
+% \begin{macrocode}
+ \let\NCC@h\@empty \global\let\NCC@restore@h\@empty
+ \let\NCC@f\@empty \global\let\NCC@restore@f\@empty
+ \let\NCC@m\@empty \global\let\NCC@restore@m\@empty
+% \end{macrocode}
+% Analyze letters in the optional parameter and prepare the respective hooks.
+% The first parameter in all adjustment commands is a sign of adjustment:
+% the empty value means adjust and the minus sign means restore.
+% \begin{macrocode}
+ \expandafter\@tfor\expandafter\@tempa\expandafter:\expandafter=#1\do{%
+ \if h\@tempa
+ \def\NCC@h{\NCC@adjusttoheader{}}%
+ \gdef\NCC@restore@h{\NCC@adjusttoheader-}%
+ \else
+ \if f\@tempa
+ \def\NCC@f{\NCC@adjusttofooter{}}%
+ \gdef\NCC@restore@f{\NCC@adjusttofooter-}%
+ \else
+ \if m\@tempa
+ \if@reversemargin \@tempcnta\@ne \else \@tempcnta\tw@ \fi
+ \edef\NCC@m{\noexpand\NCC@adjusttomargin{}{\the\@tempcnta}}%
+ \xdef\NCC@restore@m{\noexpand\NCC@adjusttomargin-{\the\@tempcnta}}%
+ \fi
+ \fi
+ \fi
+ }%
+% \end{macrocode}
+% Modify the layout, apply the |\StartFromTextArea| command, and prepare
+% the |\RestoreTextArea| command and the auto-restoration hook.
+% \begin{macrocode}
+ \NCC@h\NCC@f\NCC@m
+ \StartFromTextArea
+ \gdef\RestoreTextArea{%
+ \NCC@restore@h\NCC@restore@f\NCC@restore@m
+ \global\let\RestoreTextArea\@empty
+ }%
+ \def\NCC@restoretextarea{\RestoreTextArea}%
+ \fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@adjusttoheader}
+% Adjust text height parameters and |\topmargin|.
+% \begin{macrocode}
+\def\NCC@adjusttoheader#1{%
+ \@tempdima #1\headheight
+ \advance\@tempdima #1\headsep
+ \global\advance\textheight\@tempdima
+ \global\advance\topmargin-\@tempdima
+ \global\@colht\textheight
+ \global\@colroom\textheight
+ \global\vsize\textheight
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@adjusttofooter}
+% Adjust text height parameters.
+% \begin{macrocode}
+\def\NCC@adjusttofooter#1{%
+ \global\advance\textheight#1\footskip
+ \global\@colht\textheight
+ \global\@colroom\textheight
+ \global\vsize\textheight
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@adjusttomargin}
+% Adjust text width parameters, |\oddsidemargin| or
+% |\evensidemargin|. The second parameter specifies
+% the mode of marginal notes: reverse (1) or normal (2) margins.
+% \begin{macrocode}
+\def\NCC@adjusttomargin#1#2{%
+ \@tempdima #1\marginparwidth
+ \advance\@tempdima #1\marginparsep
+ \@tempcnta#2%
+ \ifodd\@tempcnta
+ \global\advance\oddsidemargin -\@tempdima
+ \else
+ \global\advance\evensidemargin -\@tempdima
+ \fi
+ \global\advance\textwidth\@tempdima
+ \global\columnwidth\textwidth
+ \global\linewidth\textwidth
+ \global\hsize\textwidth
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NCC@restoretextarea}
+% Text area auto-restoration hook.
+% \begin{macrocode}
+\let\NCC@restoretextarea\@empty
+%</package>
+% \end{macrocode}
+% \end{macro}
+\endinput
diff --git a/Master/texmf-dist/source/latex/ncctools/tocenter.dtx b/Master/texmf-dist/source/latex/ncctools/tocenter.dtx
index 4246b929346..21193964f78 100644
--- a/Master/texmf-dist/source/latex/ncctools/tocenter.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/tocenter.dtx
@@ -10,6 +10,7 @@
% \changes{v1.1}{2004/12/09}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{tocenter}
\GetFileInfo{tocenter.sty}
diff --git a/Master/texmf-dist/source/latex/ncctools/topsection.dtx b/Master/texmf-dist/source/latex/ncctools/topsection.dtx
new file mode 100644
index 00000000000..905b702f94f
--- /dev/null
+++ b/Master/texmf-dist/source/latex/ncctools/topsection.dtx
@@ -0,0 +1,133 @@
+% \iffalse
+%%
+%% File: topsection.dtx Copyright (C) 2005 by Alexander I. Rozhenko
+%%
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{topsection}
+%<package> [2005/12/24 v1.0 Top section definition (NCC)]
+%
+% \changes{v1.0}{2005/12/24}{Initial version}
+%
+%<*driver>
+\let\makeindex\relax
+\documentclass{ltxdoc}
+\usepackage{topsection}
+\GetFileInfo{topsection.sty}
+\begin{document}
+\title{The \textsf{topsection} package\thanks{This file
+ has version number \fileversion, last
+ revised \filedate.}}
+\author{Alexander I. Rozhenko\\rozhenko@oapmg.sscc.ru}
+\date{\filedate}
+\maketitle
+\DocInput{topsection.dtx}
+\end{document}
+%</driver>
+% \fi
+% \DescribeMacro\topsection
+% This package implements an unnumbered top-level section
+% (chapter in books and reports or section in articles):
+% \begin{quote}
+% |\topsection|\marg{title}
+% \end{quote}
+% Such a section is used when table of contents, index, or
+% bibliography are prepared. So, the |\topsection| command can
+% be used to make such definitions or redefinitions to be independent
+% on class in use. The command definition is compatible with standard
+% \textbf{article}, \textbf{book}, and \textbf{report} classes
+% and also with the \textbf{ncc} class.
+%
+% \DescribeMacro\@iftopchapter
+% To distinguish what type of top section is used, the following
+% conditional command is also specified:
+% \begin{quote}
+% |\@iftopchapter|\marg{chapter-clause}\marg{section-clause}
+% \end{quote}
+% The \meta{chapter-clause} is executed if top section is the |\chapter|.
+% Otherwise, the \meta{section-clause} is executed.
+%
+% If the \textbf{nccsect}
+% package is used together with this package, the top-section title
+% is also written to the aux-file. To avoid this,
+% use |\skipwritingtoaux| modifier just before the top section.
+%
+% \StopEventually{}
+%
+% \section{The Implementation}
+%
+% At first, we provide |\@mkboth| command to be sure that
+% it is defined (in \textbf{ncc} class |\@mkboth| useless and
+% so it does not defined here). If it does not exist yet, its
+% default value will be equal to \LaTeX's |\@gobbletwo| command.
+% \begin{macrocode}
+%<*package>
+\providecommand\@mkboth[2]{}
+% \end{macrocode}
+%
+% \begin{macro}{\NCC@topsection}
+% \begin{macro}{\@iftopchapter}
+% The |\NCC@topsection| macro contains a command to be used as a
+% top section. To select an appropriate command, we test the
+% |\chapter| command to be defined. The |\@iftopchapter| macro is
+% also specified here.
+% \begin{macrocode}
+\newcommand\@iftopchapter[2]{}
+\@ifundefined{chapter}{%
+ \def\NCC@topsection{\section}%
+ \let\@iftopchapter\@secondoftwo
+}{%
+ \def\NCC@topsection{\chapter}%
+ \let\@iftopchapter\@firstoftwo
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\topsection}
+% Now we define the |\topsection| command. When the package is loaded,
+% we specify the command to be a new one. Its real definition
+% is done at the beginning of document when all packages are
+% already loaded and an appropriate decision can be selected.
+% \begin{macrocode}
+\newcommand*\topsection[1]{}
+\AtBeginDocument{%
+% \end{macrocode}
+% If the \textbf{nccsect} package is in use, we define the |\topsection|
+% command using the basic form of the corresponding sectioning command.
+% The |\noheadingtag| modifier turns off the top-section numbering.
+% In the definition, we test the |\@mkboth| command to be equal to
+% |\@gobbletwo|. This situation appears in two cases: when the page
+% style other than |headings| is used or when the \textbf{ncc} class
+% is loaded. In the last case, the appropriate page header is already
+% specified in sectioning command with corresponding mark-command
+% (|\chaptermark| or |\sectionmark| updates both headers by the same
+% manner). So, in both these cases we need not use the |\@mkboth|.
+% But in other cases we specify the header mark in standard way
+% and use the |\norunninghead| modifier to skip updating headers
+% inside the sectioning command.
+% \begin{macrocode}
+ \@ifpackageloaded{nccsect}{%
+ \renewcommand*\topsection[1]{%
+ \ifx\@mkboth\@gobbletwo
+ \noheadingtag \NCC@topsection{#1}%
+ \else
+ \norunninghead
+ \noheadingtag \NCC@topsection{#1}%
+ \@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}%
+ \fi
+ }%
+% \end{macrocode}
+% When the \textbf{nccsect} package does not loaded, the top-section
+% definition uses just the same technique as in standard classes.
+% \begin{macrocode}
+ }{%
+ \renewcommand*\topsection[1]{%
+ \NCC@topsection*{#1}%
+ \@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}%
+ }%
+ }%
+}
+%</package>
+% \end{macrocode}
+% \end{macro}
+\endinput
diff --git a/Master/texmf-dist/source/latex/ncctools/watermark.dtx b/Master/texmf-dist/source/latex/ncctools/watermark.dtx
index b48d728720d..81f9404646b 100644
--- a/Master/texmf-dist/source/latex/ncctools/watermark.dtx
+++ b/Master/texmf-dist/source/latex/ncctools/watermark.dtx
@@ -13,6 +13,7 @@
% \changes{v1.1}{2004/12/09}{Documentation was prepared}
%
%<*driver>
+\let\makeindex\relax
\documentclass{ltxdoc}
\usepackage{watermark,nccboxes}
\GetFileInfo{watermark.sty}