Algorithm#
Qualified name: rsm.nodes.Algorithm
- class rsm.nodes.Algorithm(**kwargs)[source]#
Bases:
NodeWithChildren
Algorithm pseudocode.
Notes
The contents of an Algorithm node are not RSM markup. They must be written in LaTeX-style notation using the algorithmic [1] environment.
RSM uses pseudocode.js [2] to render algorithms in the frontend.
References
Examples
:manuscript: :algorithm: \begin{algorithm} \caption{Quicksort} \begin{algorithmic} \PROCEDURE{Quicksort}{$A, p, r$} \IF{$p < r$} \STATE $q = $ \CALL{Partition}{$A, p, r$} \STATE \CALL{Quicksort}{$A, p, q - 1$} \STATE \CALL{Quicksort}{$A, q + 1, r$} \ENDIF \ENDPROCEDURE \PROCEDURE{Partition}{$A, p, r$} \STATE $x = A[r]$ \STATE $i = p - 1$ \FOR{$j = p$ \TO $r - 1$} \IF{$A[j] < x$} \STATE $i = i + 1$ \STATE exchange $A[i]$ with $A[j]$ \ENDIF \STATE exchange $A[i]$ with $A[r]$ \ENDFOR \ENDPROCEDURE \end{algorithmic} \end{algorithm} :: ::
Methods
Attributes
Whether to automatically assign a number to this node during transform step.
- autonumber: ClassVar[bool] = True[source]#
Whether to automatically assign a number to this node during transform step.
Examples
>>> msc, thm1, thm2 = nodes.Manuscript(), nodes.Theorem(), nodes.Theorem() >>> (thm1.number, thm2.number) == (None, None) True >>> tform = rsm.transformer.Transformer() >>> tform.transform(msc.append([thm1, thm2])) >>> thm1.number, thm2.number (1, 2)