Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan:
On Mon, 24 Jun 2024, Gerion Entrup wrote:
Hi,
I was in the process to convert an itemize part to a description and wanted to simplify the code in the same move. I discovered headcommand for that, but struggled to set the text in an highlight _and_ make a colon at the end.
Not sure what exactly you want, but how about:
\definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}] % This is the wrong way to define such a command as '>' is not part of the style. I have left this definition just for comparison with the soln below.
Is there a better way to define a highlight that sets a style (color, font) _and_ a prefix (symbol)? Another way, I know of, would be just a plain def, something like \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I want to define a highlight (just with an additional prefix).
\definedescription[category][ alternative=top, headstyle=bold, width=broad, ]
\definedescription[desc][ width=fit, distance={\widthofstring{~}}, headcommand={\groupedcommand{>\,}{:}},
Hmm, this works, but duplicates the above definition. If I don't want to use > as prefix but ›, I need to replace it in two places.
headstyle=\tt, before={\startpacked}, after={\stoppacked}, alternative=hanging, ]
Gerion