diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/crumbs/crumbs.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/crumbs/crumbs.sty | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/Master/texmf-dist/tex/latex/crumbs/crumbs.sty b/Master/texmf-dist/tex/latex/crumbs/crumbs.sty index 9c29b5dc785..89126af2fb0 100644 --- a/Master/texmf-dist/tex/latex/crumbs/crumbs.sty +++ b/Master/texmf-dist/tex/latex/crumbs/crumbs.sty @@ -21,7 +21,7 @@ % SOFTWARE. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{crumbs}[2021/09/04 0.1.0 Navigation Crumbs] +\ProvidesPackage{crumbs}[2021/09/06 0.2.1 Navigation Crumbs] \RequirePackage{etoolbox} @@ -49,44 +49,44 @@ \fi } +\NewCommandCopy\crumbsoldsection\section +\renewcommand\section[2][]{ + \def\temp{#1} + \ifx\crumbs\empty + \appendtofile{\jobname.crumbs}{ + \back ifx \back crumbs \back empty + \back gappto \back crumbs{\back setcounter{crumbi}{0}} + \back fi + \back gappto\back crumbs{\back stepcounter{crumbi}\back crumb{\ifx\temp\empty #2\else #1\fi}{#2}} + } + \fi + \crumbsoldsection{#2} +} + +\NewCommandCopy\crumbsoldsubsection\subsection +\renewcommand\subsection[2][]{ + \def\temp{#1} + \ifx\crumbs\empty + \appendtofile{\jobname.crumbs}{ + \back ifcsname crumbs\romannumeral\the\value{section}\back endcsname\back else + \back expandafter\back newcommand\back csname crumbs\romannumeral\the\value{section}\back endcsname{% + \back setcounter{subcrumbi}{0} + } + \back fi + \back expandafter\back gappto\back csname crumbs\romannumeral\the\value{section}\back endcsname{% + \back stepcounter{subcrumbi} + \back subcrumb{\ifx\temp\empty #2\else #1\fi}{#2} + } + } + \fi + \crumbsoldsubsection{#2} +} + \newcommand\crumb[2]{#1} \newcommand\subcrumb[2]{#1} \newcommand*\crumbs{} \newcounter{crumbi} \newcounter{subcrumbi} -\AtBeginDocument{ - \let\oldsection\section% - \renewcommand\section[2][]{ - \def\temp{#1} - \ifx\crumbs\empty - \appendtofile{\jobname.crumbs}{ - \back ifx \back crumbs \back empty - \back gappto \back crumbs{\back setcounter{crumbi}{0}} - \back fi - \back gappto\back crumbs{\back stepcounter{crumbi}\back crumb{\ifx\temp\empty #2\else #1\fi}{#2}} - } - \fi - \oldsection{#2} - }% - \let\oldsubsection\subsection - \renewcommand\subsection[2][]{ - \def\temp{#1} - \ifx\crumbs\empty - \appendtofile{\jobname.crumbs}{ - \back ifcsname crumbs\romannumeral\the\value{section}\back endcsname\back else - \back expandafter\back newcommand\back csname crumbs\romannumeral\the\value{section}\back endcsname{% - \back setcounter{subcrumbi}{0} - } - \back fi - \back expandafter\back gappto\back csname crumbs\romannumeral\the\value{section}\back endcsname{% - \back stepcounter{subcrumbi} - \back subcrumb{\ifx\temp\empty #2\else #1\fi}{#2} - } - } - \fi - \oldsubsection{#2} - }% - \IfFileExists{\jobname.crumbs}{\input{\jobname.crumbs}}{}% -} +\AtBeginDocument{\IfFileExists{\jobname.crumbs}{\input{\jobname.crumbs}}{}} \endinput |