mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Add remaining height example for layout
This commit is contained in:
parent
9b09146a6b
commit
ad539ef4ed
@ -41,6 +41,23 @@ use crate::layout::{BlockElem, Size};
|
|||||||
/// receives the page's dimensions minus its margins. This is mostly useful in
|
/// receives the page's dimensions minus its margins. This is mostly useful in
|
||||||
/// combination with [measurement]($measure).
|
/// combination with [measurement]($measure).
|
||||||
///
|
///
|
||||||
|
/// If you want to, for example, get the remaining of the page height after some
|
||||||
|
/// content was already added to the page, wrap the `layout` call in
|
||||||
|
/// `block(height: 1fr)`. But note that adding multiple blocks with height of
|
||||||
|
/// `1fr` together will put them all on the same page, which can be fixed with
|
||||||
|
/// [`pagebreak`].
|
||||||
|
///
|
||||||
|
/// ```example
|
||||||
|
/// #lorem(10)
|
||||||
|
/// #block(height: 1fr, layout(size => {
|
||||||
|
/// block(..size, stroke: 1pt)[
|
||||||
|
/// #align(center + horizon)[
|
||||||
|
/// Remaining height: #size.height
|
||||||
|
/// ]
|
||||||
|
/// ]
|
||||||
|
/// }))
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// You can also use this function to resolve [`ratio`] to fixed lengths. This
|
/// You can also use this function to resolve [`ratio`] to fixed lengths. This
|
||||||
/// might come in handy if you're building your own layout abstractions.
|
/// might come in handy if you're building your own layout abstractions.
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user