ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
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: Prefix the text in an enumeration.
Date: Thu, 13 Jun 2024 16:31:58 +0200	[thread overview]
Message-ID: <43f73bb9-95fe-c44a-2b0d-228ece13c612@gmail.com> (raw)
In-Reply-To: <2294793.g5d078U9FE@falbala>

Gerion Entrup schrieb am 13.06.2024 um 13:41:
> Hi,
> 
> is there a way to automatically prefix the text body in an enumeration?
> 
> Consider this example:
> ```
> \defineenumeration[question][
> 	alternative=top,
> 	text=Question,
> 	title=yes,
> 	titleleft=,
> 	titleright=,
> 	right={:},
> 	headstyle=bold,
> ]
> 
> \starttext
> 
> Some text:
> 
> \startquestion[title={How long does a loop last?}]
> \bold{Answer:} For a while.
> \stopquestion
> 
> \stoptext
> ```
> 
> I'd like to have the `\bold{Answer:}` automatically. So for example something like this:
> ```
> \defineenumeration[question][
> 	alternative=top,
> 	text=Question,
> 	title=yes,
> 	titleleft=,
> 	titleright=,
> 	right={:},
> 	headstyle=bold,
> 	prefix={\bold{Answer:}},
> ]
> 
> \starttext
> 
> Some text:
> 
> \startquestion[title={How long does a loop last?}]
> For a while.
> \stopquestion
> 
> \stoptext
> ```
> 
> I tried to misuse `inbetween` for that but `alternative=top` seems to make a (not modifiable space) between the heading and the text body.

Use the \setupparagraphintro command to set the text which should appear 
at the start of the question.

%%%% begin example
\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
%%%% end example

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
___________________________________________________________________________________

  reply	other threads:[~2024-06-13 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 11:41 [NTG-context] " Gerion Entrup
2024-06-13 14:31 ` Wolfgang Schuster [this message]
2024-06-14  9:01   ` [NTG-context] " Gerion Entrup
2024-06-14  9:51     ` Wolfgang Schuster
2024-06-14 13:59       ` 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=43f73bb9-95fe-c44a-2b0d-228ece13c612@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).