Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Aug 2013
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Formatting {Sectionpages} to include chapter Title

    Good afternoon everybody,

    I've been working on a document with multiple appendices (I'm using Word 2010 with the .docx file format) and I've been trying to change the page numbers to show "A1 of A[x]" with [x] as the total number of pages in the section.

    Right now I have it set up as {page} of {sectionpages}, with the format of {page} set to include the chapter name. The chapter name is taken from the Appendix chapter which I set up to Header 9 (I rarely go past level 3) to become Appendix A, Appendix B, etc.

    So right now for Appendix A, the page numbering shows "A1 of 2," while Appendix B shows "B2 of 2." I'm trying to get it to show "A1 of A2" and "B1 of B2" respectively. I know I can just simply override it and add a B infront of the sectionpages, but I think that would defeat the purpose of setting up the automatic A1 format of the pages.

    For clarity, I've attached a sample.docx to better see how I've set it up.

    Has anybody been able to find a solution for this? I've checked around on the net and I haven't been able to find anything on this yet. Thanks!
    Attached Files Attached Files

  2. #2
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    122
    Thanks
    3
    Thanked 20 Times in 18 Posts
    You can use switches for the REF field to isolate the appendix number. Use the Insert > Cross-reference dialog with Reference type=Heading to choose the heading you want (i.e. Appendix A Sample 1). The switch you'll need is not available from the interface so choose Insert reference to=Page number and turn off the Insert as hyperlink checkbox.

    Use Alt-F9 to view the resulting field code. It will look something like { PAGEREF _Ref364321605 } where the _Ref part is a unique code automatically generated for your document to refer to that particular heading.

    Now edit the field code to add the \n \t switches. The \n switch displays the entire paragraph number and the \t switch further modifies it to suppress the non-numerical part. The result should display just A for your first appendix. Use this in your header just before the section page number reference.

    The attached screen capture shows the various switches and their results. (I use File > Options > Advanced > Show document content, Field shading=Always to have Word display field codes and their results with the light grey background for greater clarity.)
    wsFieldcodes.JPG

  3. #3
    New Lounger
    Join Date
    Aug 2013
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Good afternoon Eric,

    Thank you for the feedback; to be frank I haven't been able to get your suggestion to work yet (I'm still new to use of the switches). However, studying the code it seems (correct me if I misunderstood) that for each Appendix I'd have to make a a new Cross Reference to the header; this is actually what I'm trying to avoid, as I want to make it automatic for any number of Appendices.

    After reading into switches, however, would it be possible to show only the chapter name (for example "A") automaticaly much in the same way you can do so with {Page}? I've been trying to do so but haven't gotten much luck yet.

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    My go-to reference on this has always been Shawna Kelley's page: How to Number Headings and Figures in Appendices. It does not provide the answer to your question, though.

    Eric's suggestion looks like it should work, but you are correct that you have to create separate footers for each Appendix then.

    Most appendices I've seen do not have the page x of y format. You might use:
    Appendix { STYLEREF "Heading 9" \n }: { STYLEREF "Heading 9" } Page { PAGE } of { SECTIONPAGES }
    as a workaround, with no Chapter Number for the page number.

    You would end up with:
    Appendix B: Sample 2 Page 1 of 2

    Not what you want, I know, but it would be automatic and may serve your purpose. Of course, then the numbering in your TOC would not reflect Chapter numbering, either.

    The following page contains most of my links on this subject:
    Sections, Headers and Footers and Page Numbering in Word 2007-2013
    Last edited by Charles Kenyon; 2013-08-23 at 09:00.
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. The Following User Says Thank You to Charles Kenyon For This Useful Post:

    Rendarin (2013-08-26)

  6. #5
    New Lounger
    Join Date
    Feb 2012
    Location
    New York
    Posts
    16
    Thanks
    0
    Thanked 5 Times in 5 Posts
    What you need to add in is one of my favorite fields: Styleref with the switches mentioned above. As a reminder the curly braces surrounding the fields must be generated with Word and not typed directly

    { STYLE REF "Heading 9" \n \t \* MERGE FORMAT }-{ SECTIONPAGES \* MERGEFORMAT }

    will generate results that combine the Heading 9 numbering with the total number of section pages, automatically changing with each section "A-2" or "C-2" as it encounters the proper heading. Please also note that I have hard typed a hyphen between the two field codes.
    Last edited by hernandz; 2013-08-25 at 08:04. Reason: typing code syntax not my strongest point

  7. The Following User Says Thank You to hernandz For This Useful Post:

    Rendarin (2013-08-26)

  8. #6
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    122
    Thanks
    3
    Thanked 20 Times in 18 Posts
    Hernandz' suggestion to use the Styleref field code will do what you want without the need to set up a new heading for each chapter.

    A couple of things to note:

    1. You may not need the \* mergeformat switch (and note that there is no space between the words) that gets included by default when you use the Quick Parts menu. Styles are usually a better alternative to manage formatting, but the \* Mergeformat switch causes formatting you may want applied manually to the field to be retained when updated. For example, you could set the appendix number in bold while retaining the non-bold for the appendix name by including the switch and then applying manual bold to the first field.

    2. The "\n" and "\t" switches can be used in a number of field codes, but will display "0" if the referenced heading is not included in the numbered list structure.

    Word's built-in Help isn't very helpful for field code switches, but Microsoft provides more information online (this page provides links to all available field codes with switches and examples). Refer to this Microsoft page for specific details about using field codes and managing the formatting switches.

  9. The Following User Says Thank You to EricFletcher For This Useful Post:

    Rendarin (2013-08-26)

  10. #7
    New Lounger
    Join Date
    Aug 2013
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Good morning everybody,

    Hernandez:
    That totally did the trick. I had just found in another reference about STYLEREF, but I was messing up somewhere with the switches or somewhere else, as even the title was getting included in the page number for some reason (I still haven't fully gotten my head wrapped around which switches work where and do what). This fully solves my problem, thank you very much.

    Charles and Eric:
    Thank you for the feedback and additional references and clarifications, I hadn't been able to find many comprehensive references.

  11. #8
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    Eric has already provided you with my reference for field switches and setup. I agree that you man not want the MERGEFORMAT switch. I generally remove it from any field I find it in because it leads to me being surprised by formatting. That surprise may indicate my ignorance, but only in very rare instances have I found it useful. If I were going to put a formatting switch in, I would use the CHARFORMAT instead. That uses the format of the first character of the field itself.
    Charles Kyle Kenyon
    Madison, Wisconsin

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •