pub struct ExtraPreamble {
pub before_packages: String,
pub after_packages: String,
pub at_end: String,
}Expand description
The LaTeX a document’s author gives to be written into the style file
exactly as given, in the three places it can go: the render option
extra_preamble
of the latex-recomposed backend.
Each of the three texts is written byte for byte: nothing in it is escaped, quoted, parsed or checked, and the only thing added is the line break the next line needs where the text does not end in one. Each is written under a comment line of its own, so that a reader of the file sees where the library’s own output stops. A text left empty writes nothing at all — no comment line either.
The three differ only in where they are placed, and each place serves a different need:
before_packagesis placed between the file’s header and the package block, which is where\PassOptionsToPackagemust be to reach a package the block requests, and where a package that must be loaded before the others is loaded.after_packagesis placed directly after the package block and the default-encoding command, before everything the library defines. A definition made there wins over the LaTeX family’s own, because every definition piece the family writes is guarded (\ProvideDocumentCommandand the related commands); this is how a LaTeX hook is replaced rather than patched.at_endis placed at the bottom, after everything the file holds and before\endinput, so it can use any of it: patch a definition piece, redefine a LaTeX hook, define a command the document’s own mathematics uses.
Fields§
§before_packages: StringWritten after the file’s header and before the package block. Empty by default.
after_packages: StringWritten after the package block and the default-encoding command, and before the character declarations, the definition pieces and the user definitions. Empty by default.
at_end: StringWritten at the bottom of the file, after everything else and before
\endinput. Empty by default.
Implementations§
Source§impl ExtraPreamble
impl ExtraPreamble
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether all three texts are empty, so that nothing of the author’s own is written into the style file.
§Examples
use flm_core::stdlib::backends::latex::style::ExtraPreamble;
assert!(ExtraPreamble::default().is_empty());
let mine = ExtraPreamble { at_end: String::from("\\relax"), ..Default::default() };
assert!(!mine.is_empty());Trait Implementations§
Source§impl Clone for ExtraPreamble
impl Clone for ExtraPreamble
Source§impl Debug for ExtraPreamble
impl Debug for ExtraPreamble
Source§impl Default for ExtraPreamble
impl Default for ExtraPreamble
Source§impl<'de> Deserialize<'de> for ExtraPreamblewhere
ExtraPreamble: Default,
impl<'de> Deserialize<'de> for ExtraPreamblewhere
ExtraPreamble: Default,
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 ExtraPreamble
Source§impl Hash for ExtraPreamble
impl Hash for ExtraPreamble
Source§impl JsonSchema for ExtraPreamble
impl JsonSchema for ExtraPreamble
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 ExtraPreamble
impl PartialEq for ExtraPreamble
impl StructuralPartialEq for ExtraPreamble
Auto Trait Implementations§
impl Forget for ExtraPreamble
impl Freeze for ExtraPreamble
impl Move for ExtraPreamble
impl RefUnwindSafe for ExtraPreamble
impl Send for ExtraPreamblewhere
RawVecInner: Send,
impl Sync for ExtraPreamblewhere
RawVecInner: Sync,
impl Unpin for ExtraPreamble
impl UnsafeUnpin for ExtraPreamble
impl UnwindSafe for ExtraPreamblewhere
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