texlive[60483] Master/texmf-dist: crumbs (12sep21)

commits+karl at tug.org commits+karl at tug.org
Sun Sep 12 22:34:58 CEST 2021


Revision: 60483
          http://tug.org/svn/texlive?view=revision&revision=60483
Author:   karl
Date:     2021-09-12 22:34:58 +0200 (Sun, 12 Sep 2021)
Log Message:
-----------
crumbs (12sep21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/crumbs/crumbs.pdf
    trunk/Master/texmf-dist/doc/latex/crumbs/crumbs.tex
    trunk/Master/texmf-dist/tex/latex/crumbs/crumbs.sty

Modified: trunk/Master/texmf-dist/doc/latex/crumbs/crumbs.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/crumbs/crumbs.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/crumbs/crumbs.tex	2021-09-12 20:34:26 UTC (rev 60482)
+++ trunk/Master/texmf-dist/doc/latex/crumbs/crumbs.tex	2021-09-12 20:34:58 UTC (rev 60483)
@@ -42,7 +42,7 @@
 
 \title{\ff{crumbs}: \LaTeX{} Package \\ for Navigation Crumbs}
 \author{Yegor Bugayenko}
-\date{0.2.2 2021/09/09}
+\date{0.3.0 2021/09/12}
 
 \begin{document}
 \pagenumbering{gobble}
@@ -114,6 +114,27 @@
 
 \subsection{How to Contribute}
 
+You may turn on the ``dry'' mode, which will prohibit the package to
+renew \ff{\char`\\section\{\}} and \ff{\char`\\subsection\{\}} commands.
+You will still be able to use the crumbs mechanism through
+\ff{\char`\\crumbection\{\}} and \ff{\char`\\subcrumbection\{\}}
+commands, for example:
+
+\begin{ffcode}
+\documentclass{article}
+\usepackage[dry]{crumbs}
+\begin{document}
+\crumbection[Intro]{Introduction} % Add it to \crumbs
+\section{Introduction} % Print it to the page
+Hello, world!
+\end{document}
+\end{ffcode}
+
+You can also instruct it to increment
+\ff{\char`\\section\{\}} and \ff{\char`\\subsection\{\}}
+on each call to \ff{\char`\\crumbection\{\}} and \ff{\char`\\subcrumbection\{\}}
+respectively. Just use the \ff{increment} package option.
+
 More details about this package you can find
 in the \ff{yegor256/crumbs} GitHub repository.
 

Modified: trunk/Master/texmf-dist/tex/latex/crumbs/crumbs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/crumbs/crumbs.sty	2021-09-12 20:34:26 UTC (rev 60482)
+++ trunk/Master/texmf-dist/tex/latex/crumbs/crumbs.sty	2021-09-12 20:34:58 UTC (rev 60483)
@@ -21,13 +21,19 @@
 % SOFTWARE.
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{crumbs}[2021/09/09 0.2.2 Navigation Crumbs]
+\ProvidesPackage{crumbs}[2021/09/12 0.3.0 Navigation Crumbs]
 
+\makeatletter\newif\ifcrumbs at dry\makeatother
+\makeatletter\DeclareOption{dry}{\crumbs at drytrue}\makeatother
+\makeatletter\newif\ifcrumbs at increment\makeatother
+\makeatletter\DeclareOption{increment}{\crumbs at incrementtrue}\makeatother
+\ProcessOptions\relax
+
 \RequirePackage{etoolbox}
 
 % see https://tex.stackexchange.com/a/12414/1449
-\makeatletter\newcommand\back{\@backslashchar}\makeatother
-\makeatletter\newcommand\percent{\@percentchar}\makeatother
+\makeatletter\newcommand\crumbs at back{\@backslashchar}\makeatother
+% \makeatletter\newcommand\crumbs at percent{\@percentchar}\makeatother
 \RequirePackage{catchfile}
   \newwrite\appendwrite
   \newcommand*\appendtofile[2]{%
@@ -49,46 +55,59 @@
   \fi
 }
 
-\NewCommandCopy\crumbsoldsection\section
-\renewcommand\section[2][]{
-  \def\temp{#1}
-  \ifx\crumbs\empty
+\makeatletter\newcommand\crumbection[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}
-}
+      \crumbs at back ifx \crumbs at back crumbs \crumbs at back empty
+        \crumbs at back gappto \crumbs at back crumbs{\crumbs at back setcounter{crumbi}{0}}
+      \crumbs at back fi
+      \crumbs at back gappto\crumbs at back crumbs{\crumbs at back stepcounter{crumbi}\crumbs at back crumb{\ifx\temp\empty #2\else #1\fi}{#2}}
+    }%
+  \fi%
+  \ifcrumbs at increment\stepcounter{section}\fi%
+}\makeatother
 
-\NewCommandCopy\crumbsoldsubsection\subsection
-\renewcommand\subsection[2][]{
-  \def\temp{#1}
-  \ifx\crumbs\empty
+\makeatletter\newcommand\subcrumbection[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}
+      \crumbs at back ifcsname crumbs\romannumeral\the\value{section}\crumbs at back endcsname\crumbs at back else
+        \crumbs at back expandafter\crumbs at back newcommand\crumbs at back csname crumbs\romannumeral\the\value{section}\crumbs at back endcsname{%
+          \crumbs at 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}
+      \crumbs at back fi
+      \crumbs at back expandafter\crumbs at back gappto\crumbs at back csname crumbs\romannumeral\the\value{section}\crumbs at back endcsname{%
+        \crumbs at back stepcounter{subcrumbi}
+        \crumbs at back subcrumb{\ifx\temp\empty #2\else #1\fi}{#2}
       }
-    }
-  \fi
-  \crumbsoldsubsection{#2}
-}
+    }%
+  \fi%
+  \ifcrumbs at increment\stepcounter{subsection}\fi%
+}\makeatother
 
+\makeatletter\ifcrumbs at dry
+  \message{Since "dry" mode is ON we don't renew "section" and "subsection" commands}
+\else
+  \NewCommandCopy\crumbs at oldsection\section
+  \renewcommand\section[2][]{%
+    \crumbection[#1]{#2}%
+    \crumbs at oldsection{#2}%
+  }
+  \NewCommandCopy\crumbs at oldsubsection\subsection
+  \renewcommand\subsection[2][]{%
+    \subcrumbection[#1]{#2}%
+    \crumbs at oldsubsection{#2}%
+  }
+\fi\makeatletter
+
 \ifcsname crumb\endcsname
-  \message{The command "crumb" already defined}
+  \message{The command "crumb" is already defined}
 \else
   \newcommand\crumb[2]{#1}
 \fi
 \ifcsname subcrumb\endcsname
-  \message{The command "crumb" already defined}
+  \message{The command "subcrumb" is already defined}
 \else
   \newcommand\subcrumb[2]{#1}
 \fi



More information about the tex-live-commits mailing list.