Generate Authorlist from Head Content

From Wiki
Jump to navigation Jump to search

An example on how to generate a sorted list of all authors contributed to a conference proceeding.

\setuphead
  [title]
  [page=no,command=,]

\setuphead
  [chapter]
  [command=\MyChapCMD]

\setuplist
  [chapter]
  [criterium=all,alternative=command,command=\MyChapListCMD]

\definesorting[author][authors]
\setupsorting [author][criterium=all,expansion=yes]

\define[2]\MyChapCMD
 {#1\enspace #2
   {\doifsomething
      {\structureuservariable{author}}
      \expanded{\author
        [\structureuservariable{name}] % -> sorted by "name"-variable
        {\bTABLE[width=broad]
           \bTR
             \bTD \structureuservariable{author} \eTD
             \bTD \structureuservariable{city}   \eTD
             \bTD \structureuservariable{date}   \eTD
             \bTD \structureuservariable{email}  \eTD
             \bTD \structureuservariable{note}   \eTD
           \eTR
         \eTABLE\nointerlineskip}%
         \tfxx (\structureuservariable{author}, \structureuservariable{city})}}}

\define[3]\MyChapListCMD
  {#1 #2 (\structurelistuservariable{author})\hfill  #3\blank}


\starttext  \showframe[text]

\starttitle[title=Contents]
  \placelist[chapter]
\stoptitle

\starttitle[title=List of Authors in Alphabetical Order]
  \placelistofauthors
\stoptitle

\startchapter
  [title=Text by Ward]
  [name=ward,
   author=Peter D. Ward,
   city=Washington,
   email=ward@sample.com]

  \input ward
\stopchapter

\startchapter
  [title=Text by Zapf]
  [name=zapf,
   author=Hermann Zapf,
   city=Nürnberg,
   date=8. November 1918,
   email=zapf@sample.de]

  \input zapf
\stopchapter

\startchapter
  [title=Text by Bryson]
  [name=bryson,
   author=Bill Bryson,
   city=Norfolk,
   date={December 8, 1951},
   note=best-selling American author]

  \input Bryson
\stopchapter

\startchapter
  [title=Text by Tufte]
  [name=tufte,
   author=Edward R. Tufte,
   city=Kansas City,
   date=1942,
   note=has criticized the way Microsoft PowerPoint is typically used]

  \input tufte
\stopchapter

\stoptext