How to align numerals in lists on the dot or paranthesis that follows the numeral?
At least in the U.S., it is the rule and a strict requirement to typeset vertical lists in such a way that the numerals align on the dot or parenthesis following the numeral. (even the daily violation of the rule by some of the most widely used word processors such as MS Word has not changed this old-aged convention.) I feel it must be possible in ConTeXt to do this because it is such a basic requirement and ConTeXt is used professionally. However, it's not the default behavior and I don't know which options will achieve it. (And if by any chance, this is not yet possible in ConTeXt, can anyone suggest a workaround for this, in ConTeXt of course. It is the default behavior in both LaTeX and eplain. Compare (eplain): \numberedlist\listcompact \li The first item. \li The second item. \li The third item. \li The fourth item. \li The fifth item. \li The sixth item. \li The seventh item. \li The eighth item. \li The ninth item. \li The tenth item. \endnumberedlist and (LaTeX) \begin{enumerate} \item The first item. \item The second item. \item The third item. \item The fourth item. \item The fifth item. \item The sixth item. \item The seventh item. \item The eighth item. \item The ninth item. \item The tenth item. \end{enumerate} with (ConTeXt) \startitemize[n,packed][stopper={.}] \item The first item. \item The second item. \item The third item. \item The fourth item. \item The fifth item. \item The sixth item. \item The seventh item. \item The eighth item. \item The ninth item. \item The tenth item. \stopitemize Thanks, -Hamid
Hamid Kamrani wrote:
At least in the U.S., it is the rule and a strict requirement to typeset vertical lists in such a way that the numerals align on the dot or parenthesis following the numeral.
It is quite possible that there is a simpler solution that I simply failed to find, but this works: \unprotect \startsetups [numberitemleft] \hbox to \dimexpr\getitemparameter\itemlevel \c!width - \getitemparameter\itemlevel \c!distance\relax \bgroup \hfill \stopsetups \startsetups [numberitemright] \egroup \stopsetups \protect \starttext \startitemize[n,packed][left={\setups[numberitemleft]}, right={\setups[numberitemright]}, stopper={.}] \item The first item. \item The second item. \item The third item. \item The fourth item. \item The fifth item. \item The sixth item. \item The seventh item. \item The eighth item. \item The ninth item. \item The tenth item. \stopitemize \stoptext You probably want to increase the 'width' parameter, but that should be straightforward. Best wishes, Taco
On Sat, 23 Jun 2007 23:13:22 -0400
"Hamid Kamrani"
At least in the U.S., it is the rule and a strict requirement to typeset vertical lists in such a way that the numerals align on the dot or parenthesis following the numeral.
(even the daily violation of the rule by some of the most widely used word processors such as MS Word has not changed this old-aged convention.)
I feel it must be possible in ConTeXt to do this because it is such a basic requirement and ConTeXt is used professionally. However, it's not the default behavior and I don't know which options will achieve it.
(And if by any chance, this is not yet possible in ConTeXt, can anyone suggest a workaround for this, in ConTeXt of course.
It is the default behavior in both LaTeX and eplain.
Hi Hamid, I corrected my last patch and integrated a itemalign key. You can test it with the following example. \input core-itm-patch \starttext \startframedtext[width=\textwidth] \startitemize[n][style=bold] \item As a college student, how do you rate yourself? \startitemize[5,columns,two] \item Excellent student \item Good student \item Mediocre student \item Poor student \stopitemize \stopitemize \stopframedtext \startitemize[n][style=bold] \item As a college student, how do you rate yourself? \startitemize[5, columns, two] \item Excellent student \item Good student \item Mediocre student \item Poor student \stopitemize \stopitemize \startitemize[n,packed,broad][itemalign=left] \dorecurse{10}{\item Item \recurselevel.} \stopitemize \startitemize[n,packed,broad] \dorecurse{10}{\item Item \recurselevel.} \stopitemize \stoptext Wolfgang
Taco and Wolfang,
Thanks both for your responses.
But:
1. The setup offered by Taco does not line up the numerals on the
dots. Maybe my problem was misunderstood.
2. With Wolfgang's patch, I think I must be missing some code because
I get the Undefined control sequence error.
systems : begin file itemize-test02 at line 3
! Undefined control sequence.
\redostartitemgroup ...ands \checkcurrentnofitems
\let \listitem \empty \doi...
\dostartitemgroup ... \dodostartitemgroup [#2][#3]
\else \doifassignmentelse ...
l.6 \startitemize[n][style=bold]
?
! Undefined control sequence.
\dolistitem ...stelements \optimizelistitemsbreak
\noindent \setbox 8\hbox {...
Best regards,
-Hamid
On 6/24/07, Wolfgang Schuster
On Sat, 23 Jun 2007 23:13:22 -0400 "Hamid Kamrani"
wrote: At least in the U.S., it is the rule and a strict requirement to typeset vertical lists in such a way that the numerals align on the dot or parenthesis following the numeral.
(even the daily violation of the rule by some of the most widely used word processors such as MS Word has not changed this old-aged convention.)
I feel it must be possible in ConTeXt to do this because it is such a basic requirement and ConTeXt is used professionally. However, it's not the default behavior and I don't know which options will achieve it.
(And if by any chance, this is not yet possible in ConTeXt, can anyone suggest a workaround for this, in ConTeXt of course.
It is the default behavior in both LaTeX and eplain.
Hi Hamid,
I corrected my last patch and integrated a itemalign key. You can test it with the following example.
\input core-itm-patch
\starttext
\startframedtext[width=\textwidth] \startitemize[n][style=bold] \item As a college student, how do you rate yourself? \startitemize[5,columns,two] \item Excellent student \item Good student \item Mediocre student \item Poor student \stopitemize \stopitemize \stopframedtext
\startitemize[n][style=bold] \item As a college student, how do you rate yourself? \startitemize[5, columns, two] \item Excellent student \item Good student \item Mediocre student \item Poor student \stopitemize \stopitemize
\startitemize[n,packed,broad][itemalign=left] \dorecurse{10}{\item Item \recurselevel.} \stopitemize
\startitemize[n,packed,broad] \dorecurse{10}{\item Item \recurselevel.} \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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Hamid Kamrani wrote:
Taco and Wolfang,
Thanks both for your responses. But: 1. The setup offered by Taco does not line up the numerals on the dots. Maybe my problem was misunderstood.
Did you miss this? Taco wrote:
You probably want to increase the 'width' parameter, but that should be straightforward.
It should work with width=2pc (two digits and a dot do not fit in the default allocated space, so the 10. sticks out to the right) Taco
On 6/24/07, Taco Hoekwater
Hamid Kamrani wrote:
Taco and Wolfang,
Thanks both for your responses. But: 1. The setup offered by Taco does not line up the numerals on the dots. Maybe my problem was misunderstood.
Did you miss this?
I certainly did. I'm sorry, the misunderstanding was on my part. I do like your solution. But how to make it the default? This should be the default behavior and in fact the required width should be calculated by ConTeXt. Otherwise ConTeXt is behaving like MS Word. Please note that, second to paragraphs, lists are the most widely used text blocks. It is imperative that they format correctly. If you're using Arabic numerals then you have the chance to list your first 9 items correctly.But, alas, if you have to use roman numeral. The problem shows up in the second item. (you would not itemize if you had only one item!) Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt. My apologies for discounting your solution too quickly. Best regards, -Hamid
Taco wrote:
You probably want to increase the 'width' parameter, but that should be straightforward.
It should work with width=2pc (two digits and a dot do not fit in the default allocated space, so the 10. sticks out to the right)
Taco ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 6/24/07, Hamid Kamrani
On 6/24/07, Taco Hoekwater
wrote: Hamid Kamrani wrote:
Taco and Wolfang,
Thanks both for your responses. But: 1. The setup offered by Taco does not line up the numerals on the dots. Maybe my problem was misunderstood.
Did you miss this? On a follow-up to previous note: I think this is how I missed the width issue. In my testing, I had both distance and width parameters. I may be doing something wrong but these two conflict. \unprotect \startsetups [numberitemleft] \hbox to \dimexpr\getitemparameter\itemlevel \c!width - \getitemparameter\itemlevel \c!distance\relax \bgroup\hfill \stopsetups
\startsetups [numberitemright] \egroup \stopsetups \protect \starttext \startitemize[n][style=bold] \item As a college student, how do you rate yourself? \startitemize[R,packed][left={\setups[numberitemleft]}, right={\setups[numberitemright]}, stopper={.}, width=3em, style=\sc, distance=5em] \item The first item. \item The second item. \item The third item. \item The fourth item. \item The fifth item. \item The sixth item. \item The seventh item. \item The eighth item. \item The ninth item. \item The tenth item. \stopitemize \stopitemize \stoptext Best, -Hamid
I certainly did. I'm sorry, the misunderstanding was on my part.
I do like your solution. But how to make it the default? This should be the default behavior and in fact the required width should be calculated by ConTeXt. Otherwise ConTeXt is behaving like MS Word.
Please note that, second to paragraphs, lists are the most widely used text blocks. It is imperative that they format correctly.
If you're using Arabic numerals then you have the chance to list your first 9 items correctly.But, alas, if you have to use roman numeral. The problem shows up in the second item. (you would not itemize if you had only one item!)
Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt.
My apologies for discounting your solution too quickly.
Best regards, -Hamid
Taco wrote:
You probably want to increase the 'width' parameter, but that should be straightforward.
It should work with width=2pc (two digits and a dot do not fit in the default allocated space, so the 10. sticks out to the right)
Taco ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
2007/6/25, Hamid Kamrani
On 6/24/07, Hamid Kamrani
wrote: On 6/24/07, Taco Hoekwater
wrote: Hamid Kamrani wrote:
Taco and Wolfang,
Thanks both for your responses. But: 1. The setup offered by Taco does not line up the numerals on the dots. Maybe my problem was misunderstood.
Did you miss this? On a follow-up to previous note: I think this is how I missed the width issue. In my testing, I had both distance and width parameters. I may be doing something wrong but these two conflict.
The width value need to be larger than the distance value because the resulting width for the number in your example is width (below 3em) - distance (below 5em) = -2em (5em - 3em). The same problem did also appear in my solution. Wolfgang
\unprotect \startsetups [numberitemleft] \hbox to \dimexpr\getitemparameter\itemlevel \c!width - \getitemparameter\itemlevel \c!distance\relax \bgroup\hfill \stopsetups
\startsetups [numberitemright] \egroup \stopsetups \protect
\starttext \startitemize[n][style=bold] \item As a college student, how do you rate yourself? \startitemize[R,packed][left={\setups[numberitemleft]}, right={\setups[numberitemright]}, stopper={.}, width=3em, style=\sc, distance=5em] \item The first item. \item The second item. \item The third item. \item The fourth item. \item The fifth item. \item The sixth item. \item The seventh item. \item The eighth item. \item The ninth item. \item The tenth item. \stopitemize \stopitemize \stoptext
Best, -Hamid
I certainly did. I'm sorry, the misunderstanding was on my part.
I do like your solution. But how to make it the default? This should be the default behavior and in fact the required width should be calculated by ConTeXt. Otherwise ConTeXt is behaving like MS Word.
Please note that, second to paragraphs, lists are the most widely used text blocks. It is imperative that they format correctly.
If you're using Arabic numerals then you have the chance to list your first 9 items correctly.But, alas, if you have to use roman numeral. The problem shows up in the second item. (you would not itemize if you had only one item!)
Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt.
My apologies for discounting your solution too quickly.
Best regards, -Hamid
Taco wrote:
You probably want to increase the 'width' parameter, but that should be straightforward.
It should work with width=2pc (two digits and a dot do not fit in the default allocated space, so the 10. sticks out to the right)
Taco
Hamid Kamrani wrote:
Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt.
See the attached file how to make a special version of itemize that has default behaviour like you want. I could have used \setupitemgroup[itemize] directly instead, but I assume you don't want your bullet lists right aligned as well. Since ConTeXt cannot know beforehand how wide the number space should be (neither do eplain and latex), the 'width' key has to be a fixed quantity, but you can still change all of the default parameters where you call \startenumerate, just like you did before with \startitemize, so that should be only a minor nuisance. I do agree it would be better if the core was extended so that the two setups were not necessary. Best wishes, Taco
Thank you both, Taco and Wolfgang.
I will make use of your suggestions and solutions.
BTW. It seems that now I have to put some of the styling of the
numerals, such as using small caps in the setups of right and left.
For example:
\unprotect
\startsetups [numberitemleft]
\hbox to \dimexpr\getitemparameter\itemlevel \c!width -
\getitemparameter\itemlevel \c!distance\relax
\bgroup\hfill
\cap\bgroup(
\stopsetups
\startsetups [numberitemright]
)\egroup
\egroup
\stopsetups
\protect
\starttext
\startitemize[n][style=bold]
\item As a college student, how do you rate yourself?
\startitemize[R,packed][left={\setups[numberitemleft]},
right={\setups[numberitemright]},
stopper={.},
width=4.5em,
style=\sl,
distance=2em]
\item The first item.
\item The second item.
\item The third item.
\item The fourth item.
\item The fifth item.
\item The sixth item.
\item The seventh item.
\item The eighth item.
\item The ninth item.
\item The tenth item.
\stopitemize
\stopitemize
\stoptext
Thanks again,
-Hamid
On 6/25/07, Taco Hoekwater
Hamid Kamrani wrote:
Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt.
See the attached file how to make a special version of itemize that has default behaviour like you want. I could have used \setupitemgroup[itemize] directly instead, but I assume you don't want your bullet lists right aligned as well.
Since ConTeXt cannot know beforehand how wide the number space should be (neither do eplain and latex), the 'width' key has to be a fixed quantity, but you can still change all of the default parameters where you call \startenumerate, just like you did before with \startitemize, so that should be only a minor nuisance.
I do agree it would be better if the core was extended so that the two setups were not necessary.
Best wishes, Taco
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Hamid Kamrani wrote:
Thank you both, Taco and Wolfgang.
I will make use of your suggestions and solutions.
BTW. It seems that now I have to put some of the styling of the numerals, such as using small caps in the setups of right and left.
Yes, that is the downside of lack of core support. Best wishes, Taco
Taco Hoekwater wrote:
Hamid Kamrani wrote:
Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt.
See the attached file how to make a special version of itemize that has default behaviour like you want. I could have used \setupitemgroup[itemize] directly instead, but I assume you don't want your bullet lists right aligned as well.
Since ConTeXt cannot know beforehand how wide the number space should be (neither do eplain and latex), the 'width' key has to be a fixed quantity, but you can still change all of the default parameters where you call \startenumerate, just like you did before with \startitemize, so that should be only a minor nuisance.
I do agree it would be better if the core was extended so that the two setups were not necessary.
I'll upload a beta that supports: \startitemize[n,fit,broad][itemalign=flushright] \dorecurse{100}{\item The first item.} \stopitemize \setupitemgroup[itemize][each][fit] \setupitemgroup[itemize][each][distance=.5em,factor=1,itemalign=flushright] \startitemize[n] \dorecurse{100}{\item The first item.} \stopitemize others should wikify this Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
And so you did. This is beautiful. Thank you Hans.
On 6/25/07, Hans Hagen
Taco Hoekwater wrote:
Hamid Kamrani wrote:
Taco, I very much appreciate your solution. It allows me to continue for now but I humbly ask, in fact, beg to have a solution built in the core of ConTeXt.
See the attached file how to make a special version of itemize that has default behaviour like you want. I could have used \setupitemgroup[itemize] directly instead, but I assume you don't want your bullet lists right aligned as well.
Since ConTeXt cannot know beforehand how wide the number space should be (neither do eplain and latex), the 'width' key has to be a fixed quantity, but you can still change all of the default parameters where you call \startenumerate, just like you did before with \startitemize, so that should be only a minor nuisance.
I do agree it would be better if the core was extended so that the two setups were not necessary.
I'll upload a beta that supports:
\startitemize[n,fit,broad][itemalign=flushright] \dorecurse{100}{\item The first item.} \stopitemize
\setupitemgroup[itemize][each][fit] \setupitemgroup[itemize][each][distance=.5em,factor=1,itemalign=flushright]
\startitemize[n] \dorecurse{100}{\item The first item.} \stopitemize
others should wikify this
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
2007/6/24, Hamid Kamrani
Taco and Wolfang,
Thanks both for your responses. But: 1. The setup offered by Taco does not line up the numerals on the dots. Maybe my problem was misunderstood.
2. With Wolfgang's patch, I think I must be missing some code because I get the Undefined control sequence error.
systems : begin file itemize-test02 at line 3 ! Undefined control sequence. \redostartitemgroup ...ands \checkcurrentnofitems \let \listitem \empty \doi...
\dostartitemgroup ... \dodostartitemgroup [#2][#3] \else \doifassignmentelse ... l.6 \startitemize[n][style=bold]
? ! Undefined control sequence. \dolistitem ...stelements \optimizelistitemsbreak \noindent \setbox 8\hbox {...
Best regards, -Hamid
Hi Hamid, I tested my code on the garden and it worked, update your ConTeXt and it should also work for you. Wolfgang
participants (4)
-
Hamid Kamrani
-
Hans Hagen
-
Taco Hoekwater
-
Wolfgang Schuster