Tinderbox Forum

Numbering outlines

I would like to create a set of notes which each stand for numbered book sections within a container corresponding to a numbered chapter. I’m not convinced when I do this what the ordering will be so I’d like to do two, coupled things:

  1. I’d like to number the sections within the outline and if I move one, have it renumber automatically or because I invoke an agent or something…

  2. What would be cool, but that would probably magic, is to have that reordering change the physical layout of the map notes…

  3. or… less magical, that the number be reflected in the title so that I could then visually reorder the notes in the map.

So…can I do 1? and can I do 3? I’m sure you can see why this would be useful as a use case, but I couldn’t find evidence that this has been done.

thanks

For #3, consider using $SiblingOrder in $DisplayExpression.

For #2, consider setting $Xpos and $Ypos depending on $SiblingOrder.

Outline export has lots of options for adding section numbers too, but of course that doesn’t change the display inside Tinderbox.

Another method for getting an outline numbering that respects indention is to use this $DisplayExpression:

eval("^sectionNumber^") + " " + $Name

which you can include in a prototype and get a result such as this

Normally ^sectionNumber^ is export code, but with the eval() function you can cause action code to evaluate and display the result of export code.

4 Likes

I concur with this solution but be aware aliases, e.g. in agents, will show a different numbering from their original note. If the latter is unacceptable, happily it appears ^sectionNumber^ can use offset designators so this seems to work:

eval("^sectionNumber(original)^") + " " + $Name

Thus:

(Tested in v7.3.1)

1 Like

How does this code get modified if the document to be number outlined is not the whole document or top-level?

I have a container for my dissertation chapters & sections. The first note-container is “Introduction” which I’d like to have display as “1 Introduction” rather than “1.1 Introduction” or “X.1 Introduction” etc etc.

Apologies for reviving an old topic but I can’t see it elsewhere and cannot figure out the code from @mwra Tbref code for ^sectionNumber^.

Thanks,
Adam

The starting point is that this isn’t a built-in function but code the user must build for themselves.

So, first we will make a user String attribute to hold our custom number: $MyOutlineString. This also avoids doing evaluation in $DisplayExpression which can slow things up if the DE is used by lots of notes.

This code goes in all notes in the (numbered) section of the outline. I’d add to an Edict rather than a Rule as it doesn’t need to be tested all the time. Edicts run less often and can run on demand too if you know data needs updating.

So the $Edict is (or adds the following to existing Edict code):

$MyOutlineString = if($OutlineDepth >1){
   collect(ancestor,$SiblingOrder).reverse.format(".")+"."+$SiblingOrder;
}else{
   $SiblingOrder
};

The same notes (or their prototype) uses the $DisplayExpression:

$MyOutlineString + " " + $Name

Thanks @mwra. Very much appreciated.

1 Like