Skip to main content

ContentKind

Enum ContentKind 

Source
pub enum ContentKind {
    Opaque,
    Prose,
    TokenList,
    Keyval,
}
Expand description

How the formatter treats an argument’s content — its whitespace and break policy. This metadata is for formatter consumers; the parser ignores it.

Variants§

§

Opaque

Left exactly as authored: names, identifiers, code, or option lists (\label, the \newcommand body). The default, so an unmarked argument never reflows — for most arguments interior whitespace can matter (a minipage/\parbox body, a label key).

§

Prose

Running prose the formatter may reflow to the line width (e.g. a \footnote/\caption body, a sectioning title).

§

TokenList

A comma-separated token list whose interior whitespace is insignificant, so the formatter may collapse a multi-line authored form to a single line (a \citep/\cite key list). Unlike Prose, the content is not reflowed to the width: the keys stay together as one atom; only incidental source line breaks inside the braces are normalized away, so \citep{\n a,\n b\n} formats identically to \citep{a, b} (determinism).

§

Keyval

A key=value list consumed by a keyval-family processor — keyval, xkeyval, pgfkeys, l3keys, or LaTeX’s own option-list scanner — every one of which strips spaces around keys and values before acting on them. That is what licenses the formatter to break the list at a comma the author glued ([xmin=-5,xmax=5]), materializing a space token TeX will see: in a keyval argument the space is discarded, so the typeset output cannot change.

The distinction is load-bearing and was settled by compiling both spellings: keyval brackets (\usepackage, \includegraphics, tikz/pgfplots, lstlisting) render identically, while textual optionals do not (\item[red,green], \caption[short,list], \cite[see,also], and a \newcommand default all gain a visible space). So this flag must never be set on an argument whose content is typeset — hold it to the same curated standard as the math-env routing.

Weaker than TokenList about where the content may go (a keyval list expands one key per line at the width rather than staying one atom), stronger about what may be inserted between entries.

Trait Implementations§

Source§

impl Clone for ContentKind

Source§

fn clone(&self) -> ContentKind

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 Copy for ContentKind

Source§

impl Debug for ContentKind

Source§

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

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

impl Default for ContentKind

Source§

fn default() -> ContentKind

Returns the “default value” for a type. Read more
Source§

impl Eq for ContentKind

Source§

impl PartialEq for ContentKind

Source§

fn eq(&self, other: &ContentKind) -> 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 ContentKind

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 = Infallible

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.