Term list separator changes
This commit is contained in:
parent
66de90437f
commit
e83e05d541
@ -8,6 +8,8 @@ description: |
|
||||
## Unreleased
|
||||
- **Breaking:** Enumerations now require a space after their marker, that is,
|
||||
`[1.ok]` must now be written as `[1. ok]`
|
||||
- **Breaking:** Changed default style for [term lists]($func/terms): Does not
|
||||
include a colon anymore and has a bit more indent
|
||||
- Fixed bibliography ordering in IEEE style
|
||||
- Fixed parsing of decimals in math: `[$1.2/3.4$]`
|
||||
- Fixed parsing of unbalanced delimiters in fractions: `[$1/(2 (x)$]`
|
||||
@ -21,6 +23,8 @@ description: |
|
||||
- Added support for disabling [matrix]($func/mat) and [vector]($func/vec)
|
||||
delimiters. Generally with `[#set math.mat(delim: none)]` or one-off with
|
||||
`[$mat(delim: #none, 1, 2; 3, 4)$]`.
|
||||
- Added [`separator`]($func/terms.separator) argument to term lists
|
||||
- Fixed [`indent`]($func/terms.indent) property of term lists
|
||||
- Added [`round`]($func/round) function for equations
|
||||
- Numberings now allow zeros. To reset a counter, you can write
|
||||
`[#counter(..).update(0)]`
|
||||
|
@ -118,7 +118,7 @@ pub struct EnumElem {
|
||||
#[default(false)]
|
||||
pub full: bool,
|
||||
|
||||
/// The indentation of each item's label.
|
||||
/// The indentation of each item.
|
||||
#[resolve]
|
||||
pub indent: Length,
|
||||
|
||||
|
@ -78,7 +78,7 @@ pub struct ListElem {
|
||||
#[default(ListMarker::Content(vec![]))]
|
||||
pub marker: ListMarker,
|
||||
|
||||
/// The indent of each item's marker.
|
||||
/// The indent of each item.
|
||||
#[resolve]
|
||||
pub indent: Length,
|
||||
|
||||
|
@ -87,6 +87,15 @@ pub struct TableElem {
|
||||
/// This can either be a single alignment or a function that returns an
|
||||
/// alignment. The function is passed the cell's column and row index,
|
||||
/// starting at zero. If set to `{auto}`, the outer alignment is used.
|
||||
///
|
||||
/// ```example
|
||||
/// #table(
|
||||
/// columns: 3,
|
||||
/// align: (x, y) => (left, center, right).at(x),
|
||||
/// [Hello], [Hello], [Hello],
|
||||
/// [A], [B], [C],
|
||||
/// )
|
||||
/// ```
|
||||
pub align: Celled<Smart<Axes<Option<GenAlign>>>>,
|
||||
|
||||
/// How to stroke the cells.
|
||||
|
@ -1,7 +1,6 @@
|
||||
use super::{HElem, VElem};
|
||||
use crate::layout::{BlockElem, ParElem, Spacing};
|
||||
use crate::prelude::*;
|
||||
use crate::text::{SpaceElem, TextElem};
|
||||
|
||||
/// A list of terms and their descriptions.
|
||||
///
|
||||
@ -42,17 +41,33 @@ pub struct TermsElem {
|
||||
#[default(true)]
|
||||
pub tight: bool,
|
||||
|
||||
/// The indentation of each item's term.
|
||||
/// The separator between the item and the description.
|
||||
///
|
||||
/// If you want to just separate them with a certain amount of space, use
|
||||
/// `{h(2cm, weak: true)}` as the separator and replace `{2cm}` with your
|
||||
/// desired amount of space.
|
||||
///
|
||||
/// ```example
|
||||
/// #set terms(separator: [: ])
|
||||
///
|
||||
/// / Colon: A nice separator symbol.
|
||||
/// ```
|
||||
#[default(HElem::new(Em::new(0.6).into()).with_weak(true).pack())]
|
||||
pub separator: Content,
|
||||
|
||||
/// The indentation of each item.
|
||||
pub indent: Length,
|
||||
|
||||
/// The hanging indent of the description.
|
||||
///
|
||||
/// This is in addition to the whole item's `indent`.
|
||||
///
|
||||
/// ```example
|
||||
/// #set terms(hanging-indent: 0pt)
|
||||
/// / Term: This term list does not
|
||||
/// make use of hanging indents.
|
||||
/// ```
|
||||
#[default(Em::new(1.0).into())]
|
||||
#[default(Em::new(2.0).into())]
|
||||
pub hanging_indent: Length,
|
||||
|
||||
/// The spacing between the items of a wide (non-tight) term list.
|
||||
@ -83,6 +98,7 @@ impl Layout for TermsElem {
|
||||
styles: StyleChain,
|
||||
regions: Regions,
|
||||
) -> SourceResult<Fragment> {
|
||||
let separator = self.separator(styles);
|
||||
let indent = self.indent(styles);
|
||||
let hanging_indent = self.hanging_indent(styles);
|
||||
let gutter = if self.tight(styles) {
|
||||
@ -97,11 +113,11 @@ impl Layout for TermsElem {
|
||||
if i > 0 {
|
||||
seq.push(VElem::new(gutter).with_weakness(1).pack());
|
||||
}
|
||||
if indent.is_zero() {
|
||||
if !indent.is_zero() {
|
||||
seq.push(HElem::new(indent.into()).pack());
|
||||
}
|
||||
seq.push((child.term() + TextElem::packed(':')).strong());
|
||||
seq.push(SpaceElem::new().pack());
|
||||
seq.push(child.term().strong());
|
||||
seq.push(separator.clone());
|
||||
seq.push(child.description());
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Loading…
x
Reference in New Issue
Block a user