Background
A custom Table of Contents entry was suggested to move page numbers from the right-hand side to the left-hand side.
Problem
The custom command loses ToC hyperlinks. I have tried to restore the hyperlinks as follows:
\goto{#3}[page(\currentlistentrylocation)]
This does not produce the correct page number link. Similar attempts include:
- \goto{#3}[#3]
- \gotopage{#3}
- \goto{#3}[page(#3)]
It seems that these commands cannot reference a page number indirectly.
Code
Minimal example:
\setupinteraction[state=start,]
\setupcombinedlist[content][interaction=all,]
% Set the page number to the left of the section title.
\define[3]\SectionToCEntry{%
\par \leftaligned\bgroup
\hbox to 2em{\goto{#3}[page(\currentlistentrylocation)]}%
\hskip 1em
\vtop{\hsize\dimexpr\textwidth-3em\relax#2}
\egroup \par%
}
\setuplist[section][
alternative=command,
command=\SectionToCEntry,
]
\starttext
\placecontent
\dorecurse{4}{
\page
\section[title={Section A}]
\dorecurse{5}{\input knuth}
\section[title={Section B}]
\dorecurse{5}{\input ward}
}
\stoptext
Question
I am wondering:
- how would you retain the internal hyperlinks for such a custom ToC; or
- is there a simpler approach to reconfiguring the ToC?
Related
Additional information:
\hbox \strc_lists_get_reference_attribute\v!all– Marco Feb 26 '14 at 07:47