parent
0804a9e25d
commit
7b61d722dd
@ -114,8 +114,27 @@ pub struct TableElem {
|
||||
pub stroke: Option<Stroke>,
|
||||
|
||||
/// How much to pad the cells' content.
|
||||
#[default(Abs::pt(5.0).into())]
|
||||
pub inset: Rel<Length>,
|
||||
///
|
||||
/// ```example
|
||||
/// #table(
|
||||
/// inset: 10pt,
|
||||
/// [Hello],
|
||||
/// [World],
|
||||
/// )
|
||||
///
|
||||
/// #table(
|
||||
/// columns: 2,
|
||||
/// inset: (
|
||||
/// x: 20pt,
|
||||
/// y: 10pt,
|
||||
/// ),
|
||||
/// [Hello],
|
||||
/// [World],
|
||||
/// )
|
||||
/// ```
|
||||
#[fold]
|
||||
#[default(Sides::splat(Abs::pt(5.0).into()))]
|
||||
pub inset: Sides<Option<Rel<Length>>>,
|
||||
|
||||
/// The contents of the table cells.
|
||||
#[variadic]
|
||||
@ -141,7 +160,7 @@ impl Layout for TableElem {
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(i, child)| {
|
||||
let mut child = child.padded(Sides::splat(inset));
|
||||
let mut child = child.padded(inset);
|
||||
|
||||
let x = i % cols;
|
||||
let y = i / cols;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 12 KiB |
@ -29,6 +29,38 @@
|
||||
[A], [B], [C]
|
||||
)
|
||||
|
||||
---
|
||||
// Test inset.
|
||||
#table(
|
||||
columns: 3,
|
||||
inset: 10pt,
|
||||
[A], [B], [C]
|
||||
)
|
||||
|
||||
#table(
|
||||
columns: 3,
|
||||
inset: (y: 10pt),
|
||||
[A], [B], [C]
|
||||
)
|
||||
|
||||
#table(
|
||||
columns: 3,
|
||||
inset: (left: 20pt, rest: 10pt),
|
||||
[A], [B], [C]
|
||||
)
|
||||
|
||||
#table(
|
||||
columns: 2,
|
||||
inset: (
|
||||
left: 20pt,
|
||||
right: 5pt,
|
||||
top: 10pt,
|
||||
bottom: 3pt,
|
||||
),
|
||||
[A],
|
||||
[B],
|
||||
)
|
||||
|
||||
---
|
||||
// Ref: false
|
||||
#table()
|
||||
|
Loading…
x
Reference in New Issue
Block a user