Next: , Previous: , Up: Nodes   [Contents][Index]


3.7 Node and Menu Illustration

Here is a diagram that illustrates a Texinfo file with three chapters, each of which contains two sections.

The “root” is at the top of the diagram and the “leaves” are at the bottom. This is how such a diagram is drawn conventionally; it illustrates an upside-down tree. For this reason, the root node is called the ‘Top’ node, and ‘Up’ node pointers carry you closer to the root.

                         Top
                          |
        -------------------------------------
       |                  |                  |
    Chapter 1          Chapter 2          Chapter 3
       |                  |                  |
    --------           --------           --------
   |        |         |        |         |        |
Section  Section   Section  Section   Section  Section
  1.1      1.2       2.1      2.2       3.1      3.2

Using explicit pointers (not recommended, but shown for purposes of the example), the fully-written command to start Chapter 2 would be this:

@node     Chapter 2,  Chapter 3, Chapter 1, Top
@comment  node-name,  next,      previous,  up

This @node line says that the name of this node is “Chapter 2”, the name of the ‘Next’ node is “Chapter 3”, the name of the ‘Previous’ node is “Chapter 1”, and the name of the ‘Up’ node is “Top”. You can (and should) omit writing out these node names if your document is hierarchically organized , but the pointer relationships still obtain.

Note: ‘Next’ and ‘Previous’ refer to nodes at the same hierarchical level in the manual, not necessarily to the next node within the Texinfo file. In the Texinfo file, the subsequent node may be at a lower level—a section-level node most often follows a chapter-level node, for example. (The ‘Top’ node contains the exception to this rule. Since the ‘Top’ node is the only node at that level, ‘Next’ refers to the first following node, which is almost always a chapter or chapter-level node.)

To go to Sections 2.1 and 2.2 using Info, you need a menu inside Chapter 2. (See Menus.) You would write the menu just before the beginning of Section 2.1, like this:

   @menu
   * Sect. 2.1::    Description of this section.
   * Sect. 2.2::    Description.
   @end menu

Using explicit pointers, the node for Sect. 2.1 is written like this:

@node     Sect. 2.1, Sect. 2.2, Chapter 2, Chapter 2
@comment  node-name, next,      previous,  up

In Info format, the ‘Next’ and ‘Previous’ pointers of a node usually lead to other nodes at the same level—from chapter to chapter or from section to section (sometimes, as shown, the ‘Previous’ pointer points up); an ‘Up’ pointer usually leads to a node at the level above (closer to the ‘Top’ node); and a ‘Menu’ leads to nodes at a level below (closer to ‘leaves’). (A cross-reference can point to a node at any level; see Cross-references.)

A @node command and a chapter structuring command are conventionally used together, in that order, often followed by indexing commands. (As shown in the example above, you may follow the @node line with a comment line, e.g., to show which pointer is which if explicit pointers are used.) The Texinfo processors use this construct to determine the relationships between nodes and sectioning commands.

Here is the beginning of the chapter in this manual called “Ending a Texinfo File”. This shows a @node line followed by a @chapter line, and then by indexing lines.

@node Ending a File
@chapter Ending a Texinfo File
@cindex Ending a Texinfo file
@cindex Texinfo file ending
@cindex File ending

Next: Menus, Previous: Texinfo Document Structure, Up: Nodes   [Contents][Index]