Appendix#

Qualified name: rsm.nodes.Appendix

class rsm.nodes.Appendix(label='', types=None, number=None, nonum=False, reftext_template='')[source]#

Bases: Node

Mark the start of the Appendix sections.

The Appendix node currently has no visible output in the manuscript. Instead, it affects how subsequent sections are numbered.

Notes

The Appendix must not contain children. In fact, its parent subclass is Node, not NodeWithChildren. Sections “in” the Appendix should simply appear after an Appendix node.

Examples

In RSM markup, the Appendix is a stamp, i.e. it does not need a closing Halmos.

:manuscript:

# Before Appendix
::

# Before Appendix

## Subsec
::

::

:appendix:

# After Appendix
::

::

The above source is parsed into a Manuscript tree equivalent to the following.

>>> msc = nodes.Manuscript().append(
...     [
...         nodes.Section(title="Before Appendix"),
...         nodes.Section(title="Before Appendix").append(nodes.Subsection(title="Subsec")),
...         nodes.Appendix(),
...         nodes.Section(title="After Appendix"),
...     ]
... )
>>> print(msc.sexp())
(Manuscript
  (Section)
  (Section
    (Subsection))
  (Appendix)
  (Section))

Run the transform step on this Manuscript so the Sections will be autonumbered.

>>> tform = rsm.transformer.Transformer()
>>> tform.transform(msc)
Manuscript(parent=None, [Section, Section, Appendix, Section])

By default, Sections appearing after the Appendix receive letter numerals.

>>> for sec in msc.traverse(nodeclass=nodes.Section):
...     print(f'{sec.full_number}. {sec.title}')
1. Before Appendix
2. Before Appendix
2.1. Subsec
A. After Appendix

Methods

Attributes