ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Anyone managed a tabulated table of contents
@ 2020-05-25 12:40 Bruce Horrocks
  2020-05-25 15:47 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce Horrocks @ 2020-05-25 12:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I can't be the first to have wanted to try something like this. Is it possible to use tabulate (or any of the table types) to customise the layout of the table of contents?

I'd like 4 columns - title, subject, author and page - where subject and author will (eventually) be additional parameters supplied to \startchapter. Bonus points if it works in interactive mode as well.

Minimum non-working example below. This generates the 4 column values per chapter heading but they run together into a single paragraph as if the table formatting was not present.

%%% Begin %%%
\setuppapersize [A4] [A4]
\setupinteraction [state=start]
\setuplist [chapter]
  [ alternative=command, %interactive
    command=\myTOCrow,
    before=\myTOCbefore,
    after=\myTOCafter
  ]

% #1 == Section number; #2 == text; #3 == page number
\define[3]\myTOCrow{\NC #2 \NC dummy \NC John Doe \NC #3 \NC\NR }

\define\myTOCbefore{
  \starttabulate[|pw(8.75cm)|l|lw(4.2cm)|r|]
  \NC \underbars{Title}
  \NC \underbars{Subject}
  \NC \underbars{Author}
  \NC \underbars{Page}
  \NC\NR
}

\define\myTOCafter{%
  \stoptabulate }

\starttext
\title{Tabulated Table of Contents}
\placelist[chapter]

\startchapter[title=Tufte 1]
\input tufte
\stopchapter

\startchapter[title=Tufte 2]
\input tufte
\stopchapter
\stoptext
%%% End %%%


--
Bruce Horrocks
Hampshire, UK

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-25 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 12:40 Anyone managed a tabulated table of contents Bruce Horrocks
2020-05-25 15:47 ` Hans Hagen

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).