How to change the appearance of the terms in a term list?

The terms in a term list are normally displayed in bold. I would like the terms to be displayed regularly.

I have tried it with a show rule on terms.item, but I had no success. My show rule has changed the complete entry. I have not found a way to change only the term part.

#show terms.item: set text(fill: red)

/ Term A: #lorem(20)
/ Term B: #lorem(20)

Hi @Olaf, potential duplicate ?

There’s these two viewpoints and I think it’s funny to put them next to each other

  • it’s a pity Typst doesn’t have separate elements for term list term and description for styling (I think it will in the future)
  • Typst styles each term with strong by default so that is in fact pragmatically, how they are marked, and we can use that. :wink:
#show strong: it => {
  set text(red)
  it.body  // take the text out of `strong` to unbold it
}
/ A: 1
/ B: 2

terms with red terms

2 Likes

Using show terms.item, we can recreate the styling that you want. First, here’s a show rule to recreate the defaults:

#show terms.item: it => {
  strong(it.term)
  terms.separator
  it.description
  linebreak()
}

/ A: 1
/ B: 2

(mostly; I think there’s a small difference in that this doesn’t put the whole terms list in a paragraph/block?)

… based on this, it’s easy to create to formatting you want:

#show terms.item: it => {
  text(red, it.term)
  terms.separator
  it.description
  linebreak()
}

/ A: 1
/ B: 2
4 Likes

The difference that this doesn’t put the whole terms list in a block is substantial IMO. Your solution obeys paragraph indentation, so, if the paragraphs have first-line indentation, your terms list too would have it. Also, your terms list ignores the settings tight, separator, indent, hanging-indent, spacing.

Yes, the purpose of my post was to demonstrate that and how it could be done. Since OP didn’t want to recreate the default styling, I consider this good enough. Someone who does need to restore more of the defaults (e.g. you) can use the same principles shown here to do a more thorough job.

I will add that you may want to use show terms in addition to show terms.item to reproduce all stylings. Apart from that, it’s the same ingredients.

Reproducing default styling is often difficult because it is not documented.

I suggest that all elements would have the default styling included in the documentation.

Yeah, there is an issue about that: Add default typst implementation code where possible · Issue #5095 · typst/typst · GitHub (actually, the more directly relevant issue is #3493, but it has been superseded by the one I linked). It’s just not the subject of this question.