
Gerion Entrup schrieb am 14.06.2024 um 11:01:
Am Donnerstag, 13. Juni 2024, 16:31:58 MESZ schrieb Wolfgang Schuster:
\startsetups[question:intro] \setupparagraphintro[first][\bold{Answer:} ] \blank \stopsetups
\defineenumeration[question][ alternative=top, text=Question, title=yes, titleleft=, titleright=, right={:}, headstyle=bold, inbetween=\setup{question:intro}, ]
\starttext
Some text:
\startquestion[title={How long does a loop last?}] For a while. \stopquestion
\stoptext
Thank you. That works well for this case.
I have a follow up question. I tried to additionally set a titledistance and reproduce that for the "Answer:"-part. ConTeXt then introduces a mysterious newline.
See this example:
\definehspace[dist][1em] \startsetups[question:intro] \setupparagraphintro[first][\bold{Answer:}\hspace[1em]] \blank \stopsetups
You need 2 changes for \setupparagraphintro: 1. Change the argument of \hspace to "dist" because the commands accepts only keywords and everything else (even a valid length) is ignored and results in a horizontal skip of 0pt. 2. You have to add curly braces around the content when the content includes square brackets because nesting of optional arguments isn't supported yet. The correct version of the one above is: \startsetups[question:intro] \setupparagraphintro[first][{\bold{Answer:}\hspace[dist]}] \blank \stopsetups Wolfgang