Difference between revisions of "Command/keyword:method"

From Wiki
Jump to navigation Jump to search
m (typo)
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
The details lay in a rather obscure set of methods (see source), for which the following short-cuts are defined:
 
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|default}} = {{key|"zc,pc,zm,pm,uc"}} (uppercase like lowercase, diacritics separate)
* {{key|before}}  = {{key|"mm,mc,uc"}}
+
* {{key|before}}  = {{key|"mm,mc,uc"}} (upper before lower, diacritics ignored)
* {{key|after}}    = {{key|"pm,mc,}}
+
* {{key|after}}    = {{key|"pm,mc,uc"}} (lower before upper, diacritics ignored)
* {{key|first}}  = {{key|"pc,mm,uc"}}
+
* {{key|first}}  = {{key|"pc,mm,uc"}} (lower before upper, diacritics separate)
* {{key|last}}    = {{key|"mc,mm,uc"}}
+
* {{key|last}}    = {{key|"mc,mm,uc"}} (upper before lower, diacritics separate)
 
+
* If you don’t set the sorting method, the preset "first" ist used (and not "default").
Note that in some instances (if no key is specified) uppercase letters are sorted before lowercase ones.
+
* 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 {{cmd|setupregister}}.
  
 
== Example ==
 
== Example ==
Line 72: Line 73:
 
* {{cmd|setupregister}}
 
* {{cmd|setupregister}}
  
[[Category:Keyword]]
+
[[Category:Tools]]
 +
[[Category:Basics]]

Latest revision as of 16:24, 16 December 2020

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