ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Thangalin <thangalin@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Customize register format
Date: Sun, 9 Mar 2014 16:56:44 -0700	[thread overview]
Message-ID: <CAANrE7p4Tb_PJdS1oDJJTZAxYvvPRqzzGYZ5zbE0CiahAf7Tmw@mail.gmail.com> (raw)

Hi,

I am trying to reproduce the following register layout:

http://i.imgur.com/qXSK2VM.png

Entries include a section name, page number, author, and author URL;
the entries are formatted fairly differently from a standard index. So
far I have:

\setupinteraction[state=start,]
\define\Punctuate{\color[black]{\normal.}}
\define[2]\href{\begingroup\goto{\color[blue]{#1}}[url(#2)]\endgroup}
\define[1]\TextCommand{\item\currentregisterpageuserdata{title}, }
\define[1]\PageCommand{#1\Punctuate{}
{\href{\currentregisterpageuserdata{author}}{\currentregisterpageuserdata{authorurl}}}\Punctuate\stopitemize}

% #1 - Author; #2 - Author URL; #3 - Section title
\define[3]\PhotographerIndexEntry{%
  \setregisterentry[PhotographerIndex][entries={#1}][
    title={#3},
    author={#1},
    authorurl={#2},
  ]{}
}

\defineregister[PhotographerIndex][
  n=1,
  indicator=no,
  textcommand=\TextCommand,
  pagecommand=\PageCommand,
  distance=\zeropoint,
  before={\startitemize[packed,nowhite]},
]

\setuphead[section][aftersection=\page,]

\starttext
  \startsection[title={Maguro}]
    Text
    \PhotographerIndexEntry{Kenji Fujimoto}{http://bit.ly/1fNWF0Y}{Maguro}
  \stopsection
  \startsection[title={Unagi}]
    Text
    \PhotographerIndexEntry{Kenji Fujimoto}{http://bit.ly/1fNWF0Y}{Unagi}
  \stopsection
  \placePhotographerIndex
\stoptext

This fails because values for "entries={#1}" must be unique.

How can I customize the registers to resemble the given layout?

(Aside, the section title is repeated twice -- is there a way to
remove the duplication? I tried \namedstructurevariable, but couldn't
figure out how to get the expanded value.)

Thank you.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


                 reply	other threads:[~2014-03-09 23:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAANrE7p4Tb_PJdS1oDJJTZAxYvvPRqzzGYZ5zbE0CiahAf7Tmw@mail.gmail.com \
    --to=thangalin@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).