pub struct TheoremClass {
pub numbered: bool,
pub shared_counter: bool,
pub heading: String,
pub closing_mark: Option<String>,
pub relation_ref: bool,
}Expand description
One theorem class: what a family of theorem kinds shares. A class
says whether its kinds are numbered and in which counter, how their
heading is written, whether a closing mark ends them, and whether a title
beginning with * is read as a back-reference to the statement a theorem
proves.
A class is declared under its name in TheoremsConfig::classes, and a
kind refers to it by that name (TheoremKind::class). The three shipped
classes are theoremlike and definitionlike, numbered in the shared
counter, and prooflike, unnumbered, closed by the mark □ and reading a
back-reference from its title (see TheoremsConfig). The constructors
numbered and
unnumbered start a class, and the builders
set its other fields.
§Examples
use flm_core::stdlib::features::theorems::{TheoremClass, DEFAULT_HEADING};
// Numbered, each kind in a counter of its own, the title joined by "of".
let exercise = TheoremClass::numbered()
.shared_counter(false)
.heading(r"#{name}\IfValueT{#{title}}{ of #{title}}");
assert!(exercise.numbered && !exercise.shared_counter);
// Unnumbered, with a closing mark, reading `[*lem:x]` as a back-reference.
let prooflike = TheoremClass::unnumbered()
.closing_mark(Some(r"\(\blacksquare\)".to_string()))
.relation_ref(true);
assert_eq!(prooflike.heading, DEFAULT_HEADING);Fields§
§numbered: boolWhether the kinds of this class are numbered. A theorem of a numbered kind is one reference point numbered in the class’s counter; a theorem of an unnumbered kind is a reference point that nothing numbers and that accepts no label.
For a numbered class, whether its kinds count in the shared counter
flm.theorems.theorem (true), or each kind in a counter of its own,
flm.theorems.counter.<kind> (false); see
numbers. Unused for an unnumbered class.
heading: StringThe theorem heading template: how the heading that opens every theorem of the class joins the kind’s word and number with the theorem’s title. It is written in the template language (the language guide describes it for authors under the template language), with two placeholders:
#{name}is the kind’s word and the theorem’s number (Lemma~4), or the word alone where the theorem has no number;#{title}is the theorem’s title, or, for a class that reads back-references, the statement a proof refers to. A theorem with no title, or whose back-reference is not shown, binds nothing to#{title}, so\IfValueT{#{title}}{…}tests whether there is one. The template may show#{title}at most once; an occurrence as the test of a conditional (\IfValueT{#{title}}) is not counted.
DEFAULT_HEADING by default. A template that does not compile fails
the registry build (heading). The recomposed LaTeX
does not use the template: LaTeX writes the heading
(latex).
closing_mark: Option<String>The closing mark written at the end of every theorem of the class, as
FLM markup (□ for the shipped class prooflike), or None for no
mark. A mark that does not parse fails the registry build.
relation_ref: boolWhether a title beginning with * is read as a back-reference to the
statement the theorem proves: [*lem:x] shows the statement’s word
and number in the heading, and [**lem:x] refers to the same
statement and shows nothing in the heading
(title_reading). A class that does not read
back-references takes every title as a title.
Implementations§
Source§impl TheoremClass
impl TheoremClass
Sourcepub fn numbered() -> TheoremClass
pub fn numbered() -> TheoremClass
A numbered class counting in the shared counter, with the heading
template DEFAULT_HEADING, no closing mark, and titles that are
never read as back-references.
Sourcepub fn unnumbered() -> TheoremClass
pub fn unnumbered() -> TheoremClass
An unnumbered class, with the heading template DEFAULT_HEADING, no
closing mark, and titles that are never read as back-references.
Builder: whether the kinds count in the shared counter.
Sourcepub fn heading(self, heading: impl Into<String>) -> TheoremClass
pub fn heading(self, heading: impl Into<String>) -> TheoremClass
Builder: sets the heading template.
Sourcepub fn closing_mark(self, closing_mark: Option<String>) -> TheoremClass
pub fn closing_mark(self, closing_mark: Option<String>) -> TheoremClass
Builder: sets the closing mark (FLM markup), or None for no mark.
Sourcepub fn relation_ref(self, relation_ref: bool) -> TheoremClass
pub fn relation_ref(self, relation_ref: bool) -> TheoremClass
Builder: whether a title beginning with * is read as a
back-reference.
Trait Implementations§
Source§impl Clone for TheoremClass
impl Clone for TheoremClass
Source§impl Debug for TheoremClass
impl Debug for TheoremClass
Source§impl<'de> Deserialize<'de> for TheoremClass
impl<'de> Deserialize<'de> for TheoremClass
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TheoremClass
Source§impl JsonSchema for TheoremClass
impl JsonSchema for TheoremClass
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for TheoremClass
impl PartialEq for TheoremClass
Source§impl Serialize for TheoremClass
impl Serialize for TheoremClass
impl StructuralPartialEq for TheoremClass
Auto Trait Implementations§
impl Forget for TheoremClass
impl Freeze for TheoremClass
impl Move for TheoremClass
impl RefUnwindSafe for TheoremClass
impl Send for TheoremClasswhere
RawVecInner: Send,
impl Sync for TheoremClasswhere
RawVecInner: Sync,
impl Unpin for TheoremClass
impl UnsafeUnpin for TheoremClass
impl UnwindSafe for TheoremClasswhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more