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>,
	Csikos Bela <bcsikos425@freemail.hu>
Subject: [NTG-context] Re: numbered itemize list item label alignment
Date: Sun, 15 Oct 2023 22:14:48 +0200	[thread overview]
Message-ID: <79562def-7954-cd10-0461-3e8292fd8998@gmail.com> (raw)
In-Reply-To: <A19Upg.QiUnJU4z4VK2.kBUsFTYcqV1xPcQ6WKZa@freemail.hu>

Csikos Bela schrieb am 15.10.2023 um 15:51:
> Hello:
>
> I would like to make a long numbered itemize list, where the numbers 
> increase up to three digits.
> I would like the numbered labels aligned to the right and the widest 
> label's left side located at the left margin.
> I tried the below code but the 3 digit labels' left sides go into the 
> left margin. How can I fix it?
>
> Code:
>
> \showframe
> \starttext
> \startitemize[n,broad][itemalign=flushright]
> \dorecurse{250}{\item aaaa}
> \stopitemize
> \stoptext

You can use the width-key to set a value for the number, below is a 
example for method
to calculate the width based on the number of items but I would use 
fixed value
(e.g. width=2em) to let all items (independent of the entries) start on 
the same position.

\defineexpandable\ItemWidth
   {\ifnum\lastcountervalue[itemgroup:itemize]>99
      \widthofstring{000.}%
    \orelse\ifnum\lastcountervalue[itemgroup:itemize]>9
      \widthofstring{00.}%
    \else
      \widthofstring{0.}%
    \fi}

\showframe[text][text]

\starttext

\startitemize[n][width=\ItemWidth,itemalign=flushright]
\dorecurse{1}{\startitem xxx\stopitem}
\stopitemize

\page

\startitemize[n][width=\ItemWidth,itemalign=flushright]
\dorecurse{11}{\startitem xxx\stopitem}
\stopitemize

\page

\startitemize[n][width=\ItemWidth,itemalign=flushright]
\dorecurse{111}{\startitem xxx\stopitem}
\stopitemize

\stoptext

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
___________________________________________________________________________________

  parent reply	other threads:[~2023-10-15 20:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-15 13:51 [NTG-context] " Csikos Bela
2023-10-15 15:32 ` [NTG-context] " Pablo Rodriguez
2023-10-15 20:14 ` Wolfgang Schuster [this message]
2023-10-15 20:32   ` Aditya Mahajan
2023-10-19 20:22     ` Csikos Bela

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=79562def-7954-cd10-0461-3e8292fd8998@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=bcsikos425@freemail.hu \
    --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).