I was wondering if the appearence of a paragraph can depend on its content. E.g. first-line-indent only if it starts with a capital letter or to make the text italic if it starts with "Note: ".
Is that possible?
I was wondering if the appearence of a paragraph can depend on its content. E.g. first-line-indent only if it starts with a capital letter or to make the text italic if it starts with "Note: ".
Is that possible?
Hi. Yes and no. In simple paragraphs like Note: #lorem(20) you can emphasize that with #show regex("Note: .+"): emph. But there is no detection of start/end of a paragraph, you can’t insert code blocks etc. par show rule is extremely hacky and either needs huge care to make it robust enough, or be avoided all together. With enough effort and desire it’s possible to do for most paragraphs.
I agree with @andrew, conditionally applying first-line-indent in that manner would be tricky, even when assuming a par would always start with nothing but characters.
For your second example, you might be better off using terms. I would say this element implements the “different start” sort of disparity the closest:
#show terms.item.where(term: [Notes]): emph
/ Notes: description here
This conveys the meaning in code clearly, however it’s repetitive, so one could easily make a mistake:
/ Nots: ...
A properly named function would probably solve this best for now:
#let notes(body) = emph(terms.item("Notes", body))
#notes[description here]
The same actually goes for paragraphs in your first example, where it’s easy to mistype the capital letter.
Again, I don’t think a universal solution for all paragraphs is possible at the moment. It’s at least unclear whether you were specifically targeting par in your question or all kinds of paragraphs.
At that point it’s better to just have
#let note(body) = emph[Note: #body.]
#note[#lorem(20)]
if it’s supposed to be just a paragraph.