From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Gerion Entrup <gerion.entrup@flump.de>
Subject: [NTG-context] Re: Use headcommand in \definedescription together with \definehighlight
Date: Tue, 25 Jun 2024 00:09:09 +0200 [thread overview]
Message-ID: <03ebfd5a-b83f-09d5-2544-cd2eca309d76@gmail.com> (raw)
In-Reply-To: <8750205.cEBGB3zze1@falbala>
Gerion Entrup schrieb am 24.06.2024 um 23:57:
> 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).
1. ConTeXt already uses \hl as name for a existing command.
2. Use \definestartstop:
\definestartstop [gerion] [style=mono,left={›\thinspace}]
\starttext
text
\gerion{text}
\stoptext
>> \definedescription[category][
>> alternative=top,
>> headstyle=bold,
>> width=broad,
>> ]
>>
>> \definedescription[desc][
>> width=fit,
>> distance={\widthofstring{~}},
distance=\spaceamount,
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2024-06-24 22:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 17:19 [NTG-context] " Gerion Entrup
2024-06-24 19:20 ` [NTG-context] " Aditya Mahajan
2024-06-24 21:57 ` Gerion Entrup
2024-06-24 22:09 ` Wolfgang Schuster [this message]
2024-06-25 6:41 ` [NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop) Gerion Entrup
2024-06-27 20:19 ` Wolfgang Schuster
2024-06-28 9:40 ` Gerion Entrup
2024-06-28 9:59 ` Wolfgang Schuster
2024-07-01 18:11 ` Gerion Entrup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03ebfd5a-b83f-09d5-2544-cd2eca309d76@gmail.com \
--to=wolfgang.schuster.lists@gmail.com \
--cc=gerion.entrup@flump.de \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).