LaTeX Package: DocRef v0.3.1 2026-11-30
----------------------------------------

Cross-references to external LaTeX package documentation.

## Description

`docref` retrieves reference numbers, titles, and page numbers from locally
available package manuals. It requires LuaLaTeX.

## Usage

~~~latex
\documentclass{article}
\usepackage{docref}
\usepackage{hyperref} % optional
\begin{document}
See Section~\docref{babel}{selectors},
``\docnameref{babel}{selectors}'',
on page~\docpageref{babel}{selectors}.
\end{document}
~~~

All three commands take a package name and label. With `hyperref`, references
link to the PDF manual; starred forms suppress links. Unresolved values
produce `??` and a warning.

Common documentation source names are discovered automatically. To select
a source or auxiliary file explicitly, use:

~~~latex
\DocRefSource{pkg}{build/manual.aux}[build/manual.pdf]
~~~

The first file may be `.tex`, `.ltx`, `.dtx`, or `.aux`; the optional final
argument specifies a PDF file or URL. Auxiliary records support all label
types, including figures, tables, equations, and custom counters. Titles
require `nameref` or `hyperref` in the target manual; exact destinations
require `hyperref` there. Without auxiliary records, lookup is limited to
source headings and PDF information.

When no source label is available, `\DocRefPDF{pkg}{manual.pdf}[URL]`
and `\DocRefBookmark{pkg}{label}{Heading title}` select a PDF
bookmark by its exact, unique title. The local PDF supplies the reference
data; a number is available only if it appears in the bookmark. Register the
PDF first. Repeated titles are ambiguous even when they share a destination.
Direct destinations without an identical named destination are displayed
without a link. The optional URL selects the link target; query strings are
preserved and any existing fragment is replaced by the destination. The
online PDF must have the same named destinations as the local PDF.
Bookmarks targeting an external document are not resolved.

## Tests

The regression checks require LuaLaTeX, the TeX packages used by the test
fixtures, `pdftotext` (Poppler), and Python 3 with `pypdf`. Run
`python3 test/check-pdf-bookmarks.py` for PDF bookmarks. The complete suite
can be run with `python3 test/run-tests.py`; generated files stay in temporary
directories. Persian fixtures require the Amiri font.

## Installation

Keep `docref.sty` and `docref.lua` together beside your document or in a
TeX-searchable directory.

## Documentation

See the [main manual](doc/docref.pdf) for lookup rules and examples.

## License and maintainer

- License: LPPL 1.3c or later.
- Maintainer: Amer Amikhteh.
