0

When I create documentation using doc the page numbers in my Change History become hyperlinks. That doesn't happen when I use tcolorbox's documentation library. Is there a way to get page numbers to become hyperlinks using tcolorbox's documentation library? I have experimented with various options and settings in the tcolorbox documentation and thus far nothing has worked.

I can easily place hyperlinks in the text I use in the change history entries, but I would prefer hyperlinked page numbers.

Here is my working (except for the issue described above) MWE:

% \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
PREAMBLE
\endpreamble

\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
%</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}
\SetupDoc{reportchangedates}
\usepackage{\jobname}
\PassOptionsToPackage{listings,documentation}{tcolorbox}
\usepackage[listings,documentation]{tcolorbox}
\hypersetup{colorlinks=true}
\tcbset{%
  %index format = doc,%
  index german settings,%
  index gather none,%
}%
\usepackage[left = 1.00in,%
            right = 1.00in,%
            marginparwidth = 0.70in]{geometry}
\newcommand*{\pkg}{\textsf}
\newcommand*{\sample}{\pkg{sample}}

%\OnlyDescription
\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.}
% \GlossaryPrologue{\section{Change History}}
%
% \changes{v1.0.0}{2022-07-03}{Initial release}
% \newgeometry{left=1.50in,right=1.00in,top=0.50in,bottom=0.50in}
% \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
%
% \restoregeometry
% \MaybeStop{}
%
% \newgeometry{left=1.50in,right=0.50in,top=1.00in,bottom=1.00in}
% \section{\sample\ Source Code}
% This is the complete source code to the \sample{} package.
%
% \iffalse ^^A comment out to typeset the guard; put inside macrocode to typeset
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \fi
%
%    \begin{macrocode}
\def\sample@version{1.0.0}
\def\sample@date{2022-07-03}
\NeedsTeXFormat{LaTeX2e}[2020-02-02]
\DeclareRelease{v1.0.0}{2022-07-03}{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-07-03}{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 ^^A comment out to typeset the guard; put inside macrocode to typeset
%    \begin{macrocode}
%</package>
%    \end{macrocode}
% \fi
% \restoregeometry
% \Finale
2
  • If removing class option nohyperref from ltxdoc is not feasible, then you need to manually load hypdoc package. Commented Jul 3, 2022 at 21:21
  • I deleted my answer because it seems to not work. Maybe you can post an answer yourself. Commented Jul 3, 2022 at 23:51

1 Answer 1

0

I don't like answering my own questions but decided to do so in this case. The solution is, as @muzimuzhi says, is to load hypdoc. I was looking for a way to accomplish the task that doesn't throw the warning hypdoc issues regarding the loading of hyperref but apparently there's not yet a way to do that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .