Changes

Jump to navigation Jump to search
Created page; help of someone who can add on the details of sorting (interpretation of keys, e. g.) is appreciated.
== Description ==

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

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

* {{key|default}} = {{key|"zc,pc,zm,pm,uc"}}
* {{key|before}} = {{key|"mm,mc,uc"}}
* {{key|after}} = {{key|"pm,mc,}}
* {{key|first}} = {{key|"pc,mm,uc"}}
* {{key|last}} = {{key|"mc,mm,uc"}}

== Example ==

Here [http://www.ntg.nl/pipermail/ntg-context/2010/052950.html] is a modified example posted on the mailing list by Hans to illustrate the impact of different sorting methods:

<texcode>
\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{oá} \index{öb} \index{Oč} \index{Öď}
\index{oo} \index{öo} \index{Oo} \index{Öo}
\index{Öq} \index{öř} \index{Oš} \index{oů}
done
}

\stoptext
</texcode>

Note that in some instances (if no key is specified) uppercase letters are sorted before lowercase ones.

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


== See also ==

* {{cmd|placelistofsynonyms}}
* {{cmd|placeregister}}
* {{cmd|setupregister}}

[[Category:Keyword]]
57

edits

Navigation menu