ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] numbered itemize list item label alignment
@ 2023-10-15 13:51 Csikos Bela
  2023-10-15 15:32 ` [NTG-context] " Pablo Rodriguez
  2023-10-15 20:14 ` Wolfgang Schuster
  0 siblings, 2 replies; 5+ messages in thread
From: Csikos Bela @ 2023-10-15 13:51 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 530 bytes --]

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\stoptextThe resulted pdf is attached as context-itemize-label-alignment.pdf.Thank you in advance,bcsikos

[-- Attachment #1.2: Type: text/html, Size: 845 bytes --]

[-- Attachment #2: context-itemize-label-alignment.pdf --]
[-- Type: application/pdf, Size: 14926 bytes --]

[-- Attachment #3: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: numbered itemize list item label alignment
  2023-10-15 13:51 [NTG-context] numbered itemize list item label alignment Csikos Bela
@ 2023-10-15 15:32 ` Pablo Rodriguez
  2023-10-15 20:14 ` Wolfgang Schuster
  1 sibling, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2023-10-15 15:32 UTC (permalink / raw)
  To: ntg-context

On 10/15/23 15:51, Csikos Bela wrote:
> 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?

Hi Csikos,

width is the key, such as in:

  \showframe\showgrid\showstruts
  \starttext
  \startitemize[n,broad][width=.125tw, itemalign=flushright]
  \dorecurse{250}{\item aaaa}
  \stopitemize
  \stoptext

I assigned ⅛ text width to the number width to clearly display it.

Just in case it helps,

Pablo

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: numbered itemize list item label alignment
  2023-10-15 13:51 [NTG-context] numbered itemize list item label alignment Csikos Bela
  2023-10-15 15:32 ` [NTG-context] " Pablo Rodriguez
@ 2023-10-15 20:14 ` Wolfgang Schuster
  2023-10-15 20:32   ` Aditya Mahajan
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2023-10-15 20:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Csikos Bela

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: numbered itemize list item label alignment
  2023-10-15 20:14 ` Wolfgang Schuster
@ 2023-10-15 20:32   ` Aditya Mahajan
  2023-10-19 20:22     ` Csikos Bela
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2023-10-15 20:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 15 Oct 2023, Wolfgang Schuster wrote:

> 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.

I normally use the `fit` key with an appropriate value of `distance`. For example:

\showframe[text][text]

\starttext

\startitemize[n,fit,broad][distance=0.25em,itemalign=flushright]
\dorecurse{1}{\startitem xxx\stopitem}
\stopitemize

\page

\startitemize[n,fit,broad][distance=0.25em,itemalign=flushright]
\dorecurse{11}{\startitem xxx\stopitem}
\stopitemize

\page

\startitemize[n,fit,broad][distance=0.25em,itemalign=flushright]
\dorecurse{111}{\startitem xxx\stopitem}
\stopitemize

\stoptext

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: numbered itemize list item label alignment
  2023-10-15 20:32   ` Aditya Mahajan
@ 2023-10-19 20:22     ` Csikos Bela
  0 siblings, 0 replies; 5+ messages in thread
From: Csikos Bela @ 2023-10-19 20:22 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1667 bytes --]

-------- Eredeti levél --------Feladó: Aditya Mahajan <adityam@umich.edu>Dátum: 2023 október 15 22:32:37Tárgy: Re: [NTG-context] Re: numbered itemize list item label alignmentCímzett: mailing list for ConTeXt users <ntg-context@ntg.nl>On Sun, 15 Oct 2023, Wolfgang Schuster wrote:  > 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.  I normally use the `fit` key with an appropriate value of `distance`. For example:  \showframe[text][text]  \starttext  \startitemize[n,fit,broad][distance=0.25em,itemalign=flushright] \dorecurse{1}{\startitem xxx\stopitem} \stopitemize  \page  \startitemize[n,fit,broad][distance=0.25em,itemalign=flushright] \dorecurse{11}{\startitem xxx\stopitem} \stopitemize  \page  \startitemize[n,fit,broad][distance=0.25em,itemalign=flushright] \dorecurse{111}{\startitem xxx\stopitem} \stopitemize  \stoptext  Thank you, the fit option worked well.bcsikos

[-- Attachment #1.2: Type: text/html, Size: 2931 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-19 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-15 13:51 [NTG-context] numbered itemize list item label alignment Csikos Bela
2023-10-15 15:32 ` [NTG-context] " Pablo Rodriguez
2023-10-15 20:14 ` Wolfgang Schuster
2023-10-15 20:32   ` Aditya Mahajan
2023-10-19 20:22     ` Csikos Bela

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).