Skip to content

Native line numbering for Word (docx) output #14624

Description

@dhagmann

Problem

Quarto has no built-in way to add line numbering to docx output, yet line numbers are a hard requirement for many manuscript-submission, legal, and peer-review workflows. Today the only recourse is to enable them by hand in Word after every render. The need was raised in discussion #6772 ("Adding line numbering to PDF and DOCX") — the PDF half was answered via the lineno package, but the docx half was never resolved.

Proposal

A format option to turn on continuous line numbering for docx:

format:
  docx:
    line-numbers: true

(Option name is the maintainers' call; it could eventually unify with PDF lineno and Typst's native line numbering into one cross-format option — what that discussion originally asked for. This request is scoped to docx, where there is no path today.)

Why this needs format-level support

Word stores line numbering as <w:lnNumType> inside a section's <w:sectPr>. The correct place for it is the document's existing main <w:sectPr> — the one that already carries the headerReferences and pgSz — so the running head and page size are preserved. A Lua filter/extension can't reach that section (it comes from the reference doc and is written by pandoc after filters run), so the most a filter can do is append a new section, which has no headerReference or pgSz and therefore drops the running head and resets the page size to Letter. Doing it correctly requires a format-level post-processing step on the written document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions