summaryrefslogtreecommitdiff
path: root/library/src/math/cancel.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-17 14:41:46 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-17 14:41:46 +0200
commit551ea99d05166b0be50792f767ddd38b996e32fa (patch)
treeec5e86a087e79e8c181c7d4b904216a775227e2d /library/src/math/cancel.rs
parent46aace78ac4ac1c075b9b1670dbb7372df1a0a82 (diff)
Show default values in documentation
Fixes #169 Fixes #1102
Diffstat (limited to 'library/src/math/cancel.rs')
-rw-r--r--library/src/math/cancel.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/library/src/math/cancel.rs b/library/src/math/cancel.rs
index 9a0ffb7a..643eb9eb 100644
--- a/library/src/math/cancel.rs
+++ b/library/src/math/cancel.rs
@@ -24,8 +24,6 @@ pub struct CancelElem {
/// the whole element being "cancelled". A value of `{100%}` would then have
/// the line span precisely the element's diagonal.
///
- /// Defaults to `{100% + 3pt}`.
- ///
/// ```example
/// >>> #set page(width: 140pt)
/// $ a + cancel(x, length: #200%)
@@ -37,8 +35,6 @@ pub struct CancelElem {
/// If the cancel line should be inverted (pointing to the top left instead
/// of top right).
///
- /// Defaults to `{false}`.
- ///
/// ```example
/// >>> #set page(width: 140pt)
/// $ (a cancel((b + c), inverted: #true)) /
@@ -50,8 +46,6 @@ pub struct CancelElem {
/// If two opposing cancel lines should be drawn, forming a cross over the
/// element. Overrides `inverted`.
///
- /// Defaults to `{false}`.
- ///
/// ```example
/// >>> #set page(width: 140pt)
/// $ cancel(Pi, cross: #true) $
@@ -85,6 +79,11 @@ pub struct CancelElem {
/// ```
#[resolve]
#[fold]
+ #[default(PartialStroke {
+ // Default stroke has 0.5pt for better visuals.
+ thickness: Smart::Custom(Abs::pt(0.5)),
+ ..Default::default()
+ })]
pub stroke: PartialStroke,
}
@@ -100,10 +99,8 @@ impl LayoutMath for CancelElem {
let span = self.span();
let length = self.length(styles).resolve(styles);
- // Default stroke has 0.5pt for better visuals.
let stroke = self.stroke(styles).unwrap_or(Stroke {
paint: TextElem::fill_in(styles),
- thickness: Abs::pt(0.5),
..Default::default()
});