[NTG-context] Re: Table of contents of unnumbered titles

2023-09-09 Thread Jim
Hi Wolfgang,

On Sat, Sep  9, 2023 at 23:12 (+0200), Wolfgang Schuster wrote:

> Jim schrieb am 09.09.2023 um 22:34:
>> Wolfgang,

>> thanks very much for your help.  As a long-time plain TeX user, but a
>> ConTeXt n00b, that would have taken me a long time to figure out.

>> Having said that (and not to be ungrateful), for both of your examples
>> below, in my tests only the subsubject shows up in the contents. I tried
>> this both with the context distribution (updated a few minutes ago) and
>> with the version that is in texlive (also updated a few minutes ago).  Do
>> all three items show up in your contents listing?

> Hi Jim,

> both examples worked for me without problems and even the online compiler
> on the wiki produces the expected result.  Are you sure all 3 \setuphead
> lines are in your document?

Argh.  Mea culpa.

My mail program did not show me that your first answer had non-breakable
spaces after '[title]' and '[subject]' (but not after '[subsubject]').  And
I quickly copied and pasted those into a file without checking the
character set.  Replacing those with ASCII spaces makes everything work
nicely, thanks very much.

Amusingly (sort of), there was a bun-fight on the texhax mailing list
recently when someone's message came across with non-breakable spaces in
it, causing the recipient to complain that something didn't work, when the
originator vehemently asserted that it did.  (I was neither of those two
people, although I did help the originator trace where the nbsp's got into
his message.)  It's like deja vu all over again.

Did you insert your helpful solution into the wiki somewhere, or just test
them in the wiki compiler?  I just reloaded
https://wiki.contextgarden.net/index.php?title=Titles=toggle_view_desktop#Unnumbered_titles_in_table_of_contents
and don't see your code there, but since yours does work and those
(apparently) do not work, it would be nice to have your code there.

Cheers.

Jim
___
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
___


[NTG-context] Re: Table of contents of unnumbered titles

2023-09-09 Thread Jim
Wolfgang,

thanks very much for your help.  As a long-time plain TeX user, but a
ConTeXt n00b, that would have taken me a long time to figure out.

Having said that (and not to be ungrateful), for both of your examples
below, in my tests only the subsubject shows up in the contents. I tried
this both with the context distribution (updated a few minutes ago) and
with the version that is in texlive (also updated a few minutes ago).  Do
all three items show up in your contents listing?

Thanks.
Jim


On Sat, Sep  9, 2023 at 21:17 (+0200), Wolfgang Schuster wrote:

> Jim schrieb am 09.09.2023 um 20:11:
>> Hi,

>> I am creating a document which is divided with the unnumbered levels
>> (\title, \subject, ...).

>> I would like a table of contents showing the names and page numbers,
>> something like

>> Blah blah blah2
>> Blah blah 4
>> ...

>> However, notwithstanding what I see in
>> https://wiki.contextgarden.net/index.php?title=Titles=toggle_view_desktop#Unnumbered_titles_in_table_of_contents
>> I can't get this to happen with unnumbered divisions.

>> The above wiki reference says "the following might do that trick" but I
>> think "might" is the keyword, since even the wiki doesn't show the "No
>> number" entry in the \completecontent.

>> I find it hard to imagine that I am the only Context user who wants to do
>> this.  Can anyone point me in the direction of a working example?

>> And am I misinterpreting the wiki, or is the wiki page broken?

> 1. You have to change the value of the incrementnumber key for title,
> subject etc.

> 2. You have to specify which sections are shown in the table of content
> because by default only the numbered sections are listed.

>  begin example 1
> \setuphead [title]  [incrementnumber=list]
> \setuphead [subject]    [incrementnumber=list]
> \setuphead [subsubject] [incrementnumber=list]

> \definehead [contentstitle] [title]

> \setupcombinedlist [content]
> [list={chapter,title,section,subject,subsection,subsubject}]

> \starttext

> \completecontent

> \title{Title}

> \subject{Subject}

> \subsubject{Subsubject}

> \stoptext
>  end example 1

>  begin example 2
> \setuphead [title]  [incrementnumber=list]
> \setuphead [subject]    [incrementnumber=list]
> \setuphead [subsubject] [incrementnumber=list]

> \definehead [contentstitle] [title]

> \starttext

> \contentstitle{Contents}

> \placelist[chapter,title,section,subject,subsection,subsubject]

> \title{Title}

> \subject{Subject}

> \subsubject{Subsubject}

> \stoptext
>  end example 2

> Wolfgang

___
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
___


[NTG-context] Re: Table of contents of unnumbered titles

2023-09-09 Thread Wolfgang Schuster

Jim schrieb am 09.09.2023 um 22:34:

Wolfgang,

thanks very much for your help.  As a long-time plain TeX user, but a
ConTeXt n00b, that would have taken me a long time to figure out.

Having said that (and not to be ungrateful), for both of your examples
below, in my tests only the subsubject shows up in the contents. I tried
this both with the context distribution (updated a few minutes ago) and
with the version that is in texlive (also updated a few minutes ago).  Do
all three items show up in your contents listing?


Hi Jim,

both examples worked for me without problems and even the online compiler
on the wiki produces the expected result. Are you sure all 3 \setuphead 
lines

are in your document?

Wolfgang

___
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
___


[NTG-context] Re: Table of contents of unnumbered titles

2023-09-09 Thread Lutz Haseloff
Hi Jim,

perhaps does this work for you?


\setuplist[chapter][headnumber=no]
\setuphead[chapter][number=no]
\starttext
\completecontent
\page
\chapter{Chapter one}
\input knuth
\chapter{Chapter two}
\input ward
\stoptext


Greetings Lutz

Am 9. September 2023 20:11:55 MESZ schrieb Jim :
>Hi,
>
>I am creating a document which is divided with the unnumbered levels
>(\title, \subject, ...).
>
>I would like a table of contents showing the names and page numbers,
>something like
>
>Blah blah blah2
>Blah blah 4
>...
>
>However, notwithstanding what I see in
>https://wiki.contextgarden.net/index.php?title=Titles=toggle_view_desktop#Unnumbered_titles_in_table_of_contents
>I can't get this to happen with unnumbered divisions.
>
>The above wiki reference says "the following might do that trick" but I
>think "might" is the keyword, since even the wiki doesn't show the "No
>number" entry in the \completecontent.
>
>I find it hard to imagine that I am the only Context user who wants to do
>this.  Can anyone point me in the direction of a working example?
>
>And am I misinterpreting the wiki, or is the wiki page broken?
>
>Thanks.
>
>   Jim
>___
>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
>___
___
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
___

[NTG-context] Re: Table of contents of unnumbered titles

2023-09-09 Thread Wolfgang Schuster

Jim schrieb am 09.09.2023 um 20:11:

Hi,

I am creating a document which is divided with the unnumbered levels
(\title, \subject, ...).

I would like a table of contents showing the names and page numbers,
something like

Blah blah blah2
Blah blah 4
...

However, notwithstanding what I see in
https://wiki.contextgarden.net/index.php?title=Titles=toggle_view_desktop#Unnumbered_titles_in_table_of_contents
I can't get this to happen with unnumbered divisions.

The above wiki reference says "the following might do that trick" but I
think "might" is the keyword, since even the wiki doesn't show the "No
number" entry in the \completecontent.

I find it hard to imagine that I am the only Context user who wants to do
this.  Can anyone point me in the direction of a working example?

And am I misinterpreting the wiki, or is the wiki page broken?


1. You have to change the value of the incrementnumber key for title, 
subject etc.


2. You have to specify which sections are shown in the table of content 
because by default only the numbered sections are listed.


 begin example 1
\setuphead [title]  [incrementnumber=list]
\setuphead [subject]    [incrementnumber=list]
\setuphead [subsubject] [incrementnumber=list]

\definehead [contentstitle] [title]

\setupcombinedlist [content] 
[list={chapter,title,section,subject,subsection,subsubject}]


\starttext

\completecontent

\title{Title}

\subject{Subject}

\subsubject{Subsubject}

\stoptext
 end example 1

 begin example 2
\setuphead [title]  [incrementnumber=list]
\setuphead [subject]    [incrementnumber=list]
\setuphead [subsubject] [incrementnumber=list]

\definehead [contentstitle] [title]

\starttext

\contentstitle{Contents}

\placelist[chapter,title,section,subject,subsection,subsubject]

\title{Title}

\subject{Subject}

\subsubject{Subsubject}

\stoptext
 end example 2

Wolfgang


___
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
___

[NTG-context] Table of contents of unnumbered titles

2023-09-09 Thread Jim
Hi,

I am creating a document which is divided with the unnumbered levels
(\title, \subject, ...).

I would like a table of contents showing the names and page numbers,
something like

Blah blah blah2
Blah blah 4
...

However, notwithstanding what I see in
https://wiki.contextgarden.net/index.php?title=Titles=toggle_view_desktop#Unnumbered_titles_in_table_of_contents
I can't get this to happen with unnumbered divisions.

The above wiki reference says "the following might do that trick" but I
think "might" is the keyword, since even the wiki doesn't show the "No
number" entry in the \completecontent.

I find it hard to imagine that I am the only Context user who wants to do
this.  Can anyone point me in the direction of a working example?

And am I misinterpreting the wiki, or is the wiki page broken?

Thanks.

   Jim
___
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
___


[NTG-context] Verbatim Textbox with Reference NUmbering

2023-09-09 Thread Jeroen
This is a longshot, but would be great to have. Below I have at MWE1 the
verbatim codefragment textbox I am using. I found in the forum MWE2 which
is a textbox with an automatic reference number. Is there a way to get the
same for MWE1 with automatic reference numbering like 1.1, 1.2 etc for
chapter 1, codefragment 1, 2 etc. with the possibility that in the text I
can refer to the codefragment like \in{codefragment\space}[code:ccpsample]
similar as to tables and figures? Thanks Jeroen


%%
% MWE1
%%

\startuseMPgraphic{mpos:par:myexample}
path p;
for i = 1 upto nofmultipars :
  p := multipars[1] topenlarged 4pt bottomenlarged 4pt cornered 2mm ;
  fill p withcolor 0.95white ;
  draw p withcolor black
  withpen pencircle scaled \MPvar{linewidth};
  endfor;
\stopuseMPgraphic

\definetextbackground
  [listingbackground]
  [state=start,
   mp=mpos:par:myexample,
   location=paragraph,
   topoffset=0.4em,
   leftoffset=0em,
   rulethickness=0.7pt]

\definetyping[Listing]
  [option=commands]

\setuptyping
  [Listing]
  [bodyfont=10pt,
   margin=1em,
   before=%
 {\blank[3*medium]
  \setupinterlinespace[line=2.4ex]
  \starttextbackground[listingbackground]},
   after=%
 {\stoptextbackground
  \blank[4*medium]},
   align={flushleft,verytolerant}]

\starttext

\startListing
this is a code example
\stopListing

\stoptext


%%
% MWE2
%%

\startuseMPgraphic{FunnyFrame}
  picture p ; numeric w, h, o ;
  p := textext.rt(\MPstring{FunnyFrame}) ;
  w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
  p := p shifted (2o,h-ypart center p) ; draw p ;
  drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
  draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
  draw boundingbox p ;
  setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][frame=off,background=FunnyFrame]
\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{}

% Add the enumeration
\defineenumeration
  [Counter]
  [text=,
   alternative=empty,
   before={\FrameTitle{Counter \getnumber[Counter]}
   \startFunnyText},
   after={\stopFunnyText}]

\starttext

\startCounter
First example
\stopCounter

\startCounter
Second example
\stopCounter

\stoptext
___
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
___

[NTG-context] Re: how to define an environment with key=value arguments

2023-09-09 Thread Henning Hraban Ramm

Am 08.09.23 um 19:37 schrieb Henning Hraban Ramm:

But it uses its own page size, I don’t understand why. I need the 
bleed/trim area.


If I use \setlayer in the setup, the content gets placed on the next 
page, i.e. under the text.


\structureuservariable{image} in the setup gets the value from the 
_next_ chapter. Maybe the approach in from the source with

\dummyparameter\c!name
would work better, but I don’t know how to transfer it.


I gave up, ran into too many problems.

Tried to avoid injections and put everything in before/beforesection 
macros, but \structureuservariable there also always picks up the values 
from the next chapter (while I would expect the current or maybe the 
previous).


So I copy-pasted the whole bunch of ugly commands in front of every 
chapter, and it works.


It’s only for one book with 18 chapters, doesn’t make much sense to 
spend even more time on a more elegant solution.


Hraban
___
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
___