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: booltrue for environments whose body is raw text (verbatim, lstlisting,
minted, …) and must never be reflowed.
verbatim_arg: booltrue 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: booltrue for math environments (equation, align, …).
code: booltrue 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: booltrue 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: booltrue 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: booltrue 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: booltrue 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: booltrue 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: booltrue 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§
Trait Implementations§
Source§impl Clone for EnvironmentSig
impl Clone for EnvironmentSig
Source§fn clone(&self) -> EnvironmentSig
fn clone(&self) -> EnvironmentSig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more