Skip to main content

Options

Struct Options 

Source
#[non_exhaustive]
pub struct Options { pub form: Form, pub labels: Labels, pub open: OpenGoal, pub align: bool, pub ebproof: String, pub preamble: Option<String>, pub lambda: Option<Options>, }
Expand description

The choices of the LaTeX output.

Start from Options::default() and change the fields you want, by assignment or with the with_* methods. The struct is #[non_exhaustive], so a field added later breaks no caller.

§Examples

A sequent as a document that compiles on its own:

use deduxit::export::{Form, latex};
use deduxit::{Limits, linear::{Mode, Sequent}};

let sequent: Sequent = "A |- A".parse()?;
let options = latex::Options::default().with_form(Form::Standalone);
let document = latex::sequent(&sequent, Mode::CLASSICAL, &options, &Limits::default())?;
assert_eq!(
    document,
    r"\documentclass[border=5pt]{standalone}
\usepackage{amssymb}
\usepackage{cmll}
\begin{document}
$\vdash A^\bot, A$
\end{document}"
);

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§form: Form

A fragment to paste, or a document that compiles on its own.

§labels: Labels

The labels of the rules.

§open: OpenGoal

How an open goal is drawn: under \vdots, bare (\hypo), under a line labelled with a mark, or under ebproof’s dashed line.

§align: bool

Whether the turnstiles of a two-sided tree line up (ebproof’s &).

§ebproof: String

The options of every prooftree environment, as ebproof reads them between brackets. Empty for none.

§preamble: Option<String>

What a standalone document starts with, before \begin{document}.

None gives the standalone class, cropped to the content, with amssymb, cmll and, for a tree, ebproof. A preamble of your own must load those packages itself.

§lambda: Option<Options>

The derivation’s lambda-term, written under its conclusion as its typing judgement (lambda), with these options. None, the default, writes no term.

The term is in LaTeX’s notation, whatever notation says. Before anything is written, write() refuses a derivation that has no term (Error::NoTerm), and a term whose text would pass the default output bound (Limits::DEFAULT_DERIVATION_BYTES).

Implementations§

Source§

impl Options

Source

pub fn with_form(self, form: Form) -> Self

Returns the options with another form.

Source

pub fn with_labels(self, labels: Labels) -> Self

Returns the options with another labels.

Source

pub fn with_open(self, open: OpenGoal) -> Self

Returns the options with another open.

Source

pub fn with_align(self, align: bool) -> Self

Returns the options with another align.

Source

pub fn with_ebproof(self, ebproof: String) -> Self

Returns the options with another ebproof.

Source

pub fn with_preamble(self, preamble: Option<String>) -> Self

Returns the options with another preamble.

Source

pub fn with_lambda(self, lambda: Option<Options>) -> Self

Returns the options with another lambda.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Self

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 Options

Source§

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

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

impl Default for Options

Source§

fn default() -> Self

Returns the options of a fragment with upright labels, an open goal under vertical dots, aligned turnstiles, no ebproof options, the standalone preamble and no lambda-term.

Source§

impl<'de> Deserialize<'de> for Options

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Options

Source§

impl PartialEq for Options

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Options

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Options

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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, !>

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.