ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Re: Table of contents, alternative d
Date: Tue, 30 Nov 2004 10:56:00 +0100	[thread overview]
Message-ID: <41AC43B0.5010508@wxs.nl> (raw)
In-Reply-To: <BAY23-F1800E290A6A640D99662EBFBBE0@phx.gbl>

Dirar BOUGATEF wrote:
> Hi Patrick,
> 
> This is how my toc appears:
> 
> Part 1 first part 1–1
> (1) Chapter one 1–2 (2) Chapter two 1–3 (3) Chapter three 1–4
> (4) Chapter four 1–5 (5) Chapter five 1–6
> Part 2 second part 2–1
> (1) Chapter one 2–2 (2) Chapter two 2–3 (3) Chapter three 2–4
> (4) Chapter four 2–5 (5) Chapter five 2–6
> Part 3 Third part 3–1
> (1) Chapter one 3–2 (2) Chapter two 3–3 (3) Chapter three 3–4
> (4) Chapter four 3–5 (5) Chapter five 3–6
> 
> I want to control the distance for instance in the second and third line 
> to the right margin (This means chapters indeed => Line5,6,8,9 too). 
> This could result in the fact that my chapters will appear on 3 lines 
> instead of 2 here.
> 
> To my knowledge there is no parameter such as "distance" to change this. 
> Here "distance" changes only the distance between chapter elements for 
> instance: the element (1) Chapter one 1–2 and the element Chapter two 
> 1–3 (3). This how alternative d works (with elements).
> 
> This is how the result i want could be:
> 
> Part 1 first part                                                        
> 1–1
> (1) Chapter one 1–2 (2) Chapter two 1–3 (3) Chapter
> three 1–4 (4) Chapter four 1–5 (5) Chapter five 1–6
> Part 2 second part                                                   2–1
> (1) Chapter one 2–2 (2) Chapter two 2–3 (3) Chapter
> three 2–4 (4) Chapter four 2–5 (5) Chapter five 2–6
> Part 3 Third part                                                      3–1
> (1) Chapter one 3–2 (2) Chapter two 3–3 (3) Chapter
> three 3–4 (4) Chapter four 3–5 (5) Chapter five 3–6

An option is to use the narrower mechanism; unfortunately abc placement does not 
listen that so we need a patch (not sure if this is not breaking other things).

% this goes into core-sec or cont-new

\unprotect

\def\dodofixdlijstelementABC#1#2#3#4#5#6% weeden
   {\endgraf
    \leftskip\getvalue{\??li#1\c!margin}% na de \endgraf !
    \getvalue{\??li#1\c!before}%
    \!!widthc\getvalue{\??li#1\c!distance}%
    \doifelsevalue{\??li#1\c!width}\v!fit
      {\!!widtha\zeropoint}
      {\doifelsenothing{#3}
         {\doifelsevalue{\??li#1\c!aligntitle}\v!yes
            {\!!widtha\zeropoint
             \!!widthc\zeropoint}
            {\!!widtha\getvalue{\??li#1\c!width}}}
         {\!!widtha\getvalue{\??li#1\c!width}}}%
    \getvalue{\??li\c!alternative\getvalue{\??li#1\c!alternative}}%
    \endgraf
    \def\makelijstelement##1##2%
      {\doifelsevalue{\??li#1\c!interaction}{##1}
         {\setbox0\hbox{\showcontrastlocation\??ia{#6}{##2}}%
          \linklisttoelement{#1}{#2}{#5}{#6}{\box0}}%{\copy0}}%
         {\hbox{##2}}}%
    \doifvalue{\??li#1\c!interaction}\v!text % not supported
      {\setlistparameter{#1}\c!interaction\v!all}%
%    \makelijstelement\v!all
%      {\hbox to \hsize
    \makelijstelement\v!all
      {\setlocalhsize \hsize\localhsize \hbox to \hsize
         {\forgetall
          \dostartattributes{\??li#1}\c!style\c!color\empty
          \!!widthb\hsize
          \setbox2\hbox \ifdim\!!widtha>\zeropoint to \!!widtha \fi
            {\makelijstelement\v!sectionnumber
               {\dolistattributes{#1}\c!numberstyle\c!numbercolor
                  {\getvalue{\??li#1\c!numbercommand}{\currentlistsymbol}}%
             \hfill}}%
          \setbox4\hbox
            {\doifvalue{\??li#1\c!pagenumber}\v!yes
               {\doifsomething{#5}    % \lijstwidth is new ; temp hack
                  {\hbox \ifdim\lijstwidth>\zeropoint to \lijstwidth\fi
                     {\hfill
                      \makelijstelement\v!pagenumber
                        {\dolistattributes{#1}\c!pagestyle\c!pagecolor
                           {\getvalue{\??li#1\c!pagecommand}%
                              {\pageprefix\??li#1[#5]%
                               \translatednumber[#5]}}}}}}}%
          \vbox
            {\hsize\!!widthb
             \setupalign[\getvalue{\??li#1\c!align}]%
             \ifdim\!!widtha<\hsize
               \hangindent=\wd2
               \dimen2=\!!widthc % \getvalue{\??li#1\c!distance}%
               \advance\hangindent \dimen2
               \hangafter=1
               \doifvalue{\??li#1\c!hang}\v!no{\hangafter\zerocount}%
               \ifdim\wd4=\zeropoint % \ifvoid4
                 % we kunnen gewoon afbreken aan het eind
               \else
                 \ifdim\lijstskip>\zeropoint\relax
                   \rightskip=\lijstskip\!!plus10em\relax
                   \parfillskip=-\rightskip
                 \fi
               \fi
             \else
               \dimen2\zeropoint
             \fi
             \parindent\zeropoint\relax
             \leavevmode
             \box2\relax
             \hskip\dimen2
             \bgroup
             \dolistattributes{#1}\c!textstyle\c!textcolor
               {\let\\=\newlineinlist
                \dontconvertfont
               %\getvalue{\??li#1\c!textcommand}{#4}}%
                \limitatedlistentry{#1}{#4}}%
               %\carryoverpar % new otherwise wrong linespacing
             \egroup
             \ifdim\wd4=\zeropoint\relax % \ifvoid4
               % \ifdim\!!widtha<\hsize \hfill\strut \fi % spoils align
             \else
               \nobreak\lijstfill
               \box4\relax
               \relax
             \fi}%
          \hss
          \dostopattributes}}% new
    \nointerlineskip % anders verkeerde spatiering bij multi-line
    \endgraf
    \allowbreak
    \getvalue{\??li#1\c!after}}

\protect

\setuphead [part] 
[align=left,page=right,placehead=yes,before={\null\vfill},after={\vfill}]
\setuphead [chapter][before=,after=\blank]

\setuplist 
[chapter][alternative=d,left=(,right=),pagestyle=slanted,before=\blank,after=\blank]
\setuplist [part]   [before={\blank[big]},after=\blank]

\starttext

\startnarrower[2*right] \placecontent \stopnarrower \blank[4*big]

\startsetups chapter
   \blank \startnarrower[3*middle] \placecontent[criterium=local] \stopnarrower
\stopsetups

\placelist[part][criterium=text,after=\setups{chapter}]

\part{First part}       \chapter{Chapter one}  \chapter{Chapter two}
\chapter{Chapter three} \chapter{Chapter four} \chapter{Chapter five}

\part{Second part}      \chapter{Chapter one}  \chapter{Chapter two}
\chapter{Chapter three} \chapter{Chapter four} \chapter{Chapter five}

\part{Third part}       \chapter{Chapter one}  \chapter{Chapter two}
\chapter{Chapter three} \chapter{Chapter four} \chapter{Chapter five}

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

  reply	other threads:[~2004-11-30  9:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-28 15:46 Dirar BOUGATEF
2004-11-29 17:10 ` Dirar BOUGATEF
2004-11-29 17:25   ` Hans Hagen
2004-11-29 21:02     ` Dirar BOUGATEF
2004-11-30  0:53       ` Patrick Gundlach
2004-11-30  8:56         ` Dirar BOUGATEF
2004-11-30  9:56           ` Hans Hagen [this message]
2004-11-30 10:59             ` Dirar BOUGATEF
2004-11-29 18:00   ` Patrick Gundlach
2004-11-29 19:35 ` Willi Egger

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=41AC43B0.5010508@wxs.nl \
    --to=pragma@wxs.nl \
    --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).