ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Custom TOC with makeup and setups
@ 2023-05-10 14:03 Jethro Djan via ntg-context
  0 siblings, 0 replies; only message in thread
From: Jethro Djan via ntg-context @ 2023-05-10 14:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jethro Djan


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

Hello,

I am trying to create a presentation where at the start of each section in
my presentation, a custom TOC page is shown. When I am at a particular
section, the TOC will grey out all other sections (not implemented in my
MWE). I have tried different ways but I find using makeups for the TOC page
works ok (following
https://wiki.contextgarden.net/Command/setuplistalternative and Aditya's
presentation slides on their blog). My challenge is that when a makeup page
is inserted, it leaves a page with the section name blank before it. How do
I fix it? Any other way to achieve this is also welcome. My MWE:

\setuppapersize[S6]
\startuseMPgraphic{itemize:toc}
  save p; path p;
  p := ( (0,-0.5)--(0,0.5)--(0.866,0)--cycle ) scaled 1.5ExHeight;
  fill p withcolor \MPcolor{Black};
\stopuseMPgraphic

\definesymbol[itemize:toc][\useMPgraphic{itemize:toc}]

\definelistalternative
  [toclist]
  [renderingsetup=list:toclist]

\setupheadtext[section=Table of Contents]

\startsetups toclist
  \framed[align=normal, frame=off]{\placelist [section] [criterium=all,
alternative=toclist]}
\stopsetups

\definehspace[tspace][4cm]
\setupframed[
  height=fit,
  width=fit,
  location=middle,
  frame=off,
  align=normal,
  offset=none,
]
\startsetups list:toclist
  {\hbox to \hsize \bgroup
  \hspace[tspace]
  \framed[width=10mm,align=flushleft]{\symbol[itemize:toc]}%
  \framed[empty=yes]{\currentlistentrynumber\currentlistentrypagenumber}%
  \doifelse\currentlistentrylocation{\namedstructureheadlocation{section}}{%
    \framed[align=flushright,]{{\bfb\currentlistentrytitle}}%
  }{\framed[align=flushright,]{\currentlistentrytitle}}
  \egroup}
\stopsetups



 \definemakeup
  [toc]
  [
    doublesided=no,
    page=yes,
    bottom=,
    top=,
    pagestate=start,
    headerstate=empty,
    footerstate=empty,
    setups={toclist},
    before=\setups{toc:setups},
  ]
\startsetups toc:setups
  \setupbackgrounds[page][background=color, backgroundcolor=blue]
\stopsetups

 \definemakeup
  [standard]
  [
    doublesided=no,
    page=right,
    pagestate=start,
    headerstate=empty,
    footerstate=empty,
    before=\setups{standard:setups},
  ]

 \startsetups standard:setups
    \setupbackgrounds[page][background=color, backgroundcolor=lightgray]
 \stopsetups

 \define\TOC{
  \starttocmakeup
  \stoptocmakeup
 }

\starttext

\startstandardmakeup
  \title{Your Title Here}
\stopstandardmakeup

\startsection[title={Motivation}]
\TOC
\startitemize

\item something cool
\item something else cool

\stopitemize
\stopsection

\startsection[title={Main strands of theory}]
\TOC
\startitemize

\item another cool thing
\item cool too

\stopitemize
\stopsection


\stoptext

Thanks in advance.

Jethro

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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-10 14:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 14:03 [NTG-context] Custom TOC with makeup and setups Jethro Djan via ntg-context

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