[NTG-context] How to use module simpleslides' SideToc

Sietse Brouwer sbbrouwer at gmail.com
Wed Jan 9 15:47:08 CET 2013

Hello PengCZ,

This is not exactly what you want, because it took me very long to
remember to look at SideToc.pdf. But it is close, and I have tried to
put in a lot of comments. Hopefully you can solve it from here?

Cheers, and good luck,

% * We use \Topic to set the current topic, and to
%   record it in the topic list

% * \setuptexttexts places the topic list in the left margin
%   on every page
%   http://wiki.contextgarden.net/Command/setuptexttexts
%   (needs improving)

% * \setupbackgrounds sets the backgrond color of the left
%   margin on every page: this highlights the TOC area
%   http://wiki.contextgarden.net/Command/setupbackgrounds

% * the entry typesetting command (called \FancyTopic) typesets
%   entries inside a \framed block as wide as the margin is.
%   This allows highlighting the background of the current topic,
%   and also allows linebreaks etc.
%   http://wiki.contextgarden.net/Command/framed

\setuplayout [leftmargin=5cm,
% Color for the margin (topic list area)
\definecolor[colMyTopics][r=1,g=0.7,b=0.7] % pink

% Color for the current topic (in the topic list)
% I like white, because it attaches the current topic to the
%   main area; but perhaps you prefer pale yellow?
% \definecolor[colCurrentTopic][r=1,g=1,b=0.7] % pale yellow
\definecolor[colCurrentTopic][r=1,g=1,b=1] % white

% When \placelist[MyTopics] is called, it calls this \FancyEntry
% function to typeset each individual entry.
% #1: entry (i.e. topic name) to typeset
% \MyMark: section (i.e. topic name) we are currently in (set by
%     \Topic).
\define[3]\FancyEntry {
    \ifnum\structurelistrealpagenumber=\realpageno\relax SAME \else
    \doifelse \rawstructurelistfirst \MyMark
               width=5cm, % same as leftmargin in \setuplayout
        --- current mark's entry \par
        \color[red]{--- arg (entry): #1}\par
        \color[red]{--- mark: \MyMark}
      {\framed[frame=off, align=normal]{%
        --- other entry \par
        \color[blue]{--- arg (entry): #1}\par
        \color[blue]{--- mark: \MyMark}

% Show the margin areas, headers, footers, etc.

% Color the margin area. \setupbackgrounds must be called after
% \showframe, or \showframe will 'overwrite' \setupbackgrounds.


% \Topic takes one optional argument: #1, the topic name.

  % let it be known that we are in section #1 (used by \FancyTopic)
  % let topic #1 appear in the TOC (well, the MyTopics list)


% On every page, place the TOC in the margin, plzkthx


First Topic


Second Topic


Third Topic


More information about the ntg-context mailing list