As of version 3, the doc
package provides reportchangedates
option to display dates along with package changes. I want to remove the word "General" and the colon that follows it from the list of changes. Removing "General" is trivial using \renewcommand{\generalname}{}
but the removing the colon is harder. Prior doc 3
I had been using a hack based on this solution https://tex.stackexchange.com/a/283894/218142 and it worked fine, and still does. This hack doesn't address the reportchangedates
option and in fact makes it superfluous. I thought I could use a similar hack by using the new doc 3
code
\def\changes@#1#2#3{%
\protected@edef\@tempa{\noexpand\glossary{#1%
\ifdoc@reportchangedates
\space -- #2\fi
\levelchar
\ifx\saved@macroname\@empty
\quotechar!%
\actualchar
\generalname
\else
\saved@indexname
\actualchar
\string\verb% % to fool emacs highlighting
\quotechar*%
\verbatimchar\saved@macroname
\verbatimchar
\fi
:\levelchar #3}}% <- I NEED TO CHANGE THIS LINE
\@tempa\endgroup\@esphack}
but when I do, I get an error that \saved@indexname
is an undefined control sequence. I have tried defining and redefining it and nothing works. I am using the tcolorbox
documentation
library if that matters (I have looked at its source code and haven't found anything obvious). I see in the doc 3
source code that \saved@indexname
is initially empty and I see where it is eventually conditionally redefined to \expandafter\@gobble\saved@macroname
but that change doesn't seem to help because then I get an error that \saved@macroname
is undefined, but it is ostensibly initialized to be empty and I don't see how it is being changed.
I have whittled down a MWE .dtx
file below, which must be named sample.dtx
to work properly. The old hack that works is commented out; the new attempt is the functional one. Only .pdf
and .sty
files (no .ins
file) will be created.
% \iffalse meta-comment
% !TEX program = lualatexmk
% \fi
%
% \iffalse
%
%<*internal>
\iffalse
%</internal>
%
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\usedir{tex/latex/sample}
\preamble
Big Premamble
\endpreamble
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\obeyspaces
\Msg{*************************************************************}
\Msg{* *}
\Msg{* To finish the installation, open a command line and *}
\Msg{* type the following, repeating 2-4 until there are no *}
\Msg{* warnings: *}
\Msg{* 2. lualatex sample.dtx (lualatex is required) *}
\Msg{* 3. makeindex -s gind.ist -o sample.ind sample.idx *}
\Msg{* 4. makeindex -s gglo.ist -o sample.gls sample.glo *}
\Msg{* Move the *.sty file into a directory searched by TeX. *}
\Msg{* *}
\Msg{*************************************************************}
%</install>
%<install>\endbatchfile
%
%<*internal>
\usedir{tex/latex/sample}
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%
%<*driver>
\documentclass[10pt,letterpaper,nohyperref]{ltxdoc} % let tcolorbox load hyperref
%\documentclass[10pt,letterpaper]{article}
%\usepackage[nohyperref]{doc}
\SetupDoc{reportchangedates}
\usepackage{\jobname}
\PassOptionsToPackage{listings,documentation}{tcolorbox}
\usepackage[listings,documentation]{tcolorbox}
\hypersetup{colorlinks=true}
\tcbset{%
index german settings,%
color hyperlink = blue,%
}%
% See https://tex.stackexchange.com/q/156383/218142
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\sample}{\textsf{sample}}
%%%%% Local Hack That Works
^^A\renewcommand{\generalname}{} % gets rid of General
^^A\makeatletter
^^A\renewcommand*{\changes@}[3]{%
^^A \protected@edef\@tempa{%
^^A \noexpand\glossary{#1 -- #2\levelchar % formatted as in doc v3
^^A \ifx\saved@macroname\@empty
^^A \space\actualchar\generalname
^^A \else
^^A \expandafter\@gobble\saved@macroname
^^A \actualchar
^^A \string\verb\quotechar*\verbatimchar\saved@macroname\verbatimchar
^^A \fi
^^A #3}}% <-- IT'S THIS LINE I CHANGED
^^A \@tempa
^^A \endgroup
^^A \@esphack
^^A}%
^^A\makeatother
%%%%% End Local Hack That Works
%%%%% Local Hack That Doesn't Work
\renewcommand{\generalname}{} % gets rid of General
\makeatletter
\renewcommand*{\changes@}[3]{%
\protected@edef\@tempa{\noexpand\glossary{#1%
\ifdoc@reportchangedates
\space -- #2\fi
\levelchar
\ifx\saved@macroname\@empty
\quotechar!%
\actualchar
\generalname
\else
\saved@indexname
\actualchar
\string\verb% % to fool emacs highlighting
\quotechar*%
\verbatimchar\saved@macroname
\verbatimchar
\fi
#3}}% <-- IT'S THIS LINE I CHANGED
\@tempa\endgroup\@esphack}
\makeatother
%%%%% End Local Hack That Doesn't Work
\DisableCrossrefs
\PageIndex
\CodelineNumbered
\RecordChanges
\begin{document}
\DocInput{\jobname.dtx}
\newpage
\PrintIndex
\PrintChanges
\end{document}
%</driver>
% \fi
%
% \IndexPrologue{\section{Index}Page numbers refer to page where the
% corresponding entry is documented and/or referenced.}
%
% \changes{v1.0.0}{2022-06-29}{Initial release}
% \section{Introduction}
% The \sample{} package is silly and does absolutely nothing useful.
%
% \subsection{Nothing Much}
% There's not much to say here.
%
% \subsection{The first command}
%\iffalse
%<*example>
%\fi
\begin{docCommand}{sampleversion}{}
Typesets the current version and build date.
\end{docCommand}
\begin{dispExample*}{sidebyside = false}
The version is \sampleversion{} and is a stable build.
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% \MaybeStop{}
%
% \section{\sample\ Source Code}
% This is the complete source code to the \sample{} package.
%
% \iffalse
%<*package>
% \fi
%
% \begin{macrocode}
\def\sample@version{1.0.0}
\def\sample@date{2022-06-29}
\NeedsTeXFormat{LaTeX2e}[2020-02-02]
\DeclareRelease{v1.0.0}{2022-06-29}{sample.sty}
\DeclareCurrentRelease{v\sample@version}{\sample@date}
\ProvidesPackage{sample}
[\sample@date\space v\sample@version\space A silly sample]
% \end{macrocode}
%
% Define a convenient package version command.
% \changes{v1.0.0}{2022-06-29}{Added a macro.}
% \begin{macrocode}
\newcommand*{\sampleversion}{v\sample@version\space dated \sample@date}
% \end{macrocode}
%
% \begin{macrocode}
\RequirePackage{iftex} % needed for requiring LuaLaTeX
\RequirePackage{unicode-math} % needed for Unicode support
\RequireLuaTeX % require this engine
% \end{macrocode}
%
% \iffalse
%</package>
% \fi
% \Finale
\saved
, which mean that you messed up the catcode of@
with your hack. And I know that there is no option. But did you ever requested it?