Add support for weak elements in math (#1633)
This commit is contained in:
parent
5bdad06d92
commit
a4756d8576
@ -47,6 +47,7 @@ use crate::meta::{
|
||||
Count, Counter, CounterUpdate, LocalName, Numbering, Outlinable, Refable,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use crate::shared::BehavedBuilder;
|
||||
use crate::text::{
|
||||
families, variant, FontFamily, FontList, LinebreakElem, SpaceElem, TextElem, TextSize,
|
||||
};
|
||||
@ -414,7 +415,11 @@ impl LayoutMath for Content {
|
||||
}
|
||||
|
||||
if let Some(children) = self.to_sequence() {
|
||||
let mut bb = BehavedBuilder::new();
|
||||
for child in children {
|
||||
bb.push(child.clone(), StyleChain::default());
|
||||
}
|
||||
for (child, _) in bb.finish().0.iter() {
|
||||
child.layout_math(ctx)?;
|
||||
}
|
||||
return Ok(());
|
||||
|
@ -60,7 +60,7 @@ macro_rules! ops {
|
||||
);)*
|
||||
|
||||
let dif = |d| {
|
||||
HElem::new(THIN.into()).pack()
|
||||
HElem::new(THIN.into()).with_weak(true).pack()
|
||||
+ MathStyleElem::new(TextElem::packed(d)).with_italic(Some(false)).pack()
|
||||
};
|
||||
math.define("dif", dif('d'));
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 28 KiB |
@ -20,6 +20,11 @@ $ binom(circle, square) $
|
||||
// Error: 8-13 missing argument: lower
|
||||
$ binom(x^2) $
|
||||
|
||||
---
|
||||
// Test dif.
|
||||
$ (dif y)/(dif x), dif/x, x/dif, dif/dif \
|
||||
frac(dif y, dif x), frac(dif, x), frac(x, dif), frac(dif, dif) $
|
||||
|
||||
---
|
||||
// Test associativity.
|
||||
$ 1/2/3 = (1/2)/3 = 1/(2/3) $
|
||||
|
Loading…
Reference in New Issue
Block a user