ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <texml@fiee.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: ToC as itemize
Date: Sun, 10 Jun 2018 14:03:08 +0200	[thread overview]
Message-ID: <BA89D715-556F-47A0-85F5-6E1A7449582C@fiee.net> (raw)
In-Reply-To: <ea09459c-d74c-a593-ebd8-20e416cb3f08@xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

Am 2018-06-10 um 13:35 schrieb Hans Hagen <j.hagen@xs4all.nl>:

> On 6/10/2018 11:55 AM, Henning Hraban Ramm wrote:
>> Might there be a solution to this problem?
>> I.e. how to insert ToC entries in an itemize?
> 
> Well, don't expect a solution without a MWE ... anyway

The MWE was in my first mail (May 3rd).
Thank you anyway!

> 
> \starttext
> 
> \define[3]\ChapterTocEntry{%
> \startitem
>   \structurelistuservariable{author}: #1/#2/#3
> \stopitem
> }
> 
> \definelist[chapter][%
>   alternative=command,
>   interaction=all,
>   criterium=all,
>   before=,
>   after=,
>   command=\ChapterTocEntry]

So I was missing alternative=command.

If you consider my attached MWE one problem remains:
The usual space between items is missing between the last manual item and the ToC list:

...
\startitem Test entry \stopitem
%\blank[1em]

\placelist[chapter]
...

I can fix it with the blank, but I’d like to understand.


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

[-- Attachment #2: toctest.tex --]
[-- Type: application/octet-stream, Size: 1498 bytes --]

%

\def\leaderfill{\leaders\hbox to 1em{\hss. \hss}\hfill}

\defineitemgroup[ContentsList]
\setupitemgroup[ContentsList][each]
		[broad,packed,autointro,repeat][]
\setupitemgroup[ContentsList][1][n][margin=1pc]

\define[2]\ChapterTitle{%
  % simplified
  \reference[\namedstructurevariable{chapter}{reference}]{\strut}%
  \structurevariable{title} {\tfx by \structureuservariable{author}}
}

\define[3]\ChapterTocEntry{% parameters are not used
  \startitem%
    % simplified, IRL we use several user variables
    \structurelistuservariable{author}: #2
    %#1/#2/#3 = chapter no./title/pagina
		%\namedstructurelistvariable{chapter}{title}??
    \leaderfill\color[blue]{\currentlistentrypagenumber}
  \stopitem%
}

\setuphead[chapter][
    style=\rm,
		command=\ChapterTitle,
    ]

\definelist[chapter][%
		alternative=command,
    interaction=all,
    criterium=all,
		command=\ChapterTocEntry,
		before=,
		after=,
]

\starttext

\startContentsList
%\sym{}Preface\leaderfill\at{Preface} % Preface unnumbered

\startitem
Test entry\leaderfill 123
\stopitem

\startitem
Test entry\leaderfill 124
\stopitem
%\blank[1em]

\placelist[chapter]

\startitem
Test entry\leaderfill 125
\stopitem

\stopContentsList


\startchapter[title=First,reference=tufte1][author=Edward Tufte]
\input tufte
\stopchapter

\startchapter[title=Second,reference=knuth][author=Donald Knuth]
\input knuth
\stopchapter

\startchapter[title=Third,reference=tufte2][author=Edward Tufte]
\input tufte
\stopchapter

\stoptext

[-- Attachment #3: Type: text/plain, Size: 492 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:[~2018-06-10 12:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 14:13 Henning Hraban Ramm
2018-06-10  9:55 ` Henning Hraban Ramm
2018-06-10 11:35   ` Hans Hagen
2018-06-10 12:03     ` Henning Hraban Ramm [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=BA89D715-556F-47A0-85F5-6E1A7449582C@fiee.net \
    --to=texml@fiee.net \
    --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).