ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: Gerion Entrup <gerion.entrup@flump.de>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: Prefix the text in an enumeration.
Date: Fri, 14 Jun 2024 11:51:28 +0200	[thread overview]
Message-ID: <8fb10c26-cf4b-e660-eff5-6c6e4a858a16@gmail.com> (raw)
In-Reply-To: <3010192.9Mp67QZiUf@falbala>

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
___________________________________________________________________________________
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-14 10:24 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 ` [NTG-context] " Wolfgang Schuster
2024-06-14  9:01   ` Gerion Entrup
2024-06-14  9:51     ` Wolfgang Schuster [this message]
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=8fb10c26-cf4b-e660-eff5-6c6e4a858a16@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).