Command/keyword:method

From ConTeXt wiki

Description

The way in which e. g. lists or registers are sorted when \placeregister or \placelistofsynonyms is influenced by an appropriate keyword passed to ConTeXt's sort module (sort-ini.lua).

The details lay in a rather obscure set of methods (see source), for which the following short-cuts are defined:

  • default = "zc,pc,zm,pm,uc" (uppercase like lowercase, diacritics separate)
  • before = "mm,mc,uc" (upper before lower, diacritics ignored)
  • after = "pm,mc,uc (lower before upper, diacritics ignored)
  • first = "pc,mm,uc" (lower before upper, diacritics separate)
  • last = "mc,mm,uc" (upper before lower, diacritics separate)
  • If you don’t set the sorting method, the preset "first" ist used (and not "default").
  • There’s no preset for the combination "uppercase like lowercase, diacritics ignored".
  • The sorting is also influenced by the current language or the language setting in \setupregister.

Example

Here [1] is a modified example posted on the mailing list by Hans to illustrate the impact of different sorting methods:

\starttext
\def\Test#1%
 
{\vbox{{\bf#1}\blank\placeregister[index][language=cz,n=1,method={#1}]}\blank}

wanted result: oá öb Oč Öď Oo Öo oo öo Öq öř Oš oů \blank

\startcolumns[n=2]
     \Test{before}   \Test{first} 
     \Test{default}  \Test{after}  \Test{last}
\stopcolumns

\page

wanted result: oá öb Oč Öď Oo Öo oo öo Öq öř Oš oů \blank

\startcolumns[n=3]
     \Test{mc,mm,uc} \Test{mc,zm,uc} \Test{mc,pm,uc}
     \Test{zc,mm,uc} \Test{zc,zm,uc} \Test{zc,pm,uc}
     \Test{pc,mm,uc} \Test{pc,zm,uc} \Test{pc,pm,uc}
\stopcolumns

\page

wanted result: oá öb Oč Öď Oo Öo oo öo Öq öř Oš oů \blank

\startcolumns[n=3]
     \Test{mm,mc,uc} \Test{zm,mc,uc} \Test{pm,mc,uc}
     \Test{mm,zc,uc} \Test{zm,zc,uc} \Test{pm,zc,uc}
     \Test{mm,pc,uc} \Test{zm,pc,uc} \Test{pm,pc,uc}
\stopcolumns

\page

\dorecurse {2} {
    \page \recurselevel:
         \index{}  \index{öb}  \index{}  \index{Öď}
         \index{oo}  \index{öo}  \index{Oo}  \index{Öo}
         \index{Öq}  \index{öř}  \index{}  \index{}
    done
}

\stoptext

The key set "zm,mc,uc", "zm,zc,uc" and "zm,pc,uc" give the wanted result in this example.


See also