Native line numbering for Word (docx) output #14626
Replies: 2 comments
-
|
@dhagmann Please read the guidelines in the future or more accurately tell your LLM to follow them. Note also that Quarto is not writing almost all OpenXML code which is handled by Pandoc writer. |
Beta Was this translation helpful? Give feedback.
-
|
@dhagmann If you
Then in your Quarto document: ---
format:
docx:
reference-doc: custom-reference-doc.docx
---
{{< lipsum 3 >}}Render it via |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Quarto has no built-in way to add line numbering to
docxoutput, 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 thelinenopackage, but the docx half was never resolved.Proposal
A format option to turn on continuous line numbering for
docx:(Option name is the maintainers' call; it could eventually unify with PDF
linenoand Typst's native line numbering into one cross-format option — what that discussion originally asked for. This request is scoped todocx, 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 theheaderReferences andpgSz— 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 noheaderReferenceorpgSzand 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.Beta Was this translation helpful? Give feedback.
All reactions