ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Henning Hraban Ramm <texml@fiee.net>
Subject: Re: How to manually adjust the sort order of items appearing in a custom index?
Date: Mon, 17 Jan 2022 19:42:23 +0100	[thread overview]
Message-ID: <7ebc85d4-7663-03e4-eff1-66ced52789b8@fiee.net> (raw)
In-Reply-To: <1764709421.567903.1642434791573@mail.yahoo.com>

Am 17.01.22 um 16:53 schrieb Joel via ntg-context:
> I created a custom index that displays a list of "Important Dates" 
> appearing in my book. It lists the year, a short description of what 
> happened, and should show the page number.
> 
> I'm running into two errors though:
> 
> First, if the date is the same year, it is sorting alphabetically, 
> example,,,,
> 
> \dateis{1900s+1912}{Yet another event happened}
> \dateis{1900s+1912}{Another event happened}
> 
> ...will print the wrong one first in the index..
> 
> 1912 - Another even happened
> 1912 - Yet another event happened.
> 
> Is there a way to manually tell it to display one first? I don't want to 
> add visible month and day details, that would be even more confusing to 
> the index as I have to print it in American order.
> 
> Second, when it compiles it is not printing the page number, instead 
> prints "[Entry not flushed]".
> 
> -- Joel
> 
> Here is my minimum working example:
> 
> 
> \defineregister[listdates][compress=yes]
> \setupregister[listdates][style=sansbold, textstyle=slanted, n=1, 
> pagenumber=yes]
> 
> \define[2]\dateis{%
>      \listdates{#1~\emdash ~#2}%
> }%
> 
> \starttext
> 
> \dateis{1900s+1911}{Some event happened}
> \dateis{1900s+1912}{Yet another event happened}
> \dateis{1900s+1912}{Another event happened}
> 
> \startchapter[title=Important Dates]
>      \placelistdates
> \stopchapter
> 
> \stoptext

Change your definition of \dateis (or use an additional macro) to use 
the sort key of \index:

\index[1900s+191201]{January}
\index[1900s+191202]{February}

Hraban
___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2022-01-17 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1764709421.567903.1642434791573.ref@mail.yahoo.com>
2022-01-17 15:53 ` Joel via ntg-context
2022-01-17 18:42   ` Henning Hraban Ramm via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ebc85d4-7663-03e4-eff1-66ced52789b8@fiee.net \
    --to=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).