diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/gmutils/gmparts.sty |
Initial commit
Diffstat (limited to 'macros/latex/contrib/gmutils/gmparts.sty')
-rw-r--r-- | macros/latex/contrib/gmutils/gmparts.sty | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/macros/latex/contrib/gmutils/gmparts.sty b/macros/latex/contrib/gmutils/gmparts.sty new file mode 100644 index 0000000000..2551f47445 --- /dev/null +++ b/macros/latex/contrib/gmutils/gmparts.sty @@ -0,0 +1,165 @@ +%% +%% \iffalse ^^A we skip the debug setting +\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{} +%% \fi +%% ^^A $Id: TheUltimateMaster.gmd,v 0.352 2011/10/12 15:19:42 natror Exp natror $ +%% This is file “gmparts.sty” generated with the DocStrip utility. +%% +%% +%% The original source files were: +%% +%% gmutils/gmutils.gmd (with options: `parts') +%% +%% +%% Copyright © +%% by Grzegorz ‘Natror’ Murzynowski +%% natror (at) gmail (dot) com +%% +%% This program is subject to the LaTeX Project Public License. +%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +%% for the details of that license. +%% +%% LPPL status: "author-maintained". +%% +%% +%% +%% For documentation please refer to the file(s) +%% gmutils.{gmd,pdf}. +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{gmparts} + [2011/10/12 v0.996 modification of \string \include \space \string & in/excluding parts of main file (GM)] + + +%% +%% +%% ^^A\typeout{\unexpanded{#4}}%% + + +\RequirePackage{gmcommand} + +\def\gmu@getext#1.#2\@nil{%\UnDef + \def\gmu@filename{#1}%\UnDef + \def\gmu@fileext{#2}} + +\def\include#1{\relax + \ifnum\@auxout=\@partaux + \@latex@error{\string\include\space cannot be nested}\@eha + \else \@include#1 \fi} + +\def\@include#1 {% + \gmu@getext#1.\@nil + % \UnDef + \ifx\gmu@fileext\empty\def\gmu@fileext{tex}\fi + \clearpage + \if@filesw + \immediate\write\@mainaux{\string\@input{\gmu@filename.aux}}% + \fi + \@tempswatrue + \if@partsw + \@tempswafalse + \edef\reserved@b{#1}% + \@for\reserved@a:=\@partlist\do{% + \ifx\reserved@a\reserved@b\@tempswatrue\fi}% + \fi + \if@tempswa + \let\@auxout\@partaux + \if@filesw + \immediate\openout\@partaux \gmu@filename.aux + \immediate\write\@partaux{\relax}% + \fi + \@input@{\gmu@filename.\gmu@fileext}% + \inclasthook + \clearpage + \@writeckpt{\gmu@filename}% + \if@filesw + \immediate\closeout\@partaux + \fi + \else + \deadcycles\z@ + \@nameuse{cp@\gmu@filename}% + \fi + \let\@auxout\@mainaux +} + +\newcommand\whenonly[3]{% + \def\gmu@whonly{#1,}% + \ifx\gmu@whonly\@partlist\afterfi{#2}\else\afterfi{#3}\fi} + +\def\inclasthook{\thispagestyle{closing}} + +\def\filepart#1{\relax + \ifnum\@auxout=\@partaux + \@latex@error{\string\filepart\space cannot be nested}\@eha + \else\afterfi{\@filepart#1 }\fi} + +\def\@filepart#1 {% + \clearpage + \edef\gmu@filepartname{#1}% we'll use it later + \if@filesw + \immediate\write\@mainaux{\string\@input{#1.aux}}% + \fi + \@tempswatrue + \if@partsw + \@tempswafalse + \@for\gmu@filepart@resa:=\@partlist\do{% + \ifx\gmu@filepart@resa\gmu@filepartname\@tempswatrue\fi}% + \fi + \if@tempswa + \let\@auxout\@partaux + \if@filesw + \immediate\openout\@partaux #1.aux + \immediate\write\@partaux{\relax}% + \fi + \@xa\@firstoftwo + % \label{spart:iftrue} + \else + \deadcycles\z@ + \@nameuse{cp@\gmu@filepartname}% + \let\@auxout\@mainaux + \@xa\@secondoftwo + \fi + {\iftrue}% + {\let\endfilepart\fi + \csname gm@skipped@#1\endcsname + \def\next{\Restore@MacroSt {endfilepart}% + \@ifnextchar\bgroup{\show\NextBgroup\@gobble}{}}% + \@xa\next\iffalse}% +} + +\DeclareCommand\endfilepart{b}{% Note the argument is not used really. Maybe later we'll + % use it for checking of proper matching. Or maybe not. + \inclasthook + \clearpage + \@writeckpt{\gmu@filepartname}% + \if@filesw + \immediate\closeout\@partaux + \fi + \fi% this |\fi| closes |\Iftrue| put by line \ref{spart:iftrue}. + \let\@auxout\@mainaux +} + +\Store@Macro\endfilepart + +\def\nofileparts{% + \let\filepart\@gobble + \DeclareCommand\endfilepart{b}{}% +} + + +\def\includecountfix{% + \def\@wckptelt##1{% + \immediate\write\@partaux{% + \providecounter{##1}% to + % provide the font counters defined + % in parts of the document. + \string\setcounter{##1}{\the\@nameuse{c@##1}}}}% +} + +\pdef\providecounter#1{% + \unless\ifcsname c@#1\endcsname\newcounter{#1}\fi} + +\endinput +%% +%% End of file `gmparts.sty'. |