I currently try to document a LaTeX-package with several keys. When I use the internal tools of the tcolorbox documentation library, I get some ugly results.
\documentclass{scrartcl}
\usepackage{showframe}
\usepackage{tcolorbox}
\tcbuselibrary{documentation}
\begin{document}
\begin{docKey}[my/very/long/keypath]{myKey}{=\marg{value}}{}
This is a very very very (very) very long description of the \refKey{/my/very/long/keypath/myKey}
\end{docKey}
\end{document}
This leads to
which can definitely be improved.
Is there a way to only get the last part (the key itself) when referencing the key? Are there other ways to break the reference at line endings?
After some searching through the documentation, I found this part, which should be relevant for my question (lines 808 ff.):
\NewDocumentCommand\tcb@ref@doc{msm}{%
\hyperref[#1:#3]{\texttt{\ref*{#1:#3}}%
\IfBooleanTF{#2}{}{%
\ifnum\getpagerefnumber{#1:#3}=\thepage\relax%
\else%
\textsuperscript{\ding{213}\,\kvtcb@text@pageshort\,\pageref*{#1:#3}}%
\fi}}%
}
\def\refCom{\tcb@ref@doc{com}}
\def\refEnv{\tcb@ref@doc{env}}
\def\refKey{\tcb@ref@doc{key}}
What I probably need is a replacement for the \ref*{#1:#3}
which extracts the last element of a /
-separated list from the reference. But unfortunately I don't know, how I could achieve that.