ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Proper formatting of itemized bullets in ConTeXt
@ 2022-04-12  8:27 A A via ntg-context
  2022-04-12 14:43 ` śrīrāma via ntg-context
  2022-04-13  2:07 ` śrīrāma via ntg-context
  0 siblings, 2 replies; 4+ messages in thread
From: A A via ntg-context @ 2022-04-12  8:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: A A


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

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.

Thanks in advance.

Amine

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

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

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Proper formatting of itemized bullets in ConTeXt
  2022-04-12  8:27 Proper formatting of itemized bullets in ConTeXt A A via ntg-context
@ 2022-04-12 14:43 ` śrīrāma via ntg-context
  2022-04-13  2:07 ` śrīrāma via ntg-context
  1 sibling, 0 replies; 4+ messages in thread
From: śrīrāma via ntg-context @ 2022-04-12 14:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users, A A; +Cc: śrīrāma

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


___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Proper formatting of itemized bullets in ConTeXt
  2022-04-12  8:27 Proper formatting of itemized bullets in ConTeXt A A via ntg-context
  2022-04-12 14:43 ` śrīrāma via ntg-context
@ 2022-04-13  2:07 ` śrīrāma via ntg-context
  2022-04-13  2:09   ` śrīrāma via ntg-context
  1 sibling, 1 reply; 4+ messages in thread
From: śrīrāma via ntg-context @ 2022-04-13  2:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users, A A; +Cc: śrīrāma

On 4/12/22 1:57 PM A A via ntg-context wrote:
> 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.

I revisited this today after the (frankly) subpar solution I presented yesterday. With the below example, we 
  • neither lose the nice features of \setupitemgroup 
  • nor do we need grouping of the items. 
The only 'price to pay' is to use \citem (comma item) and \pitem (period item) as required. 

%% start example
  \def\citem{\item\AfterPar{\hspace[-normal],}\GetPar}
  \def\pitem{\item\AfterPar{\hspace[-normal].}\GetPar}

  \defineitemgroup
    [pitemize]
    [command=\Word,numberconversion=words]

  \starttext
  \startpitemize[n]
  \citem first item
  \citem second item
  \citem third item
  \pitem fourth item
  \stoppitemize
  \stoptext
%% stop example

Best,
  Sreeram


___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Proper formatting of itemized bullets in ConTeXt
  2022-04-13  2:07 ` śrīrāma via ntg-context
@ 2022-04-13  2:09   ` śrīrāma via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: śrīrāma via ntg-context @ 2022-04-13  2:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users, A A; +Cc: śrīrāma

On 4/13/22 7:37 AM śrīrāma wrote:
> I revisited this today after the (frankly) subpar solution I presented yesterday. With the below example, we 
>   • neither lose the nice features of \setupitemgroup 
>   • nor do we need grouping of the items. 
> The only 'price to pay' is to use \citem (comma item) and \pitem (period item) as required. 

cleaned up the example – 

%% start example
  \def\citem{\item\AfterPar{\hspace[-normal],}\GetPar}
  \def\pitem{\item\AfterPar{\hspace[-normal].}\GetPar}

  \defineitemgroup
    [pitemize]
    [command=\Word]

  \starttext
  \startpitemize[n]
  \citem first item
  \citem second item
  \citem third item
  \pitem fourth item
  \stoppitemize
  \stoptext
%% stop example


  Sreeram


___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2022-04-13  2:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12  8:27 Proper formatting of itemized bullets in ConTeXt A A via ntg-context
2022-04-12 14:43 ` śrīrāma via ntg-context
2022-04-13  2:07 ` śrīrāma via ntg-context
2022-04-13  2:09   ` śrīrāma via ntg-context

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