[NTG-context] Proper formatting of itemized bullets in ConTeXt

śrīrāma citturs at gmail.com
Tue Apr 12 16:43:47 CEST 2022


On 4/12/22 1:57 PM A A via ntg-context wrote:
> Dear All,
> 
> Is there a straightforward way of setting up the itemize command such that
> every first letter is capitalized, regardless of whether I do so in the
> source file?
> 
> Also, is there a way to insert a comma at the end of each item except for
> the last, and then a full stop at the end of the last item like follows?
> 
>    - First item,
>    - Second item,
>    - Third item,
>    - Last item.

If this is just for unnumbered lists, then the following should suffice:

%%% start example
  \defineitemgroup
    [pitemize]
    [command=\Word]
  \define\citem{%
    \incrementnumber[itemgroup:pitemize]%
    \sym{\symbol[\currentitemgroupsymbol]}%
    \groupedcommand{}{,}%
  }
  \define\pitem{%
    \incrementnumber[itemgroup:pitemize]%
    \sym{\symbol[\currentitemgroupsymbol]}%
    \groupedcommand{}{.}%
  }

  \starttext
  \startpitemize
  \citem {first item}
  \citem {second item}
  \citem {third item}
  \pitem {fourth item}
  \stoppitemize
  \stoptext
%%% stop example

For numbered lists, more work is required I think. For example, you might need something like
  \unprotect
    \define\citem{%
      \incrementnumber[itemgroup:pitemize]%
      \sym{%
        \itemgroupparameter\c!left%
          \getnumber[itemgroup:pitemize]%
        \itemgroupparameter\c!stopper%
        \itemgroupparameter\c!right
      }%
      \groupedcommand{}{,}%
    }
    \define\pitem{%
      \incrementnumber[itemgroup:pitemize]%
      \sym{%
        \itemgroupparameter\c!left%
          \getnumber[itemgroup:pitemize]%
        \itemgroupparameter\c!stopper%
        \itemgroupparameter\c!right
      }%
      \groupedcommand{}{.}%
    }
  \protect

but this still does not provide for the various possible conversion sets and other features of \setupitemgroup. See strc-itm.mklx for hints.

  Sreeram




More information about the ntg-context mailing list