[NTG-context] margin in TocEntry definition

jbf roma83537 at gmail.com
Fri Mar 12 08:16:44 CET 2021

It works, though I'm happy also to have Wolfgang's very simple version! 
I'm learning a lot! I'm a great believer in Occam's Razor - the law of 
parsimony, so the simpler version is the way to go, and my earlier use 
of a TeX hack (\-\) can be put to rest!

Thanks Bruce and thanks Wolfgang.


On 12/3/21 11:51 am, Bruce Horrocks wrote:
>> On 11 Mar 2021, at 22:22, jbf <roma83537 at gmail.com> wrote:
>> Thanks for trying, Bruce. That earlier question you refer to was for a similar situation and the answer resolved that one at the time (it was my question even then!) but not the precise one I am facing now.
>> The problem, you see, is that \startalignment only offers a few key words like flushleft, middle etc. and not what I need this time, which is a precise indentation feature like .5cm. I suppose my real problem is not being sufficiently au fait with how definitions work. I just can't seem to get a definition that gives me a result like
>> Chapter title
>>     author ..................................... page number
>> the \startalignment approach with flushleft would not give me the indentation obviously, and middle does not work for what I need, and either of them also pushes the page number line down onto the next line, which I don't want. I tried \skip .5cm, so:
>> \define[1]\SectionTocEntry{%
>> #1\crlf% title
>> \hskip .5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
>> }
>> But the \hskip is ignored at the beginning of a line. I wonder if there is something else I can substitute it for?
> D'oh! Sorry - completely forgot about the indent.
> Best I can come up with at the moment is this - but I'm not sure how to get leading dots.
> \starttext
> \define[3]\SectionToCEntry{
>    #2\crlf
>    \leftaligned
>    \bgroup
>      \hskip 0.5cm
>      \structurelistuservariable{author}
>      \rightaligned
>       \bgroup
>         #3
>       \egroup
>    \egroup
> }
> \setuplist
>    [chapter]
>    [alternative=command,
>     command=\SectionToCEntry,
>     after=\endgraf]
> \completecontent
> \startchapter
>    [title={This is my chapter title}]
>    [author={Dummy Name}]
> \input Tufte
> \stopchapter
> \stoptext
>> Bruce Horrocks
> Hampshire, UK

More information about the ntg-context mailing list