pgf-tikz / pgf

A Portable Graphic Format for TeX
https://pgf-tikz.github.io/
1.08k stars 104 forks source link

Adjustments for index #1307

Open daleif opened 4 months ago

daleif commented 4 months ago

Version

3.1.10

Details

This is rather a suggestion for the manual: Add bookmarks for letter groups of the index to for easier navigation.

I've played with the code from the repro and it seems to work just fine. As my git foo is poor, I'll currently not be doing a PR, but will describe what I did.

build.lua

Add the line

indexstyle = "pgfmanual-index.ist"

And change docfiles to

docfiles =
  {
    "RELEASE_NOTES.md", "description.html", -- Part of the release script
    "color.cfg", "pgfmanual.cfg", "images", "plots", "pgfmanual-index.ist", "*.tex" -- Build the manual
  }

(added pgfmanual-index.ist)

pgf/doc/generic/pgf/pgfmanual-en-main-body.tex

Replace the line

\usepackage{imakeidx}

by

\usepackage{makeidx}

(you're building using l3build which runs makeindex so there is no need for imakeidx)

Add .ist file

In the same folder as pgfmanual.tex add the file pgfmanual-index.idx with the contents

preamble "\\begin{theindex}\n\\providecommand{\\doidxbookmark}[1]{\\pdfbookmark[2]{#1}{#1-idx}}\n"
headings_flag 1
heading_prefix "\\doidxbookmark{"
heading_suffix "}"

Then compile the manual using

l3build doc

By default l3build uses gind.ist which has a different look than the makeindex default (which is what the imakeidx uses), the style above just adjusts the makeindex defaults a bit in order to add bookmarks to each letter group, but will not print them (feel free to adjust this) so the printed index will look just like it does in the current release.

daleif commented 4 months ago

We can add a lot more to the indexes than this, but at least this is a start.