numbered itemize list item label alignment
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
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
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
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
-------- Eredeti levél --------Feladó: Aditya Mahajan
participants (4)
-
Aditya Mahajan
-
Csikos Bela
-
Pablo Rodriguez
-
Wolfgang Schuster