Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Reset List numbering

Participant ,
Apr 07, 2025 Apr 07, 2025

I have a 22 page document that has 6 sections. The first 3 have 3 header levels to seperate numbering. The other only have a non-numbered title and section numbers starting with 1. I can reset each first section with a simple make this number 1 numbering format. But after that the numbering goes back to follow the last section. Is there a format that will reset the numbering back to 2 for the next group? 

267
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 17, 2025 Apr 17, 2025

Your first level Heading1 should look like this:

R:<n+> which will result in "1". You can add a zero [R:<n+>.0] if your want "1.0".

This will restart with each separate document (chapter). If you need it to restart at 1 in the same document, you will need a second style such as Heading1_reset [R:<n=1>].

 

The second level would look like one of these, depending on the format:

R:<n>.<n+> which would show 1.2 (or 2.1 if under another Heading1--it would reflect what Heading1 level it is under).

R:<

...
Translate
Community Expert ,
Apr 07, 2025 Apr 07, 2025

It's hard to troubleshoot without seeing your document, but here in a recent thread about autonumbering. I provide a script that gives you an autonumber report that may help troubleshoot the issue. There are also links to a couple of videos that I posted about autonumbering.

 

https://community.adobe.com/t5/framemaker-discussions/i-m-having-a-problem-with-chapters-starting-ba...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2025 Apr 07, 2025

Here is the script. Copy it to a plain text file and save it as CP-AutonumberReport.jsx. Open your document and choose File > Script > Run and select the script. It will give you a detailed report and you can post the results here.

/* CP-AutonumberReport.jsx Version 0.2b March 28, 2025
Copyright 2025, Carmen Publishing Inc. All rights reserved.

For information, call 585-729-6746 or email rick@frameexpert.com.

Not to be resold without permission.

Version 0.2b March 28, 2025: Non-numbered autonumbered paragraphs are skipped. 
Version 0.1b March 25, 2025: First release of the script. 
*/

#target framemaker

var CP_ANR = CP_ANR || {};
CP_ANR.version = "Version 0.2b March 28, 2025";
CP_ANR.file = $.fileName;

CP_ANR.main = function () {
    
    var book, doc;
    
    book = app.ActiveBook;
    if (book.ObjectValid () === 1) {
        CP_ANR.processBook (book);
    }
    else {
        doc = app.ActiveDoc;
        if (doc.ObjectValid () === 1) {
            CP_ANR.processDoc (doc, 0);
        }        
    }
};

CP_ANR.processDoc = function (doc, bookId) {

    var pgf;
    
    // Process all paragraphs in the main flow.
    pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
    while (pgf.ObjectValid () === 1) {
        CP_ANR.processPgf (pgf, doc, bookId);
        pgf = pgf.NextPgfInFlow;
    }
};

CP_ANR.processBook = function (book) {
    
    var bookComp, doc, regex;
    
    // Regular expression for standard FrameMaker documents.
    regex = /\.fm$/i;
    
    // Loop through all of the components in the book.
    bookComp = book.FirstComponentInBook;
    while (bookComp.ObjectValid () === 1) {
        if (bookComp.ExcludeBookComponent === 0) {
            if (regex.test (bookComp.Name) === true) {
				// Skip generated files.
				if (bookComp.BookComponentType === Constants.FV_BK_NOT_GENERATABLE) {
					// Get the document returned in a JavaScript object.
					doc = CP_ANR.getDocument (bookComp.Name, undefined, false);
					if ((doc) && (doc.ObjectValid () === 1)) {
						book.StatusLine = "Processing " + new File (bookComp.Name).displayName;
						// Call the function to get the document's autonumber data.
						CP_ANR.processDoc (doc, book.id)
						// If the document was opened by the script, save it and close it.
						if (doc.openedByScript === true) {
							//doc.SimpleSave (bookComp.Name, false);
							doc.Close (true);
						}
					}
				}
			}
        }
        bookComp = bookComp.NextBookComponentInDFSOrder;
    }

    // Reset the book status line.
    book.StatusLine = "";
};

CP_ANR.processPgf = function (pgf, doc, bookId) {
    
    var textList, count, i, msg;

    if (pgf.PgfIsAutoNum === 1) {
        // Make sure there are actual building blocks (skip bullets, text-only, etc.).
        if (/</.test (pgf.AutoNumString) === true) {
            msg = pgf.PgfNumber + "  " + pgf.AutoNumString + "  [" + pgf.Name + "]";
            msg = CP_ANR.writeBookErrorLog (pgf.id, doc.id, bookId, msg);    
        }
    }

    // Get any tables in the paragraph.
    textList = pgf.GetText (Constants.FTI_TblAnchor);
    count = textList.length;
    for (i = 0; i < count; i += 1) {
        // Process the table.
        CP_ANR.processTbl (textList[i].obj, doc, bookId);
    }
};

CP_ANR.writeBookErrorLog = function (objId, docId, bookId, msg) { 
    
    /// msg = CP_ANR.writeBookErrorLog (objId, docId, bookId, msg);
    
    msg = 'log -b=' + bookId + ' -d=' + docId + ' -o=' + objId + ' --' + msg;
    CallClient ('BookErrorLog', msg);
    
    return msg; // Return for troubleshooting.
};

CP_ANR.processTbl = function (tbl, doc, bookId) {
    
    var pgf, cell;
    
    // If the title is at the top, process it first.
    if (tbl.TblTitlePosition === Constants.FV_TBL_TITLE_ABOVE) {
        pgf = tbl.FirstPgf;
        while (pgf.ObjectValid () === 1) {
            if (pgf.PgfIsAutoNum === 1) {
                CP_ANR.processPgf (pgf, doc, bookId);
            }
            pgf = pgf.NextPgfInFlow;
        }
    }

    // Process each cell and its paragraphs.
    cell = tbl.FirstRowInTbl.FirstCellInRow;
    while (cell.ObjectValid () === 1) {
        if (cell.CellIsStraddled === 0) {
            pgf = cell.FirstPgf;
            while (pgf.ObjectValid () === 1) {
                if (pgf.PgfIsAutoNum === 1) {
                    CP_ANR.processPgf (pgf, doc, bookId);
                }
                pgf = pgf.NextPgfInFlow;
            }
        }
        cell = cell.NextCellInTbl;
    }
    
    // IF the title is at the bottom, process it last.
    if (tbl.TblTitlePosition === Constants.FV_TBL_TITLE_BELOW) {
        while (pgf.ObjectValid () === 1) {
            if (pgf.PgfIsAutoNum === 1) {
                CP_ANR.processPgf (pgf, doc, bookId);
            }
            pgf = pgf.NextPgfInFlow;
        }
    } 
};

CP_ANR.getDocument = function (filename, structuredApplication, visible) {
    
    var doc;
    
    // See if the document is already open.
    doc = CP_ANR.docIsOpen (filename);
    if ((doc) && (doc.ObjectValid () === 1)) {
        return doc;
    } 
    else {
        // The document is not already open, so open it.
        return CP_ANR.openDocOrBook (filename, structuredApplication, visible);
    }
};

CP_ANR.docIsOpen = function (filename) {
    
    var file, name, doc;
    
    // Make a File object from the file name.
    file = new File (filename);
    // Uppercase the filename for easy comparison.
    name = file.fullName.toUpperCase ();

    // Loop through the open documents in the session.
    doc = app.FirstOpenDoc;
    while (doc.ObjectValid () === 1) {
        // Compare the document’s name with the one we are looking for.
        if (new File (doc.Name).fullName.toUpperCase () === name) {
            // The document we are looking for is open.
            doc.openedByScript = false;
            return doc;
        }
        doc = doc.NextOpenDocInSession;
    }
};

CP_ANR.openDocOrBook = function (filename, structuredApplication, visible) {
    
    var i = 0, docOrBook = 0, openProps, returnProps;

    // Get default property list for opening documents.
    openProps = GetOpenDefaultParams ();
    // Get a property list to return any error messages.
    returnProps = new PropVals ();

    // Set specific open property values to open the document.
    i = GetPropIndex (openProps,Constants.FS_AlertUserAboutFailure);
    openProps[i].propVal.ival=false;
    i = GetPropIndex (openProps,Constants.FS_MakeVisible);
    openProps[i].propVal.ival=visible;
    i = GetPropIndex (openProps,Constants.FS_FileIsOldVersion);
    openProps[i].propVal.ival=Constants.FV_DoOK;
    i = GetPropIndex (openProps,Constants.FS_FileIsInUse);
    openProps[i].propVal.ival=Constants.FV_ResetLockAndContinue;
    i = GetPropIndex (openProps,Constants.FS_FontChangedMetric);
    openProps[i].propVal.ival=Constants.FV_DoOK;
    i = GetPropIndex (openProps,Constants.FS_FontNotFoundInCatalog);
    openProps[i].propVal.ival=Constants.FV_DoOK;
    i = GetPropIndex (openProps,Constants.FS_FontNotFoundInDoc);
    openProps[i].propVal.ival=Constants.FV_DoOK;
    i = GetPropIndex (openProps,Constants.FS_RefFileNotFound);
    openProps[i].propVal.ival=Constants.FV_AllowAllRefFilesUnFindable;
    i = GetPropIndex (openProps,Constants.FS_UseRecoverFile);
    openProps[i].propVal.ival=Constants.FV_DoNo;
    if (structuredApplication !== undefined) {
        i = GetPropIndex (openProps,Constants.FS_StructuredOpenApplication);
        openProps[i].propVal.sval=structuredApplication;
    }

    // Attempt to open the document.
    docOrBook = Open (filename,openProps,returnProps);

    if (docOrBook.ObjectValid () === 1) {
        // Add a property to the document or book, indicating that the script opened it.
        docOrBook.openedByScript = true;
    }
    else {
        // If the document can't be open, print the errors to the Console.
        PrintOpenStatus (returnProps);
        Console ("\r" + filename);
    }

    return docOrBook; // Return the document or book object.
};

CP_ANR.main ();
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 09, 2025 Apr 09, 2025

Not really the issue. I have subject 1 with a list under it starting at 1. This works fine. Ihave a paragraph to reset this one to #1. On the first list I get the 2 - 5 no problem. But on subject #2, I set the #1 and it works fine, but the #2 - 5 pick up the secquence from the #1 subject and don't reset at #2 again. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2025 Apr 09, 2025

What version of FM? Structured or Unstructured?
Let's see some screenshots to see how you've got your doc laid out & what's going on.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2025 Apr 09, 2025

It's hard to troubleshoot from your description. I can meet via zoom and take a look at your screen for no cost. Let me know and I will send you a zoom link. It will probably take less than 10 minutes. rick at frameexpert dot com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2025 Apr 09, 2025

Have you checked to see if they are all the same code (list name)image.pngexpand imageimage.pngexpand image

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2025 Apr 10, 2025

(Of course, if you've already solved this, let us know and mark the correct answer)

It sounds like you're using a combination of numbering techniques, which @Dave Creamer of IDEAS @frameexpert @Jeff_Coatsworth have all mentioned.

You should either take up @frameexpert on his generous offer, or post the Numbering properties format of each of the tags (showing tag names and their respective numbering properties)

MattTechCommTools_0-1744307895440.pngexpand image

 

When writing this down, there's a great chance you'll resolve the issue even before posting to us.

 

-Matt Sullivan
FrameMaker Course Creator, Author, Trainer, Consultant
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 11, 2025 Apr 11, 2025

Hi Eric:

 

We can continue to help if this is still unresolved. Or if you have it figured out, please let us know. 

 

~Barb

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 17, 2025 Apr 17, 2025

I think I have figured out it is not easy. What I'm trying to do is reset the numbering under a numbered header. Heading 1 the sub-heading 1, 2,3 etc. So I can create a new sud-heading as R: <n=1>. That will rest my sub headings to 1. But I can't use R:<n+> to generate 2,3,4, etc. It picks up from the previous. It looks like I need to create a new L: for each, which makes the auto numbering useless execpt for the number 1. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 17, 2025 Apr 17, 2025

No, you have it wrong. Try something like this for your Headings:

Heading 1:  L:<n+>< =0>< =0>

Heading 2: L:< ><n+>< =0>

Heading 3: L:< >< ><n+>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2025 Apr 17, 2025
quote

No, you have it wrong. Try something like this for your Headings:

Heading 1:  L:<n+>< =0>< =0>

Heading 2: L:< ><n+>< =0>

Heading 3: L:< >< ><n+>


By magnificent_warmth6396

A couple of notes: 

the identifying list letter doesn't really matter as long as it is unique from other lists. 

I found you don't really need the initial < =0> code since each level of the list automatically starts a zero by default (although they aren't hurting anything...).

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 17, 2025 Apr 17, 2025
LATEST

@Dave Creamer of IDEAS You are correct that the < =0> resets aren't necessary; however I add them so that at every level, I can see how many paragraph formats are in that series.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2025 Apr 17, 2025

Your first level Heading1 should look like this:

R:<n+> which will result in "1". You can add a zero [R:<n+>.0] if your want "1.0".

This will restart with each separate document (chapter). If you need it to restart at 1 in the same document, you will need a second style such as Heading1_reset [R:<n=1>].

 

The second level would look like one of these, depending on the format:

R:<n>.<n+> which would show 1.2 (or 2.1 if under another Heading1--it would reflect what Heading1 level it is under).

R:< ><a+> which would show "a, b, c, etc. depending on how many Heading2's there are. 

Either one would reset itself automatically under a new Heading1 style.

 

The next level, Heading3, would like like one of these:

R:<n>.<n>.<n+>

R:< >< ><i+> which would show "i, ii, iii, etc. depending on how many Heading2's there are. 

Either one would reset itself automatically under a new Heading2 style.

 

And so on...

 

As a note, the initial letter doesn't matter with the exception of the uppercase T, which Frame uses for Table Titles, although it could be changed (but I never do). You can use either upper or lowercase letters, but an uppercase R is not the same list as a lowercase r. 

 

I hope this is clear as mud...

I've attached a couple of files you can look at to dissect how the numbered lists are put together. 

 

If you are still having problems, click on my name and message me. I can look at your file.

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines