Skip navigation
Currently Being Moderated

Has anyone worked with US MIL-STD doc, and successfully generated page numbers in TOC?

Apr 12, 2011 6:15 AM

I'm creating a template using FrameMaker 7.2.

US MIL-STD dictates work package (like chapters) page numbers in the format: 0001-1, 0001-2, 0002-1, 0002-2, etc.

The problem I'm encountering is pulling in that page number format into the generated TOC.


I used a variable on Master Page, and page numbers in each work package generate properly.

I know that in FM 7.2, you can't include a variable in a generated TOC.

So I tried changing the variable on Master Page to text and using a paragraph tag (WPnumber), but haven't gotten that to work either.

Tried all the other tricks I could think of, also.


I believe part of the problem is that FM doesn't allow leading zeroes when setting the page number or chapter number (understandable 99.9% of the time).


If anyone has any suggestions or solutions, I'm very interested to hear them.



1Editor - and stumped

  • Currently Being Moderated
    Apr 12, 2011 7:58 AM   in reply to 1Editor

    I used a variable on Master Page, and page numbers in each work package generate properly.


    So your 00nn-0n numbers do appear correctly on each page via Master Pages?

    What variable construct are you using?


    Can you get the formatted numbers to appear correctly as body page text, or as Xrefs?

    If so, I may have a solution.


    I've never needed to do this, but got curious.

    Mark as:
  • Currently Being Moderated
    Apr 12, 2011 8:57 AM   in reply to 1Editor

    I've got a hack, but you need to treat the page display and the TOC display as separate problems.


    The variable format for the page numbers is: 0001-<$curpagenum>.


    You could make that 000<$chapnum>-<$curpagenum>

    That sort of fixes the page display.

    Aside: The "Current Page #" system variable seems pretty useless, as the re-defined variable appears correctly only on the MPs. Xrefs to any page using <$pagenum> still only get the basic page number.


    The hack:

    I created a special Heading for headings intended for TOC.

    For example, Heading2MIL

    It has a large right-justified tab defined with dot leaders just for offset.


    I also created a an Xref format: PageNumOnly, defined as



    I also created a color "Invisible Text", which has an obvious non-text color that is set to pure white for final publication (and optionally bulk-redacted in Acrobat Pro using "Examine Document").


    The body text entered in Heading2MIL is:

    My Topic[tab]000[variable <$chapnum>]-[Xref-to-self, format PageNumOnly]

    This might appear as:

    My Topic ................................0001-1

    Highlight the leaders and page number.

    Apply color "Invisible Text".


    In the TOC file, Reference Page TOC, instead of the typical definition:


    We just have:

    (because it now includes it's own tab and our fully formatted page number).

    Be sure to set tabs/leaders in the Heading2MILTOC paragraph format.


    In the generated TOC body pages, I now see:

    My Topic ................................0001-1



    The PDF bookmarks will contain the page numbers for the included headings. This could be worked around by making the "MIL" headings complete phantom clones of real headings (small point size - entire paragraph Don't Print).


    If MIL docs commonly have this requirement, I have to imagine that there is an aftermarket solution. And if this requirement has been around a long time, I'm surprised that FM hasn't picked it up as an enhancement.


    Color "Don't Print" didn't work as expected when tested.

    Mark as:
  • Currently Being Moderated
    Apr 12, 2011 9:30 AM   in reply to 1Editor

    I'll have to digest it, and give it a try.


    If you get it working, I can offer some tweaks to address the PDF bookmark issue.


    Basically, what we are doing is generating fully formatted but largely invisible TOC entries in the main document file, then gathering them by generation in the TOC file.


    Since you have to hand-hack the leading zeros anyway, this puts the formatted page number string right in your face, so if an incorrect number of zeros show up, they are apparent while you are working on the page.


    By the way, what exact MIL spec is involved here?

    Mark as:
  • Currently Being Moderated
    Apr 12, 2011 10:28 AM   in reply to 1Editor

    Linda and Error,


    One problem I see in Error's method is when you have more than 9 chapters. The tenth chapter should be 0010, not 00010, the latter being what I think Error's method creates. The problem is that anything you type directly in the field, as in 000<$chapnum>-<$pagenum>, is not pulled into the TOC, unless one makes it part of the TOC reference.


    My suggestion would be to use the standard <$chapnum>-<$pagenum> on the master page AND on the TOC reference page. Then in the book file, set the chapter numbering for EACH file as text. Then enter the chapter number TEXT to be 0001, 0002, 0003, etc. The downside is that the numbering does not increment through the book; you have to set it for each file in the book, in the desired order. Moving files around the book requires changing the chapter numbering. I do this for index and glossary chapters, which use Index and Glossary as the chapter numbers. In addition, typical xref formats, such as "See Chapter <$chapnum> on page <$pagenum>", still work.



    Mark as:
  • Currently Being Moderated
    Apr 12, 2011 10:51 AM   in reply to 1Editor
    I'm already manually setting the leading zeroes.


    I just want to be clear that typing the leading zeroes directly on the master page does NOT cause them to be included in the TOC. You would have to type then as part of the TOC reference also. Furthermore, you would have to have separate master pages and reference pages for chapters 10, 11, etc, in order to get the number of leading zeroes correctly.


    In my method, the leading zeroes are entered as part of the chapternumber itself, in the TEXT chapter number. You still have to type them but only once for each file.

    Mark as:
  • Currently Being Moderated
    Apr 12, 2011 9:54 PM   in reply to Error7103

    Late to the party, but just a comment about trying to create invisible text. NEVER, ever use white! FrameMaker has color views that let you turn off a color (i.e. it actually sets it to be invisible).


    So the correct first step was taken by creating the "Invisible Text", but use something that really stands out, like a magenta. Then set up your color views (View > Color > Views...) so that the "Invisible Text" is seen in (say) View 6 and set to "Invisible" in View 1 (which is FM's default setting). Then toggling between the views (esc v 1 or esc v 6) turns the "Invisible Text" on or off. Any object that is colored with the turned off/invisible color never gets into the output stream, (though FM still can always see it and you can get at the contents via building blocks, i.e. it never gets hidden like conditional text). So there's nothing to redact in Acrobat either. The keyboard shortcut toggles at the book level, so it's fast and easy to turn colors on or off in FM.


    Think of FM's color views as Layers that work on color (attribute based) instead of objects directly. So FM has always had six layers that you can work with.

    Mark as:
  • Currently Being Moderated
    Apr 13, 2011 5:07 AM   in reply to Arnis Gubins

    ... trying to create invisible text. NEVER, ever use white!


    That's a strong statement. It sounds like there are further downsides to white on white (w-o-w). Some I can think of are:

    • It really needs to be pure RGB or CMYK white. Acrobat won't redact if it's even 1 bit different than the background color.
    • Even so, if even one coordinate of a w-o-w- font outline lies on a non-white color object, that entire character will still be present in the PDF after redaction.
    • The invisible text color needs to be named something other than "White", which Frame might set to Cutout rather than Invisible.


    ... but use something that really stands out, like a magenta


    I agree on standout, but I wouldn't recommend magenta. Frame is hard-coded to use magneta to flag Condition Code overload.


    So there's nothing to redact in Acrobat either.


    Turns out we have to do that anyway. We use EPS imports. Unix Frame is apparently passing them to the .ps file with the preview/thumbnail images intact, and they are being distilled to pdf with the (large, but now useless) preview images embedded, along with EXIF photo data, pixels and vectors outside clipping paths, etc. This undesirable metadata can constitute some 40% of the final pdf, which matters on 20MB pdfs served on the web. So we routinely redact them, and the process stomps the invisible text with no extra effort.


    I looked into Color Views at one time, expecting that it could provide different definitions for colors in each view. It doesn't, so I abandoned it. I just took another look, and it turns out that between Cutout and Invisible, the feature apparently can handle our two magic color requirements, so we'll probably switch to Views. Thanks for bringing it up.

    Mark as:
  • Currently Being Moderated
    Apr 13, 2011 5:41 AM   in reply to 1Editor

    So the page number on the Reference page looks like this:




    I have to adjust the number of leading zeroes for chapters under 10, but that's not bad at all.


    Please let us know how the TOC works out. I am guessing that the TOC generating mechanism may not work when some documents in a book have reference pages different from other documents in the book.

    Mark as:
  • Currently Being Moderated
    Apr 14, 2011 4:54 AM   in reply to 1Editor

    Some time back I read about how to create leading zeros using tab leaders. I'm afraid I cannot recall the source, maybe even on this forum.


    Anyway, for the page number format you're trying to achieve, you can modify the footer paragraph format like this:


    - Delete all existing tab stops in the paragraph.
    - Towards the right end of the footer frame, add a new tab stop with decimal alignment to the hyphen character and "0" as the custom leader.
    - A bit (ca 0.7 cm) further left, add a new tab stop with left alignment and no leader.
    - In the paragraph, insert two tab characters, the <$chapnum> variable, a hyphen character, and the <$pagenum> variable.


    The tab with custom leaders fills in the leading zeros. All you need to do now is tweak the position of the tab stops to get the correct number of digits and an even character spacing.


    For example, the following did work for me:
    A4 page with 2.5cm left indent
    Times New Roman Regular 10pt
    Tabs at 14.31 cm (left) and 15.14 cm (decimal)





    Mark as:
  • Currently Being Moderated
    Apr 17, 2011 8:19 AM   in reply to JohannesKrueger

    ... create leading zeros using tab leaders ... The tab with custom leaders fills in the leading zeros.


    Elegant. This might even work for TOC, and avoid having to use the hidden body text trick.


    Of course, this does not change the actual format of the system page number variable, so any cross- references in the body text also need to use that same tab leader trick. I'd be tempted to re-state the page number in the body text as a hidden run-in paragraph, named, say, Xref.PageNo, at each point where there will be an Xref marker.


    And none of these work-arounds are going to result in correct (LZ) page number display in PDF reader toolbars (the page content will have LZ numbering).

    Mark as:
  • Currently Being Moderated
    Apr 27, 2011 10:46 AM   in reply to 1Editor

    I am glad you got it to work for you; however, you state:


    Before the chapter number, insert a cross-reference marker with the chapter number.

         This provides a cross-reference marker for adding cross-references in the text.


    I do not understand the necessity for including a cross-reference marker on the master page. If you add them, I would think they should be in the body text.



    Mark as:
  • Currently Being Moderated
    Apr 27, 2011 2:07 PM   in reply to 1Editor

    However, in the MIL-STD formatted document, the work package (i.e., chapter number) designation appears only in the running headers and footers, and as cross-references in the text.

    There isn't the usual chapter number and chapter title on the opening page.

    With all due respect, I believe you are missing the point. The chapter number does not need to appear anywhere in the chapter. When you select the file in the book, right-click, and select Numbering, in the Chapter tab you are setting the value of the chapnum for that file. Any reference to it using the <$chapnum> building block, whether in the TOC reference page or in a cross-reference format, displays the value you set in the book file.


    As an example, in my case, I have a Glossary file whose chapter number is set to be the text "Glossary". If I add a cross-reference to one of its definitions using a cross-reference format like "See page <$chapnum>-<$pagenum>.", it will display as


    See page Glossary-5.





    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 8:03 AM   in reply to 1Editor

    I am working with that same standard MIL-STD-40051-2A and I am curious to know if this same solution works with FrameMaker 10 or is there a simpler solution in the newer version? I will give it a try.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points