Skip to main content

EnvironmentSig

Struct EnvironmentSig 

Source
pub struct EnvironmentSig {
    pub args: Cow<'static, [ArgSpec]>,
    pub verbatim_body: bool,
    pub verbatim_arg: bool,
    pub math: bool,
    pub code: bool,
    pub statement_body: bool,
    pub label_key: bool,
    pub align: bool,
    pub no_indent: bool,
    pub list: bool,
    pub block_explicit: bool,
    pub outline: Option<OutlineKind>,
}
Expand description

The signature of an environment.

Fields§

§args: Cow<'static, [ArgSpec]>

The ordered argument slots that follow \begin{name} (e.g. tabular’s column spec), excluding the name group itself. A Cow for the same reason as CommandSig::args: a 'static slice for the CWL tier, an owned Vec for the runtime paths.

§verbatim_body: bool

true for environments whose body is raw text (verbatim, lstlisting, minted, …) and must never be reflowed.

§verbatim_arg: bool

true for environments whose name argument is xparse v-type (l3doc’s macro/function/variable, declared { O{} +v }): besides the usual braced form, the argument may be delimited \verb-style (\begin{macro}+\@@_compile_{:+), chosen precisely when the name holds unbalanced braces. The lexer captures that delimited form as one opaque VERB token; the braced form lexes normally. Curated only — a wrong grant swallows real text, so the CWL/user tiers never set it.

§math: bool

true for math environments (equation, align, …).

§code: bool

true for environments whose body is real parsed code, not prose — the doc/ltxdoc macrocode/macrocode* (whose body is LaTeX/expl3 code, parsed and re-lexed under the package regime, not an opaque verbatim blob like verbatim_body). The formatter preserves the body’s layout and never reflows it as prose; the distinction from verbatim_body is that the content is a real CST, not a single VERBATIM_BODY token.

§statement_body: bool

true for environments whose body is a sequence of delimited statements rather than running prose — the TikZ/pgf picture family, whose content is ;-terminated paths (\draw … ;, \node … ;). The parser wraps each run up to a top-level ; in a STATEMENT node, and the formatter derives one-statement-per-line, the continuation hang, and unit-boundary wrapping (semantic::tikz) from it.

The flag also carries a whitespace-safety claim, the ContentKind::Keyval pattern: whitespace between a flagged body’s statements is insignificant to the package that consumes them, which is what licenses the formatter to open a new line at a statement seam the author glued (…;\draw) — an inserted space token TeX sees but the package discards. task typeset:check carries the proving case (tests/typeset/statement_seams.tex).

Distinct from code, which is the .dtx documentation layer’s macrocode — code re-lexed under the package regime, a fact about lexing. This one is a fact about statement structure and layout, so the two must not be conflated: a future consumer of code is asking a .dtx question.

Curated tier only. The statement terminator is package grammar, not a TeX-surface fact, so nothing mechanical can derive this; the CWL codegen and the runtime definition scan never set it. A wrong grant reshapes layout for the whole body and asserts the whitespace claim above, so hold it to the standard of the math routing flag.

§label_key: bool

true when a top-level label entry in the environment’s first optional argument creates a LaTeX label definition. This is narrower than ContentKind::Keyval: many key-value processors have a label key whose meaning is unrelated to \label, so only curated package facts may set it. Project declarations inherit the fact through like; the CWL and scanned tiers never grant it.

§align: bool

true for alignment environments whose & columns the formatter lays out into a grid (align, pmatrix, …). Independent of math: every flagged environment here is also math, but the formatter consults this flag, not math, to decide column alignment.

§no_indent: bool

true for sectioning-level containers whose body the formatter must not indent (document, the appendix-package appendix, …). The shared property is that the body is whole sections/paragraphs — content at the same structural altitude as the sections the container sits among, not leaf content like a figure or minipage — which is conventionally written flush to the margin. The body is still laid out on its own lines, just at the surrounding indentation level rather than nested one step in.

§list: bool

true for list environments (itemize, enumerate, description, …) whose \items the formatter lays out one per line, reflowing each item’s body with continuation lines hanging-indented under the item text.

§block_explicit: bool

true when this environment is explicitly known to occupy its own vertical space (figure, center, verbatim, …). Math, list, and no-indent environments are inherently block-level and are included by Self::block.

§outline: Option<OutlineKind>

Some(_) for an environment that earns a document-symbol outline entry — a float or a theorem-like. None for everything else. Only meaningful to the language server’s documentSymbol; the parser and formatter ignore it.

Implementations§

Source§

impl EnvironmentSig

Source

pub const fn reflow(&self) -> bool

Whether the body is ordinary prose that the formatter may reflow.

Source

pub const fn block(&self) -> bool

Whether the environment occupies its own vertical space.

Trait Implementations§

Source§

impl Clone for EnvironmentSig

Source§

fn clone(&self) -> EnvironmentSig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnvironmentSig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for EnvironmentSig

Source§

impl PartialEq for EnvironmentSig

Source§

fn eq(&self, other: &EnvironmentSig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EnvironmentSig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.