0

My interest is to learn about available tools, including success stories. Admittedly, some tools at CTAN are maintained and others not. Not requested is a solution to the problem outlined below. The problem detail only applies to explain how the hyperlinks are used and why hyperlink management tools are required.

A related question was asked in December 2019 by Martin J. Osborne: Making cross-references hyperlinks ... Answers to his question apply to organization of a book which will be split into two PDF files: book.pdf and answers.pdf. Also appearing there are ideas that apply to the present question. The ideas apply to authors who are trying to organize their LaTeX book for cross referencing. The information is valuable, although labor-intensive to implement on completed books being prepared for publication.

Sample Problem: The mathematics textbook book.tex of 1300 pages makes a PDF or paperback containing 3500+ exercises but no appendix of answers and solutions. The answers, solutions and corrections are in a separate file answers.tex published on GitHub in answers.pdf with exercise source, answer, solution and corrections. Hyperlinks are used in both PDF files. The Amazon paperback is a print of a single PDF version of book.pdf.

File answers.tex for GitHub contains only \usepackage, \include and \input commands. The exercises are in separate files by section with cross-references to the text content. GitHub contributors cause dynamic corrections and new content. File answers.pdf of exercise statements and answers is expected to change content and reference locations as the textbook goes through new editions.

Relevant CTAN Package. One tool that exists on CTAN is package parselines, written by Florent Chervet (2010): CTAN parselines

His package provides a solid method for adding aux entries from one LaTeX source to the aux entries of a second LaTeX source. The book.tex aux entries are used to define some hyperlinks between the two PDF output files book.pdf and answers.pdf.

If the PDF reader displaying answers.pdf shows a hyperlink, then it has to make sense in the paperback but also act as a browser hyperlink to book.pdf. The exercises also have navigation hyperlinks within answers.pdf.

Below is a minimum example which shows how Chervet's CTAN package applies to the mathematics book problem outlined above.

File testfile.aux is a file of aux entries in answers,aux that reference book.tex.

% testfile.aux 
% CONTENT: Certain hyperlink labels extracted from the book PDF LaTeX source
%\newlabel{1-10.ex.solver-matlab}{{A.29}{1249}{Computer Algebra Methods}{ExampleA.A.29}{}}
%\newlabel{1-3.proof.newton-cooling}{{\relax }{14}{Details and Proofs}{subsection.1.1.11}{}}
%\newlabel{1-3.proof.logistic-solution}{{\relax }{14}{Details and Proofs}{subsection.1.1.11}{}}

File testwriteaux.tex

% testwriteaux.tex: Uses two methods of Florent Chervet
%% TASK: append the aux file of the exercises PDF LaTeX source
%% UNEXPECTED: **Chervet** defines environment "parse lines" not "parselines"
%% The environment name contains a space char!
\documentclass{article}
\usepackage{hyperref}%  Require aux entries compatible with CTAN hyperref
\usepackage{parselines}% https://ctan.org/tex-archive/macros/latex/contrib/parselines
\makeatletter\long\def\addtoaux#1{\write\@mainaux{\protect#1}}\makeatother
\begin{document}
\tableofcontents
\section{Introduction}
The first key example is the exponential model
$$\frac{d}{dt}y=ky,\quad\mbox{with unique solution}\quad y(t)=y(0)e^{kt}$$
\section{Exponential Models}
See Example \ref{1-3.ex.compound-interest} on page \pageref{1-3.ex.compound-interest}
% First method:
\begin{parse lines}{\addtoaux{#1}}
\newlabel{1-10.ex.solver-maple}{{A.28}{1248}{Computer Algebra Methods}{ExampleA.A.28}{}}
\newlabel{1-3.ex.compound-interest}{{1.11}{28}{Examples}{ExampleA.1.11}{}}
\end{parse lines}
\let\do\addtoaux\dofilebyline{**testfile.aux**}%
\end{document}

The textbook and exercises example uses only the last line of testwriteaux.tex. Hyperlinks in \ref and \pageref cause maintenance work for the two PDF outputs, which can be done by Linux tools outside LaTeX. Clumsy and really no fun at all. Are LaTeX tools a better choice?

  • well normally I would make cross references with xr-hyper. – Ulrike Fischer Mar 16 '21 at 18:17
  • Danie Els in 2012 wrote about using CTAN package xr-hyper: link The post has 2017 comments by David Carlisle about CTAN package hypgotoe, link (2019). Package xr-hyper Feb 2021 is here: link and there is mention of 2020 CTAN package zref: link which has relevant module zref-xr among others. Are there recent success stories using any of these packages? – Grant Gustafson Mar 18 '21 at 12:27
  • hypgotoe is irrelevant as it is about embedded files. xr-hyper should normally work, if there is a problem: open an issue at the github repository with a complete example and we can look at it. If you want to combine it with zref, you perhaps need to do some work as not all hyperlinking works. See e.g. https://tex.stackexchange.com/a/538740/2388. – Ulrike Fischer Mar 18 '21 at 13:34

0 Answers0