Skip to main content

Module dialect

Module dialect 

Source
Expand description

§Counters

This is modelled on LaTeX’s counter mechanisms, but since it also provides support for ID’s, even where there is no visible reference number, it is defined in general. These id’s should be both unique, and parallel the visible reference numbers (as much as possible). Also, for consistency, we add id’s to unnumbered document elements (eg from \section*); this requires an additional counter (eg. UNsection) and mechanisms to track it.

Structs§

BeginItemizeOptions
configuration for begin_itemize
NewCounterOptions
configuration for new_counter

Functions§

add_to_counter
increments a named counter by a Number
begin_itemize
Prepare for an list (itemize/enumerate/description/etc) by determining the right counter (level) and binding the right \item ( $type@item, if $type is defined)
counter_value
Fetches the value associated with the counter C<$ctr>.
maybe_note_label
Use to note a discovered label to support label-derived refererence numbers Can by used by \label, among others. Note we only record the label if it hasn’t already been peeked, and consumed.
maybe_peek_label
Use to peek for FOLLOWING \label{…} to support label-derived reference numbers (Perl: MaybePeekLabel)
new_counter
Defines a new counter named $ctr. If within is defined, ctr will be reset whenever within is incremented.
ref_current_id
Recycle the last ID without incrementing (Perl: RefCurrentID) Useful if the last ID-ed box got pruned.
ref_step_counter
Analog of \refstepcounter, steps the counter and returns a hash containing the keys refnum and id.
ref_step_id
For UN-numbered units. Like RefStepCounter, but only steps the “uncounter”, and returns only the id; This is useful for unnumbered cases of objects that normally get both a refnum and id.
ref_step_item_counter
Create id, and tags for an itemize type \item
rescue_caption_counters
Copies the current id, tags, and inlist counter values into whatsit properties Perl: RescueCaptionCounters (latex_constructs.pool.ltxml L3260-3271)
reset_counter
Resets the counter ctr to zero.
set_enumeration_style
Set the enumeration style for a given level. Perl: setEnumerationStyle($stuff, $level) Parses the style tokens to detect A/a/I/i/1 patterns and defines \theenum$level and \labelenum$level accordingly.
set_itemization_style
Set the itemization style for a given level. Perl: setItemizationStyle($stuff, $level) If $level is not given, uses the current @itemlevel. Defines \labelitem$level to $stuff.
step_counter
Analog of \stepcounter, steps the counter and returns the expansion of \the$ctr Usually you should use ref_step_counter(ctr) instead.