How to add page numbers to Word documents in Quarto

How can I add page numbering to Word documents generated using Quarto? There is no mention of such an option in the MS Word Options section of the online reference manual, and online search turns up no clues.

Darn good question. What seems to work is to create a so-called reference template in the directory that you are rendering from, using this from the terminal

quarto pandoc -o custom-reference-doc.docx \
   --print-default-data-file reference.docx

Then, open that document in Word, edit to put page numbers where and how wanted and save. The make the yaml block look like

title: "Word Pagination"
author: "Richard Careaga"
    reference-doc: custom-reference-doc.docx

This is like a kid's treehouse where you have to know the secret passwors.

Does it mean that next time when rendered from Quarto to word our final docx file will be looking like that very same formatting in that referenced " custom-reference-doc.docx" ? In other words is this "custom-reference-doc.docx" file acting like a template/boilerplate for us ?

That seems to be what they came up with. I guess it has something to do with a design decision made in Word for Windows 1, which has never been revisited, which is that page numbering would be turned off by default, because it something that was something of a Wild West. Forty years ago, just as personal computer software was killing dedicated word processors, "pagination" mean

Make it look like it was typed in Courier 10 Pitch on an IBM Selectric typewriter with 1" margins all around and a page number centered in the bottom margin.

This quickly evolved, as WP gained traction, to

And be sure that it prints out the same way on my home dot matrix printer as it does on the office daily wheel printer!

This dueling print driver mess was one of the drivers behind the unlikely success of PDF—it was the first output format that could "keep everyone on the same page." Literally.

So, when a modern Word document is created, the default template is (I think, because I haven't had to use it in like 20 years or more) has no default pagination. It has to be added or the document has to be created with something other than normal.dotm, the default template, that has a pagination.

This is yet another example of a historical artifact that long outlives its original purpose, like the famous Two Spaces Rule.

It's entirely possible that blood has been spilt over the proposition that after a period ending a sentence, there must be exactly two spaces before the first word in the next sentence of the same paragraph.

Devotion to the Rule persisted even after proportional spacing ignored the extra space unless someone really went out of the way to force it.

The real reason for the original Rule is much simpler: It was to prevent keys from jamming on old mechanical typewriters, like the 1939 model I learned to type on in 1959.

Those terms key, carriage return and line feed? They referred to moving parts, as did the shift key. The keyboard caused parts to move up and down and back and forth. If the typist tried to make that happened to0 quickly, keys would jam. The Rule was nothing more than a trick to make sure that keys had a chance to fall back to the resting position before starting up again.

Talk about the dead hand of the past. People who passionately insist on the Rule are children of parents who have never themselves used a mechanical typewriter. Heck, even some of their grandparents never have.

A generalization is reflected in the following fable.

An evil ethnologist conducted a behavioral experiment on chimpanzees. Five of them were placed in an enclosure with a banana suspended just out of reach. A chimp could grasp it my moving a stool, standing on it, and reaching as far as possible to grasp it.

When he or she did, high pressure water hoses would come on and batter all five chimps. After a while a new banana would be introduced and the water torture would ensue.

The third time this happened, immediately one chimp began to move the stool, the other four chimps would beat up the chimp who was about to unleash disaster. That chimp was left and the four others replaced. After several cycles no chimp in the cage had ever experienced the high-pressure drenching and a new chimp is introduced.

Not knowing better, the new chimp goes to reach for the treat and gets brutally taken down by the four others before the water is set off. After licking his wounds, the new guys pulls a sympathetic looking veteran aside and asks: "WTF? What's up with that?" To which the answer is: Policy.

Never underestimate the power of That's the Way the World Is. So, yeah

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.