[Solved-Workaround] Page numbering with leading zeros

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
sherbert
Posts: 12
Joined: Tue Jan 26, 2010 1:06 am
Location: New Plymouth, New Zealand

[Solved-Workaround] Page numbering with leading zeros

Post by sherbert »

I want to enter a uniform format of page numbering into the header space of my bundle of exhibits which is to be exhibited to my deponent's affidavit, ie. "JJJnnn" where J=deponent's initials and n=page-number.
Eg. "I exhibit the agreement at pages SMM001 - SMM010".
I can do the "SMM" part in the header readily enough, of course. I just add these 3 characters of text immediately before the page-numbering field.
I have seen Acknak's 2007 answer elsewhere, not immediately to hand, that one can increment a variable and format the result with leading zeros. That solution calls for the manual insert of the variable field at [every page in what is now a 300 page exhibit.] [edited] I'd rather not.
I have searched this and other forums for 'page numbering leading zeros' (no results) while 'leading zeros' returns solutions for Calc documents, eg. 26592. I know how Office handles leading zeros in Calc, thanks.
I see Acknak offered a solution for removing leading zeros. I do not want to do that, either.
I can do without leading zeros but my document will not look as sharp, IMHO.
Is it perhaps the case that leading zeros in page numbering remain a to-be-hoped-for future feature of the marvellous Writer app?
Last edited by sherbert on Wed May 07, 2014 5:08 am, edited 3 times in total.
LIbre Office 3.5.7.2 on Linux Mint 13
"If there is a sin against life, it consists perhaps not so much in despairing of life as hoping for another life and in eluding the implacable grandeur of this life", Albert Camus
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Page numbering with leading zeros

Post by acknak »

Sorry, this is something Writer just doesn't provide for. The page number field is completely different from the other numeric fields which work with a number format.

The only workaround I can think of is to handle it the same way you propose to handle the rest of the page numbers: manually add the zeroes. This would require a separate page style for page with different numbers of zeroes but even for a 300-page document, that's only two extra page styles.

The one difficulty with that is that I don't see a good way to switch page styles. The only way to switch at some arbitrary place in the text is to add a manual page break. You can do that easily enough but it has to happen at a paragraph boundary so there may be some empty space on the page where the break is.
AOO4/LO5 • Linux • Fedora 23
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Page numbering with leading zeros

Post by RoryOF »

My thought on this (and I haven't worked it out in detail) would be to use a conditional field where the "SMM" prefix is "SMM0" if page/paragraph number is greater than 10 and SMM00 if page/paragraph number less than 10. But to be honest, one would hand edit the final document quicker than working out the detail of the above.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Page numbering with leading zeros

Post by acknak »

The problem there is that Writer does not make the page number field available for any kind of formula or condition. As I say, it's a bizarre design that the page number field is completely different than other fields.

You can't even manually edit the numbers--they don't exist in the document; they're generated as needed.

I don't know if it's possible to use a regular variable in the header/footer and have it increment each time. That might be worth a try.
 Edit: PS: 
Nope. Formulas in a header/footer are not re-calculated for each page so the value never changes.
AOO4/LO5 • Linux • Fedora 23
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Page numbering with leading zeros

Post by RoryOF »

I did once use a variable to count and number columns, but I've forgotten how I did it. I should write these things down! Writing something else now, so no time to think of what I did.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
sherbert
Posts: 12
Joined: Tue Jan 26, 2010 1:06 am
Location: New Plymouth, New Zealand

Re: Page numbering with leading zeros

Post by sherbert »

Thanks, gentlemen, your thoughts are gratefully received, even if between the greatest minds in the known universe the problem ranks with Fermat.
:)
LIbre Office 3.5.7.2 on Linux Mint 13
"If there is a sin against life, it consists perhaps not so much in despairing of life as hoping for another life and in eluding the implacable grandeur of this life", Albert Camus
sherbert
Posts: 12
Joined: Tue Jan 26, 2010 1:06 am
Location: New Plymouth, New Zealand

Re: Page numbering with leading zeros WORK AROUND

Post by sherbert »

WORK AROUND: Thanks Acknak, your new page styles suggestion works for me.

My context is that I am using the marvellous pdftk (PDF Tool Kit) app developed by the ever-helpful Sid Steward of Texas. His pdftk features a stamping function where a pdf file containing just page-numbers in the header space (for example) can be 'stamped' onto another file of content, eg, my bundle of exhibits.
I created 3 page styles based on the Default page style, called 'multistamp pages 1 to 9', 'multistamp pages 10 to 99' and 'multistamp pages 100+' .
In the first I add fixed text 'SMM 00' before a page-numbering field. In the second I use 1 less leading zero, ie 'SMM 0' and in the third no leading zeros at all, ie. 'SMM '.

I can Insert a Manual Break, Page Break, Style 'multistamp pages 10 to 99' (no change to page-number) at the appropriate place, ie. at the end of page 9. Ditto at 99 for the third page Style.

This results in a document with leading zeros on the page numbers. I convert that to pdf and Sid's marvellous app does the rest.

Thanks to the forum and its diligent contributors
SH :)
LIbre Office 3.5.7.2 on Linux Mint 13
"If there is a sin against life, it consists perhaps not so much in despairing of life as hoping for another life and in eluding the implacable grandeur of this life", Albert Camus
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Re: Page numbering with leading zeros WORK AROUND

Post by acknak »

Nice! Thanks for posting the follow-up info.
AOO4/LO5 • Linux • Fedora 23
Post Reply