5

I am creating a 'Table of contents' (TOC) generator not unlike the AuthorTools. My "generator" creates cells like the following in the TOC.nb:

Cell[
  TextData[{
    CounterBox["Chapter",
               {FrontEnd`FileName[{$RootDirectory, "X:","Daten","fh-fsi-beuth",
                                                       "Test-HeaderFooter.nb"
                                  }, 
                                  CharacterEncoding -> "WindowsANSI"
                                 ], 
                    "testTag"
                   }
        ],
    "  Allgemeine Grundlagen",
    " ",
    Cell[
      TextData[
        ButtonBox[
          CounterBox["Page", 
                     {FrontEnd`FileName[{$RootDirectory, "X:","Daten","fh-fsi-beuth",
                                                         "Test-HeaderFooter.nb"
                                         }, CharacterEncoding -> "WindowsANSI"
                                       ], 
                      "tagTest"
                     }
          ],
          BaseStyle->"PageLink",
          ButtonData->{"X:\\Daten\\fh-fsi-beuth\\Test-HeaderFooter.nb", "tagTest"}
        ]
      ], 
    "TOCPage"
    ]
   }
  ], 
  "TOCChapter"
]

The link in the ButtonData-Rule works, I can jump right into the target notebook (which is assumed to be open). But neither the Chapter number nor the Page number is generated. Here the error message is, that the notebook is not found.

My question is, what is the right syntax for CounterBox["Chapter",{???????, "testTag"}] and how can I produce it from my "TOCgenerator"?

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
Darwin1871
  • 647
  • 3
  • 7

0 Answers0