ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: andrei--- via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: andrei@borisov.dev
Subject: Custom Table of Contents
Date: Thu, 20 Jan 2022 17:45:38 +0300	[thread overview]
Message-ID: <36EDA4FC-F41E-43A6-8379-9AE4D53FDDA6@borisov.dev> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1763 bytes --]

Hi! I’m new to ConTeXt.

I need to make a custom table of contents that looks like this:

https://imgur.com/a/Ca3By6X

Each row in the table corresponds to an item that has following data to print in the table of contents: page, total number of pages which the item spans, name of the item and a custom text metadata field which is defined by the item. Each item will have its own regular table of content and own structure. So we can think of this TOC as kind of a mega table of content one level above.

It needs to be fully automatic.
The actual table is going to be an xtable (which I was blown away by after using LaTeX godawful tables for years, it’s soo good).

After digging into the documentation (again, wow, it’s soo detailed and approachable after LaTeX😂), I found out that \completecontent doesn't provide such extreme level of customization. Therefore I need reimplement at least some parts of the default content forming mechanism. After digging in the source a bit, I found something relevant: https://source.contextgarden.net/tex/context/base/mkxl/strc-lst.mklx <https://source.contextgarden.net/tex/context/base/mkxl/strc-lst.mklx>.


What I need is some guidance on what would be the best course of action, in particular, which API should I use and roughly how should I approach it🙏

Should I create my own counters for each item and somehow reference those manually in the TOC?

How would I save additional text metadata field and the item name to show it in the TOC?

The source code mentions a concept of list renderers. This sounds like the correct API to plug in, but it’s hard for me to grasp how exactly it works.



Any help will be appreciated! Thank you in advance!

Stay safe,
Andrei Borisov.

[-- Attachment #1.2: Type: text/html, Size: 15417 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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-20 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 14:45 andrei--- via ntg-context [this message]
2022-01-20 16:39 ` Hans Hagen via ntg-context

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=36EDA4FC-F41E-43A6-8379-9AE4D53FDDA6@borisov.dev \
    --to=ntg-context@ntg.nl \
    --cc=andrei@borisov.dev \
    /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).