summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ncctools/nccsect.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/ncctools/nccsect.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ncctools/nccsect.sty520
1 files changed, 408 insertions, 112 deletions
diff --git a/Master/texmf-dist/tex/latex/ncctools/nccsect.sty b/Master/texmf-dist/tex/latex/ncctools/nccsect.sty
index bc8c6349896..413a5394627 100644
--- a/Master/texmf-dist/tex/latex/ncctools/nccsect.sty
+++ b/Master/texmf-dist/tex/latex/ncctools/nccsect.sty
@@ -20,11 +20,12 @@
%% For the copying and distribution conditions of the source files,
%% see the README file distributed with the ncctools bundle.
%%
-%% File: nccsect.dtx Copyright (C) 2002--2005 by Alexander I. Rozhenko
+%% File: nccsect.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nccsect}
- [2005/06/15 v1.3 Extended Section, Caption, and TOC Handling (NCC)]
+ [2006/01/19 v1.5 Extended Section, Caption, and TOC Handling (NCC)]
+\RequirePackage{afterpackage}
\@ifpackageloaded{nccthm}{}{%
\def\NCC@secskip#1{%
\if@noskipsec \leavevmode \fi \par
@@ -114,138 +115,234 @@
\newcommand{\noindentaftersection}{\@afterindentfalse}
\newcommand*{\SectionTagSuffix}[1]{\def\NCC@asecnum{#1}}
\@onlypreamble\SectionTagSuffix
-\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
+ }%
+}
+\newcommand*{\RunningSectionSuffix}[1]{\def\NCC@asectitle{\unskip#1}}
+\@onlypreamble\RunningSectionSuffix
+\def\NCC@preparesectag#1#2{\def\NCC@makesectag##1{#1#2##1\NCC@asecnum}}
\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
}
-\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}}%
}
-\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
}
-\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
}
\def\NCC@makesect#1#2#3#4#5{%
\@tempskipa #4\relax
\ifdim \@tempskipa>\z@
\begingroup \normalfont
- #2{\@hangfrom{\hskip #1\relax\@svsec}%
- \interlinepenalty \@M\ignorespaces #3\@@par}%
+ \NCC@asecnumset
+ \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}%
+ \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
-\newcommand*{\sectionstyle}[1]{%
- \@ifundefined{NCC@sec@#1}%
- {\PackageError{nccsect}{Unknown section style `#1'}{}}%
- {\csname NCC@sec@#1\endcsname}%
+\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}
+\def\NCC@hangfrom{%
+ \NCC@setsecmargins{\z@skip}{\z@skip}\NCC@hangsecstyle{\z@}{}%
+}
+\def\NCC@setsecmargins#1#2{%
+ \leftskip\z@skip \rightskip\z@skip
+ \parfillskip\@flushglue
+ \let\\\@normalcr
+ \NCC@adjsecmargins{#1}{#2}%
+ \NCC@secmarginshook
+}
+\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
+}
+\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
+}
+\newcommand*\adjustsectionmargins[2]{%
+ \NCC@global\def\NCC@secmarginshook{\NCC@adjsecmargins{#1}{#2}}
}
-\def\NCC@sec@hangindent{\def\NCC@sec##1{\@hangfrom{##1}}}
-\@namedef{NCC@sec@hangindent*}{%
- \def\NCC@sec##1{\@hangfrom{##1}\rightskip\@flushglue}%
+\g@addto@macro\NCC@sec@reset@controls{%
+ \NCC@global\let\NCC@secmarginshook\@empty
}
-\def\NCC@sec@parindent{\def\NCC@sec##1{\@hangfrom\indent##1}}
-\@namedef{NCC@sec@parindent*}{%
- \def\NCC@sec##1{\@hangfrom\indent\rightskip\@flushglue##1}%
+\let\NCC@secmarginshook\@empty
+\newcommand*\newplainsectionstyle[2]{%
+ \@ifnextchar[{\NCC@newplainsec{#1}{#2}}{\NCC@newplainsec{#1}{#2}[l]}%
+}
+\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
+}
+\@onlypreamble\newplainsectionstyle
+\@onlypreamble\NCC@newplainsec
+\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
+\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}
+\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
+ }%
+ }%
+}
+\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}}
\def\NCC@makesecx#1#2#3#4#5{%
\begingroup\normalfont
- #2{\NCC@sec{\@svsec}\interlinepenalty \@M\ignorespaces #3\@@par}%
+ \NCC@asecnumset
+ \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}}
+\providecommand*\partmark[1]{\markboth{}{}}
\@ifundefined{chapter}{%
\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}}%
}
- \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
}
- \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
}
\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
}
- \providecommand*\partmark[1]{\markboth{}{}}
+ \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}}%
+ }
+ \def\NCC@partsection{\NCC@mainsection}
}{
\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}}%
}
- \newcommand\beforechapter[1]{\gdef\NCC@beforechapter{#1}}
- \beforechapter{}
- \def\@schapter#1#2#3#4#5{%
+ \def\NCC@startchap{%
+ \if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{plain}\global\@topnum\z@
+ }
+ \def\NCC@schapter#1#2#3#4#5{%
\let\@svsec\@empty
\NCC@makechapter{#1}{#2}{#4}{#5}{#3}{}%
\NCC@sec@reset@controls
- \NCC@defaultsectag
}
- \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
- }
- \def\NCC@startchap{%
- \if@openright\cleardoublepage\else\clearpage\fi
- \thispagestyle{plain}\global\@topnum\z@
}
+ \newcommand\beforechapter[1]{\gdef\NCC@beforechapter{#1}}
+ \beforechapter{}
\def\NCC@thetocchapter{\thechapter}
\def\NCC@makechapter#1#2#3#4#5#6{%
\if@twocolumn
@@ -253,13 +350,25 @@
\else
\NCC@makechaphead{#1}{#2}{#3}{#4}{#5}%
\fi
- #6%
+ \NCC@makechapfinal{#6}%
\@afterheading
\ignorespaces
}
+ \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
\def\NCC@makechaphead#1#2#3#4#5{%
\ifx\NCC@beforechapter\@empty
- \StartFromTextArea \vspace{#2}%
+ \StartFromTextArea \vskip #2%
\else
\begingroup
\@twocolumnfalse
@@ -270,11 +379,17 @@
\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
}
+ \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}}%
+ }
\newcommand*\epigraph[1][\NCC@epigraphwidth]{\NCC@epigraph{#1}}
\newcommand*\epigraphparameters[5]{%
\def\NCC@epigraphwidth{#2}%
@@ -298,9 +413,60 @@
\leavevmode\box\@tempboxa
\@end@tempboxa
}
+ \def\NCC@startpart{%
+ \if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{plain}%
+ }
+ \def\NCC@spart#1#2#3#4{%
+ \let\@svsec\@empty
+ \NCC@makepart{#1}{#3}{#4}{#2}{}%
+ \NCC@sec@reset@controls
+ }
+ \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%
+ }%
+ }%
+ }
+ \def\NCC@thetocpart{\thepart}
+ \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
+ }
+ \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
+ \def\NCC@makeparttitle#1#2#3{#1%
+ \ifx\@svsec\@empty \else
+ {\let\NCC@asecnum\@empty\@svsec\@@par}\nobreak \fi
+ \interlinepenalty \@M #2{#3\@@par}
+ }
}
\newcommand*{\CaptionTagSuffix}[1]{\def\NCC@acapnum{#1}}
\@onlypreamble\CaptionTagSuffix
+\newcommand*\captiontagsuffix[2][]{%
+ \NCC@prepare@capkey{suffix}{#1}{\def\NCC@acapnum{#2}}%
+}
+\let\NCC@capsuffix@\@empty
+
\newcommand*\captionstyle[1][]{%
\NCC@set@capkey{style}{style}{#1}%
}
@@ -308,7 +474,7 @@
\NCC@set@capkey{tag}{tag style}{#1}%
}
\newcommand*\captionwidth[2][]{%
- \NCC@prepare@capkey{width}{#1}{\setlength{\hsize}{#2}}%
+ \NCC@prepare@capkey{width}{#1}{\setlength{\@tempdima}{#2}}%
}
\def\NCC@set@capkey#1#2#3#4{%
\@ifundefined{NCC@makecap#1@#4}
@@ -340,7 +506,6 @@
\let\@svsec\@empty
\NCC@makecaption{#3}{#1}{#4}{#2}{}%
\NCC@sec@reset@controls
- \NCC@defaultsectag
}
\long\def\NCC@caption#1#2#3[#4]#5{%
\def\NCC@make{\NCC@makecaption{#3}{#1}{#5}{#2}}%
@@ -349,12 +514,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
}
\long\def\NCC@makecaption#1#2#3#4#5{%
\begingroup\par\normalfont
@@ -363,14 +527,37 @@
\def\@tempa{#3}%
\ifx\@tempa\@empty \else \advance\@tempcnta\tw@ \fi
\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
\setlength\@tempskipa{#4}%
\ifdim\@tempskipa=\z@ \else \vskip \@tempskipa\fi
\fi
\endgroup
#5%
}
+\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
+}
+\def\NCC@ifzeroskip#1{%
+ \edef\@tempa{\the#1}\edef\@tempb{\the\z@skip}%
+ \ifx\@tempa\@tempb
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
\long\def\NCC@makecaptag@para#1{%
\ifnum\@tempcnta<\thr@@ \let\NCC@acapnum\@empty\fi
\NCC@apply@cap{style}{{\@svsec}\ignorespaces#1}%
@@ -397,8 +584,7 @@
\long\def\NCC@makecapstyle@right#1{\raggedleft#1}
\long\def\NCC@makecapstyle@center#1{\centering#1}
\long\def\NCC@makecapstyle@centerlast#1{%
- \leftskip\z@\@plus 1fil%
- \rightskip\z@\@plus -1fil%
+ \leftskip\@flushglue \rightskip -\@flushglue
\parfillskip\z@\@plus 2fil\relax#1%
}
\newcommand*{\RegisterFloatType}[1]{%
@@ -423,13 +609,18 @@
\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
+ \NCC@startmainsec{%
+ \NCC@hangfrom{\hskip #3}\NCC@adjsecmargins{}\@flushglue
+ \ignorespaces}%
{#4}{#5}{#6}{#7}%
}%
\else
@@ -441,14 +632,19 @@
\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@
\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}%
@@ -456,6 +652,17 @@
\fi
}
\@onlypreamble\NCC@dsecx
+\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
+}
\def\NCC@dsecf#1#2#3#4#5{%
\expandafter\def\csname NCC@cap@#1\endcsname{%
\def\NCC@makesectag####1{#2{\csname #1name\endcsname}%
@@ -464,6 +671,16 @@
}%
}
\@onlypreamble\NCC@dsectf
+\@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
+}
\long\def\@makecaption#1#2{%
\begingroup
\skipwritingtoaux
@@ -471,32 +688,44 @@
\csname NCC@cap@\@captype\endcsname[]{#2}%
\endgroup
}
-\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
+ }
+}
+\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}%
+ }
+}
+\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
+ }}%
+ }
}
\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]{%
\ifnum#1<\z@
@@ -512,7 +741,7 @@
\if@tempswa
\@tempcnta#1\relax
\@tempcnta -\@tempcnta
- \PackageError{nccsect}
+ \PackageError{nccsect}%
{Float type registration number \the\@tempcnta\space
is out of range}{}%
\fi
@@ -527,11 +756,35 @@
\@tempa{\NCC@tocentry{#1}{#2}{#3}{#4}{#5}}%
\@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}}
+\def\NCC@tocadj#1{%
+ \settowidth\@tempdima{\let\NCC@atocdo\@firstoftwo#1}%
+ \advance\@tempdimb\@tempdima
+}
+\@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}{%
+ \TOCMarginDrift{1fil}%
+ \addpenalty{-\@highpenalty}#1%
+ }{#3}{#4}{#5}{##1}{\hss##2}%
+ \nobreak \vskip #2\relax
+ \@nobreaktrue
+ \everypar{\@nobreakfalse\everypar{}}%
+ }%
+ }
+ \@onlypreamble\DeclareTOCPart
+ \@onlypreamble\NCC@dtocpart
+}
\def\NCC@tocentry#1#2#3#4#5#6#7{%
\ifnum #1>\c@tocdepth \else
\par\begingroup\normalfont #2%
@@ -540,17 +793,20 @@
\@whilenum \@tempcnta >\z@\do
{\@nameuse{l@tocskip@\romannumeral \@tempcnta}%
\advance\@tempcnta\m@ne}%
- \def\NCC@maketocnum##1{\NCC@do{#5}{}{#3##1\NCC@atocnum}}%
- \settowidth\@tempdima{\let\NCC@do\@firstoftwo\NCC@maketocnum{#4}}%
+ \NCC@preparetocnum{#5}{#3}%
+ \settowidth\@tempdima{\let\NCC@atocdo\@firstoftwo\NCC@maketocnum{#4}}%
\@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}}%
\@nobreakfalse
\endgroup
\fi
}
-\def\NCC@tocadj#1{\settowidth\@tempdima{#1}\advance\@tempdimb\@tempdima}
-\def\numberline#1{%
+\def\NCC@preparetocnum#1#2{%
+ \def\NCC@maketocnum##1{\NCC@atocdo{#1}{}{#2##1\NCC@atocnum}}%
+}
+\def\NCC@tocentrytitle#1#2{#1{\ignorespaces#2}}
+\DeclareRobustCommand*\numberline[1]{%
\setbox\@tempboxa\hbox{\NCC@maketocnum{#1}}%
\ifdim \wd\@tempboxa > \@tempdima
\box\@tempboxa
@@ -559,15 +815,15 @@
\fi
\ignorespaces
}
-\def\NCC@maketocnum#1{#1\let\NCC@do\@secondoftwo\NCC@atocnum}
-\newcommand*{\NumberlineSuffix}[2]{\def\NCC@atocnum{\NCC@do{#1}{#2}}}
+\def\NCC@maketocnum#1{#1\NCC@atocnum}
+\let\NCC@atocdo\@secondoftwo
+\newcommand*{\NumberlineSuffix}[2]{\def\NCC@atocnum{\NCC@atocdo{#1}{#2}}}
\@onlypreamble\NumberlineSuffix
\newcommand*\TOCMarginDrift[1]{%
\def\@tempa{#1}%
\ifx\@tempa\@empty \let\NCC@tocdrift\@empty
\else \def\NCC@tocdrift{\@plus #1\relax}\fi
}
-\TOCMarginDrift{}
\newcommand*{\PnumPrototype}[1]{\def\NCC@pnum{#1}\NCC@setpnum}
\@onlypreamble\PnumPrototype
\def\NCC@setpnum{%
@@ -576,14 +832,30 @@
\advance\@tempdima 1em
\edef\@tocrmarg{\the\@tempdima \noexpand\NCC@tocdrift}%
}
-\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
}
-\newcommand\StartFromHeaderArea{%
- \StartFromTextArea
- \vskip -\headsep \vskip -\ht\strutbox
+\@ifpackageloaded{textarea}{}{%
+ \newcommand\StartFromTextArea{\par
+ {\parskip\z@ \strut\par}\vskip -\baselineskip
+ }
+ \newcommand\StartFromHeaderArea{%
+ \StartFromTextArea
+ \vskip -\headsep \vskip -\ht\strutbox
+ }
}
\newcommand{\bff}{\normalfont\bfseries\mathversion{bold}}
+\newcommand*\aftersectionvspace[1]{%
+ \ifvmode \if@nobreak
+ \vskip -\lastskip \vskip #1\relax
+ \fi \fi
+}
\newcommand*{\startsection}[1]{%
\ifnum#1>\z@
\def\@tempa{\csname NCC@section\romannumeral#1\endcsname}%
@@ -591,11 +863,12 @@
\ifnum#1=\z@
\def\@tempa{\NCC@mainsection}%
\else
- \def\@tempa{\part}%
+ \def\@tempa{\NCC@partsection}%
\fi
\fi
\@tempa
}
+\def\part{\startsection\m@ne}
\def\section{\startsection\@ne}
\def\subsection{\startsection\tw@}
\def\subsubsection{\startsection\thr@@}
@@ -634,7 +907,6 @@
\DeclareSection5{subparagraph}[\parindent]{}%
{\NCC@runskip}{-1em}{\normalsize\bff}
\@ifundefined{chapter}{
- \def\part{\startsection\z@}
\DeclareSection*0{part}{\Large\bff}%
{5ex \@plus 1ex \@minus .2ex}%
{4ex \@plus .2ex}{\huge\bff}
@@ -645,11 +917,32 @@
\DeclareTOCEntry2{}{}{9.9}{}
\DeclareTOCEntry3{}{}{9.9.9}{}
}{
+ \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
\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]
@@ -664,12 +957,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{}
\endinput
%%
%% End of file `nccsect.sty'.