* margin in TocEntry definition
@ 2021-03-11 2:20 jbf
2021-03-11 22:04 ` Bruce Horrocks
0 siblings, 1 reply; 7+ messages in thread
From: jbf @ 2021-03-11 2:20 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi list,
I have:
\define[1]\SectionTocEntry{%
#1\crlf% title
\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
}
which successfully gives me a ToC with:
Chapter title
Author name
But I want the author name indented by .5cm and do not know how to use
'margin' in the above definition, or some other way of getting the
indentation. I have tried various versions of 'margin' before the
\doifnot part of the definition, but to no avail.
Hopefully I can achieve:
Chapter title
Author name
Julian
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: margin in TocEntry definition
2021-03-11 2:20 margin in TocEntry definition jbf
@ 2021-03-11 22:04 ` Bruce Horrocks
2021-03-11 22:22 ` jbf
2021-03-12 0:03 ` jbf
0 siblings, 2 replies; 7+ messages in thread
From: Bruce Horrocks @ 2021-03-11 22:04 UTC (permalink / raw)
To: ntg-context
> On 11 Mar 2021, at 02:20, jbf <roma83537@gmail.com> wrote:
>
> Hi list,
>
> I have:
>
> \define[1]\SectionTocEntry{%
> #1\crlf% title
> \doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
> }
>
> which successfully gives me a ToC with:
>
> Chapter title
> Author name
>
> But I want the author name indented by .5cm and do not know how to use 'margin' in the above definition, or some other way of getting the indentation. I have tried various versions of 'margin' before the \doifnot part of the definition, but to no avail.
There is a very similar previous question that might be what you are looking for.
<https://www.mail-archive.com/ntg-context@ntg.nl/msg97548.html>
Try that but use 'flushleft' instead of 'middle'.
—
Bruce Horrocks
Hampshire, UK
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: margin in TocEntry definition
2021-03-11 22:04 ` Bruce Horrocks
@ 2021-03-11 22:22 ` jbf
2021-03-12 0:51 ` Bruce Horrocks
2021-03-12 5:19 ` Wolfgang Schuster
2021-03-12 0:03 ` jbf
1 sibling, 2 replies; 7+ messages in thread
From: jbf @ 2021-03-11 22:22 UTC (permalink / raw)
To: Bruce Horrocks; +Cc: mailing list for ConTeXt users
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?
Julian
On 12/3/21 9:04 am, Bruce Horrocks wrote:
>> On 11 Mar 2021, at 02:20, jbf <roma83537@gmail.com> wrote:
>>
>> Hi list,
>>
>> I have:
>>
>> \define[1]\SectionTocEntry{%
>> #1\crlf% title
>> \doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
>> }
>>
>> which successfully gives me a ToC with:
>>
>> Chapter title
>> Author name
>>
>> But I want the author name indented by .5cm and do not know how to use 'margin' in the above definition, or some other way of getting the indentation. I have tried various versions of 'margin' before the \doifnot part of the definition, but to no avail.
> There is a very similar previous question that might be what you are looking for.
> <https://www.mail-archive.com/ntg-context@ntg.nl/msg97548.html>
>
> Try that but use 'flushleft' instead of 'middle'.
>
> —
> Bruce Horrocks
> Hampshire, UK
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: margin in TocEntry definition
2021-03-11 22:04 ` Bruce Horrocks
2021-03-11 22:22 ` jbf
@ 2021-03-12 0:03 ` jbf
1 sibling, 0 replies; 7+ messages in thread
From: jbf @ 2021-03-12 0:03 UTC (permalink / raw)
To: Bruce Horrocks; +Cc: mailing list for ConTeXt users
Re: indented line in TocEntry definition:
I have come up with what is probably an inelegant solution (using \-\ so
that \hskip is recognised at the beginning of a line), but it works!
Maybe someone could suggest how to make it more elegant, but for the
moment, it's all I need!
\define[1]\SectionTocEntry{%
#1\crlf% title
\-\ \hskip
.5cm\doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
}
Julian
On 12/3/21 9:04 am, Bruce Horrocks wrote:
>> On 11 Mar 2021, at 02:20, jbf <roma83537@gmail.com> wrote:
>>
>> Hi list,
>>
>> I have:
>>
>> \define[1]\SectionTocEntry{%
>> #1\crlf% title
>> \doifnot{\structurelistuservariable{author}}{}{\structurelistuservariable{author}}%
>> }
>>
>> which successfully gives me a ToC with:
>>
>> Chapter title
>> Author name
>>
>> But I want the author name indented by .5cm and do not know how to use 'margin' in the above definition, or some other way of getting the indentation. I have tried various versions of 'margin' before the \doifnot part of the definition, but to no avail.
> There is a very similar previous question that might be what you are looking for.
> <https://www.mail-archive.com/ntg-context@ntg.nl/msg97548.html>
>
> Try that but use 'flushleft' instead of 'middle'.
>
> —
> Bruce Horrocks
> Hampshire, UK
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: margin in TocEntry definition
2021-03-11 22:22 ` jbf
@ 2021-03-12 0:51 ` Bruce Horrocks
2021-03-12 7:16 ` jbf
2021-03-12 5:19 ` Wolfgang Schuster
1 sibling, 1 reply; 7+ messages in thread
From: Bruce Horrocks @ 2021-03-12 0:51 UTC (permalink / raw)
To: jbf; +Cc: ntg-context
> On 11 Mar 2021, at 22:22, jbf <roma83537@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
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: margin in TocEntry definition
2021-03-11 22:22 ` jbf
2021-03-12 0:51 ` Bruce Horrocks
@ 2021-03-12 5:19 ` Wolfgang Schuster
1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2021-03-12 5:19 UTC (permalink / raw)
To: mailing list for ConTeXt users
jbf schrieb am 11.03.2021 um 23:22:
> 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?
Use \par after the first line (and add \relax after \hskip).
\define[1]}SectionTocEntry
{#1\par
\hskip.5cm\relax\doifnot{...}{...}}
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: margin in TocEntry definition
2021-03-12 0:51 ` Bruce Horrocks
@ 2021-03-12 7:16 ` jbf
0 siblings, 0 replies; 7+ messages in thread
From: jbf @ 2021-03-12 7:16 UTC (permalink / raw)
To: Bruce Horrocks; +Cc: mailing list for ConTeXt users
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.
Julian
On 12/3/21 11:51 am, Bruce Horrocks wrote:
>
>> On 11 Mar 2021, at 22:22, jbf <roma83537@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
>
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-03-12 7:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 2:20 margin in TocEntry definition jbf
2021-03-11 22:04 ` Bruce Horrocks
2021-03-11 22:22 ` jbf
2021-03-12 0:51 ` Bruce Horrocks
2021-03-12 7:16 ` jbf
2021-03-12 5:19 ` Wolfgang Schuster
2021-03-12 0:03 ` jbf
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).