Skip to content

Manual index hand-pagination workflow for the MIT Press print PDF #1236

Description

@martin-henz

Background

The PDF index can be built two ways:

  • Auto-generated (default): latexmk runs makeindex -l <base>.idx (see scripts/latexmkrc) producing <base>.ind, which mitpress/mit.cls inputs via \printindex{<base>}\@input{<base>.ind}.
  • Hand-edited: if \UseHandEditedIndex{} is set in the preamble, mit.cls instead inputs hand-paginated.ind (mitpress/mit.cls:1292), a manually page-break-corrected copy of the index.

The hand-edited path exists because, for the printed book, makeindex's automatic column/page breaks aren't good enough — the index is hand-paginated just before sending the PDF to MIT Press.

Current state / problem

  • The committed latex_pdf/hand-paginated.ind is obsolete — the index has improved since it was made, so forcing it via \UseHandEditedIndex{} shipped a stale index on every build.
  • It also blocked the Python edition PDF: \UseHandEditedIndex{} lives in the shared preamble, so SICP_EDITION=py would try to \@input{hand-paginated.ind} (absent in latex_pdf_py/), and do.sh clean() would mv a non-existent file.

Change

The default build now uses the auto-generated <base>.ind (the \UseHandEditedIndex{} line in javascript/latexContent.js is commented out). A reference copy of the old hand-edited file is kept as latex_pdf/hand-paginated-example.ind so the expected format is visible.

Manual hand-pagination workflow (pre-MIT-Press, JS edition only)

When preparing the final print PDF:

  1. Build once to generate a fresh latex_pdf/sicpjs.ind (the improved auto index).
  2. Copy it to latex_pdf/hand-paginated.ind and hand-edit the page breaks / column balance (see hand-paginated-example.ind for the format).
  3. Uncomment \UseHandEditedIndex{} in javascript/latexContent.js.
  4. Rebuild the PDF (yarn pdf). The build now uses your hand-edited index.
  5. Revert the latexContent.js change after producing the print PDF so normal builds stay on the auto index.

Notes:

  • hand-paginated.ind is per-edition and lives in the edition's latex_pdf*/ dir. do.sh clean() keeps any hand-paginated*.ind there — matched by filename, committed or not — while wiping the generated artifacts, so an in-progress hand-edited index survives a clean.
  • This is a JS-edition concern; the Python edition has no hand-paginated index.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions