[NTG-context] Re: Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2023-09-18 Thread Michael Loescher

Am 18.09.2023 um 16:20 schrieb Hans Hagen:

On 9/18/2023 3:58 PM, Michael Loescher wrote:

There seems to be something wrong with the \type command.

MWE:
\starttext
\type{hello}
\stoptext

gives an error:
tex error   > tex error on line 2 in file Z:/test.tex: Control sequence 
expected instead of undefined

what platform?


I run the latest win64 build.

Michael
___
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: Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2023-09-18 Thread Mikael Sundqvist
Hi,

works as expected here, with the latest.

/Mikael

On Mon, Sep 18, 2023 at 4:04 PM Michael Loescher  wrote:
>
> There seems to be something wrong with the \type command.
>
> MWE:
> \starttext
> \type{hello}
> \stoptext
>
> gives an error:
> tex error   > tex error on line 2 in file Z:/test.tex: Control sequence
> expected instead of undefined
>
>  \buff_verbatim_type_normal
>  #1->\buff_verbatim_initialize_type_two \dostarttaggedchained \t!verbatim
> \currenttype \??type \clf_type data{\protecteddetokenize
>  {#1}}tab{\typeparameter \c!tab }method{\p_buff_option
> }compact{\typeparameter \c!compact }escape{\typeparameter \c!escap
> 
>  \type{hello}
>
> 1 \starttext
> 2 >>  \type{hello}
> 3 \stoptext
> You injected something that confused the parser, maybe by using some Lua call.
> mtx-context | fatal error: return code: 1
>
> Michael
>
> Am 17.09.2023 um 10:01 schrieb Cron Daemon:
> > receiving incremental file list
> >   ./
> >   ctan.lsr
> >   document-2.htm
> >   download-1.htm
> >   download-2.htm
> >   logo-ade.png
> >   logo-cts.png
> >   logo-pod.png
> >   rss.xml
> >   show-fil.pdf
> >   context/latest/
> >   context/latest/cont-lmt.zip
> >   context/latest/cont-mpd.zip
> >   context/latest/cont-ppc.zip
> >   context/latest/cont-sci.zip
> >   context/latest/cont-tmf.zip
> >   context/latest/cont-tst.7z
> >   context/latest/cont-tst.tar.xz
> >   context/latest/cont-tst.zip
> >   general/manuals/
> >   general/manuals/luametatex.pdf
> >   general/manuals/primitives.pdf
> >
> >   sent 185,495 bytes  received 41,503,755 bytes  3,335,140.00 bytes/sec
> >   total size is 562,644,378  speedup is 13.50
> >
> >
> > Running archiver:
> >
> > New dir: /var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10
> > 232388526 
> > /var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10/latest
> > 126745317 
> > /var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10/current
> > 359137939 
> > /var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10
> > 359137939 total
> > ___
> > 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
> ___
___
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: Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2023-09-18 Thread Hans Hagen

On 9/18/2023 3:58 PM, Michael Loescher wrote:

There seems to be something wrong with the \type command.

MWE:
\starttext
\type{hello}
\stoptext

gives an error:
tex error   > tex error on line 2 in file Z:/test.tex: Control 
sequence expected instead of undefined

what platform?

looks like a mismatch in binary (you can compile luametatex yourself and 
then update the bin if ther eis some platform issue)


the compile farm is down (Mojca has to replace the machine) so I can't 
check it


Hans

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

___
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: Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2023-09-18 Thread Michael Loescher

There seems to be something wrong with the \type command.

MWE:
\starttext
\type{hello}
\stoptext

gives an error:
tex error   > tex error on line 2 in file Z:/test.tex: Control sequence 
expected instead of undefined


 \buff_verbatim_type_normal
#1->\buff_verbatim_initialize_type_two \dostarttaggedchained \t!verbatim 
\currenttype \??type \clf_type data{\protecteddetokenize
{#1}}tab{\typeparameter \c!tab }method{\p_buff_option 
}compact{\typeparameter \c!compact }escape{\typeparameter \c!escap


\type{hello}

1 \starttext
2 >>  \type{hello}
3 \stoptext
You injected something that confused the parser, maybe by using some Lua call.
mtx-context | fatal error: return code: 1

Michael

Am 17.09.2023 um 10:01 schrieb Cron Daemon:

receiving incremental file list
  ./
  ctan.lsr
  document-2.htm
  download-1.htm
  download-2.htm
  logo-ade.png
  logo-cts.png
  logo-pod.png
  rss.xml
  show-fil.pdf
  context/latest/
  context/latest/cont-lmt.zip
  context/latest/cont-mpd.zip
  context/latest/cont-ppc.zip
  context/latest/cont-sci.zip
  context/latest/cont-tmf.zip
  context/latest/cont-tst.7z
  context/latest/cont-tst.tar.xz
  context/latest/cont-tst.zip
  general/manuals/
  general/manuals/luametatex.pdf
  general/manuals/primitives.pdf
  
  sent 185,495 bytes  received 41,503,755 bytes  3,335,140.00 bytes/sec

  total size is 562,644,378  speedup is 13.50


Running archiver:

New dir: /var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10
232388526   
/var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10/latest
126745317   
/var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10/current
359137939   
/var/www/aanhet.net/context//htdocs/archives/context-2023-09-17.10
359137939   total
___
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: Framed Text with Chapter Numbers as Counter

2023-09-17 Thread Jeroen
That works fine except that the following line does only issue the
sequential number and not the chapter number.

Refer to \in{code fragment}[tit1] bla

MWE:

\startuseMPgraphic{CountFrame}
  picture p; numeric w, h, o;
  p := textext.rt("\wrappedcurrentconstruction");
  w := OverlayWidth;
  h := OverlayHeight;
  o := BodyFontSize;
  p := p shifted (2o,h-ypart center p);
  draw p;
  path b;
  b := boundingbox p enlarged (o/10);
  path a;
  a := (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
  drawoptions (withpen pencircle scaled 1pt withcolor black);
  draw a;
  draw b;
  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [CountFrame]
  [\useMPgraphic{CountFrame}]

\defineframedtext
  [CountFramedText]
  [frame=off,
   background=CountFrame,
   offset=\bodyfontsize,
   width=\textwidth,
%  style={\switchtobodyfont[11pt,tt]}]
   bodyfont=11pt,
   style={\tt}]

\defineenumeration
  [Code]
  [title=yes,
   alternative=empty,
   before=\startCountFramedText,
   after=\stopCountFramedText,
   left={\somenamedheadnumber{chapter}{current}.}]

\starttext

\startchapter
  [title=first]

\startCode
  [title={The First Title},
   reference={tit1}]
   Some verbatim text
\stopCode

\startCode
  [title={The Second Title},
   reference={tit2}]
   Some verbatim text
\stopCode

Refer to \in{code fragment}[tit1] bla

\stopchapter

\startchapter
  [title=second]

\startCode
  [title={The Third Title},
   reference={tit3}]
   Some verbatim text
\stopCode

\stopchapter

\stoptext

Op zo 17 sep 2023 om 17:31 schreef Bruce Horrocks :

>
>
> > On 16 Sep 2023, at 21:28, Jeroen  wrote:
> >
> > This MWE has a framed text for some verbatim text (code) with as title
> ref. a counter 1, 2, etc.. Is there a way to change this frame text title
> as following with the chapter number and a sequential number and the title.
>
> Amemd the \defineenumeration as follows:
>
> \defineenumeration
>   [Counter]
>   [title=yes,
>alternative=empty,
>before=\startCountFramedText,
>after=\stopCountFramedText,
>left={\somenamedheadnumber{chapter}{current}:}]
>
> —
> 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 /
> 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] Framed Text with Chapter Numbers as Counter

2023-09-16 Thread Jeroen
This MWE has a framed text for some verbatim text (code) with as title ref.
a counter 1, 2, etc.. Is there a way to change this frame text title as
following with the chapter number and a sequential number and the title.

Code Fragment 1.1 (The First Title)
Code Fragment 1.2 (The Second Title)
Code Fragment 2.1 (The Third Title)

MWE:

\startuseMPgraphic{CountFrame}
  picture p; numeric w, h, o;
  p := textext.rt("\wrappedcurrentconstruction");
  w := OverlayWidth; h := OverlayHeight; o := BodyFontSize;
p := p shifted (2o,h-ypart center p);
draw p;
path b;
b := boundingbox p enlarged (o/10);
drawoptions (withpen pencircle scaled 1pt withcolor black);
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
draw b;
setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [CountFrame]
  [\useMPgraphic{CountFrame}]

\defineframedtext
  [CountFramedText]
  [frame=off,
   background=CountFrame,
   offset=\bodyfontsize,
   width=\textwidth,
%   style={\switchtobodyfont[11pt,tt]}]
   bodyfont=11pt,
   style={\tt},
   ]

\def\FrameTitle#1%
  {\setMPtext{CountFrame}
  {\hbox spread 1em{\hss\strut#1\hss}}}\setMPtext{CountFrame}
  {}

\defineenumeration
  [Counter]
  [title=yes,
   alternative=empty,
   before=\startCountFramedText,
   after=\stopCountFramedText]

\starttext

\startchapter
  [title=first]

\startCounter
  [title={The First Title},
   reference={tit1}]
   Some verbatim text
\stopCounter

\startCounter
  [title={The Second Title},
   reference={tit2}]
   Some verbatim text
\stopCounter

Refer to \in{code fragment}[tit1] bla

\stopchapter

\startchapter
  [title=second]

\startCounter
  [title={The Third Title},
   reference={tit3}]
   Some verbatim text
\stopCounter

\stopchapter

\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] stream sync (or \pushoutputstream)

2023-09-16 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\showgrid
\setuplayout[grid=yes]
\starttext

\startoutputstream[one]
   \startcolor[red]
 \dorecurse{4}{\input knuth\par\pushoutputstream}
   \stopcolor
\stopoutputstream

\startoutputstream[two]
   \startcolor[green]
 \dorecurse{4}{\input zapf\par\pushoutputstream}
   \stopcolor
\stopoutputstream

\null\page
\synchronizestreams[one,two]
\flushoutputstream[one]
\page\flushoutputstream[two]

\stoptext

With MkIV, stream one is always a line before stream two (11-12, 21-22,
31-32).

With LMTX, the output is less reliable, since stream one is one, two and
three lines before stream two (11-12, 21-23, 31-34).

In some cases, having synced streams is highly desirable.

Besides the output difference in LMTX, is there a way to get fully
synced streams?

Many thanks for your help,

Pablo
___
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] rotation weirdness

2023-09-16 Thread Hans van der Meer via ntg-context
I encountered something weird, that I cannot explain. It could be an error, but I was not able to pinpoint this.It seems as if the \rotate macro plays havoc with the macro definitions used to set the color of the frame and an outside title.Placing the outside title before the rotate proves that the call to \rotate is the culprit.I enclose an MWE with a little jpeg figure as illustration.
yours sincerelydr. Hans van der Meer\def\formattitle#1{\color[\boxtitlecolor]{#1\strut}}\def\boxfigurerotate#1#2{%	\rotate[rotation=10]%	{%		\externalfigure[#1]%		[rulethickness=4pt,width=100pt,height=50pt,frame=on,framecolor=\boxframecolor,]%	}%	\formattitle{#2}%}\def\boxfigure#1#2{%		\externalfigure[#1]%		[rulethickness=4pt,width=100pt,height=50pt,frame=on,framecolor=\boxframecolor,]%	\formattitle{#2}%}\def\boxtitlecolor{blue}\def\boxframecolor{blue}\starttext\ConTeXt\ \contextversion\blankProblem:\crlfit looks like \type{\rotate[]{}} kills the definition of boxtitlecolor.Changing the names of the titlecolor/framecolor definitions makes no difference.\crlfWhy is this? ConTeXt error?\blank\boxfigure{test}{norotation: title color is blue}\blank\boxfigurerotate{test}{rotation: title color should be blue but is not}\blank\def\boxframecolor{red}\boxfigurerotate{test}{rotation: title color different from framecolor now blue}\stoptext

rotatecolor.pdf
Description: Adobe PDF document
___
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: streams reversed?

2023-09-15 Thread jbf

Thanks Idris.

See my response to Bruce, and indeed his response to mine earlier. I'll 
have to leave it at that for now. Too many other matters pressing.


Julian

On 15/9/23 22:43, Hamid,Idris wrote:

Hi Julian,

Am also interested in this matter (and played a bit with the code you 
provided); one suspects that others are as well.


Based on past experience, can affirm that it's sometimes 
time-consuming, even a pain, to produce an MWE to reproduce the 
relevant behavior. But it would be well worth the effort for the sake 
of improving the streams mechanism and clarifying its ultimate 
limitations.


Even if the final MWE seems too bulky, you could post cloud links to 
the source and pdf files. Thank you for your contribution.


Best wishes
Idris

-- Original Message --
From "jbf" 
To "Bruce Horrocks" ; "mailing list for ConTeXt 
users" 

Date 9/14/2023 4:04:27 PM
Subject [NTG-context] Re: streams reversed?


** Caution: EXTERNAL Sender **
Bruce, that was kind of you to reply. I think we both know that the
streams mechanism, while 'workable' for the most part, is still in need
of refinement.
It is quite possible that what is causing my problem has less to do with
'streams' per se, and more to do with the use of this mechanism in a
'real book' using frontmatter, bodymatter etc. etc.
Since it would be too long and complicated an MWE to place here in the
list to demonstrate my problem, I will send you the file separately so
you can see the issue: effectively, the streams have worked for
frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they
are reversed. You will see that. I can't work out why, but you might be
able to see what is causing that.
And of course, I have two other problems to work out before I could use
this in a real production scenario: there is the one you have already
alluded to of extra pages occasionally beforehand (hopefully easily
solvable) but I can see another problem when the text is a lengthy
one... and this is the result of synchronization: when one language (vi)
takes up more space than the other (en), we get an awkward break at the
end of the chapter in en, so that the last line can 'catch up' with the
last paragraph (in vi). Maybe this one will be harder to solve!
Julian
On 14/9/23 20:14, Bruce Horrocks wrote:

On 13 Sep 2023, at 07:47, jbf  wrote:
When I come to bodymatter and Chapter 1, again it works, except 
that the positions of the languages are reversed, so I end up with 
vi on the left and en on the right. By Chapter 2 we are back to the 
correct position once more (en left and vi right).
I want to know why this is happening, and if I can prevent it 
happening.
I've modified the sample code you got from Wolfgang to include 
chapter headings and it all looks fine to me[1] - the red text is 
all on the right hand side and the greeen text is all on the left. 
If this doesn't help and you still have problems then you'll need to 
post a sample that actually shows the problem. I'm using ConTeXt 
ver: 2023.09.04 19:15.

\starttext
\startoutputstream[one]
\startcolor[red]
\dorecurse{5}{\chapter{Stream One}
\dorecurse{10}{\input knuth\par}
}
\stopcolor
\stopoutputstream
\startoutputstream[two]
\startcolor[green]
\dorecurse{5}{\chapter{Stream Two}
\dorecurse{10}{\input zapf\par}
}
\stopcolor
\stopoutputstream
\synchronizestreams[one,two]
\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]
\doloop
{\ifvoid\scratchboxone
\exitloop
\else
\setbox\scratchboxfour\vsplit\scratchboxone to \textheight
\vbox to \vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight
\vbox to \vsize{\box\scratchboxfive\vss}%
\fi}
\stoptext
[1] Apart from unnecessary blank pages at the beginning but that's a 
different problem so I'm not addressing that for now.

—
Bruce Horrocks

--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80523___
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: Chapters without new page

2023-09-15 Thread Bruce Horrocks


> On 15 Sep 2023, at 13:56, Taco Hoekwater  wrote:
> 
> Like this?
> 
>  \definehead[mychapter][chapter]
>  \setuphead[mychapter][page=no]

Taco beat me to it... a simple example:

\starttext

\chapter{First}
Some text

\chapter{Second}
More text

\chapter{Third}
More text

\setuphead[chapter][page=no]
\chapter{Fourth}
More text

\chapter{Fifth}
More text

\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 / 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: Chapters without new page

2023-09-15 Thread Taco Hoekwater


> On 15 Sep 2023, at 14:07, Rik Kabel  wrote:
> 
> 
> On 9/15/2023 4:10 AM, Taco Hoekwater wrote:
>> 
>> 
>>> On 15 Sep 2023, at 09:58,   
>>> wrote:
>>> 
>>> I thought there should be a setups key on \setupsectionblock, but 
>>> apparently there isn’t. So, the example below does not work, but maybe it 
>>> wouldn’t be too hard to add it…
>>> 
>> There is a ‘before' key, but note that the sectionblock itself is called 
>> “backpart”, not “backmatter”
>> 
>> Either use
>> 
>> \setupsectionblock[backpart][before={\setuphead[chapter][page=no]}]
>> 
>> Or, nicer:
>> 
>> \startsectionblockenvironment[backpart]
>> \setuphead[chapter][page=no]
>> \stopsectionblockenvironment
>> 
>> 
>>> Best,
>>> Denis
>>> \setuphead[chapter][page=yes]
>>> \setupsectionblock[backmatter][setups={\setuphead[chapter][page=no]}]
>>> \starttext
>>> \chapter{One}
>>> \input knuth
>>> \chapter{Two}
>>> \input ward
>>> \startbackmatter
>>> \chapter{Three}
>>> \input knuth
>>> \chapter{Four}
>>> \input ward
>>> \stopbackmatter
>>> \stoptext
>>> Von: Jeroen  
>>> Gesendet: Donnerstag, 14. September 2023 23:50
>>> An: mailing list for ConTeXt users 
>>> Betreff: [NTG-context] Chapters without new page
>>> In the \startbackmatter ... \stopbackmatter section i would like to have 
>>> some chapters that are not automatically placed on a new page for the next 
>>> chapter. Is there an easy way to suppress the new page for these chapters?
>>> Thanks, Jeroen
>>> 
>> Best wishes,
>> Taco
>> 
>> 
> While this works, it changes behavior for **all** chapters. It does not 
> address the original question of how to have **some** chapters  "not 
> automatically placed on a new page."

Like this?

  \definehead[mychapter][chapter]
  \setuphead[mychapter][page=no]


Taco


___
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: streams reversed?

2023-09-15 Thread Hamid,Idris
Hi Julian,

Am also interested in this matter (and played a bit with the code you 
provided); one suspects that others are as well.

Based on past experience, can affirm that it's sometimes time-consuming, even a 
pain, to produce an MWE to reproduce the relevant behavior. But it would be 
well worth the effort for the sake of improving the streams mechanism and 
clarifying its ultimate limitations.

Even if the final MWE seems too bulky, you could post cloud links to the source 
and pdf files. Thank you for your contribution.

Best wishes
Idris

-- Original Message --
From "jbf" mailto:roma83...@gmail.com>>
To "Bruce Horrocks" mailto:n...@scorecrow.com>>; "mailing 
list for ConTeXt users" mailto:ntg-context@ntg.nl>>
Date 9/14/2023 4:04:27 PM
Subject [NTG-context] Re: streams reversed?

** Caution: EXTERNAL Sender **

Bruce, that was kind of you to reply. I think we both know that the
streams mechanism, while 'workable' for the most part, is still in need
of refinement.

It is quite possible that what is causing my problem has less to do with
'streams' per se, and more to do with the use of this mechanism in a
'real book' using frontmatter, bodymatter etc. etc.

Since it would be too long and complicated an MWE to place here in the
list to demonstrate my problem, I will send you the file separately so
you can see the issue: effectively, the streams have worked for
frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they
are reversed. You will see that. I can't work out why, but you might be
able to see what is causing that.

And of course, I have two other problems to work out before I could use
this in a real production scenario: there is the one you have already
alluded to of extra pages occasionally beforehand (hopefully easily
solvable) but I can see another problem when the text is a lengthy
one... and this is the result of synchronization: when one language (vi)
takes up more space than the other (en), we get an awkward break at the
end of the chapter in en, so that the last line can 'catch up' with the
last paragraph (in vi). Maybe this one will be harder to solve!

Julian

On 14/9/23 20:14, Bruce Horrocks wrote:
On 13 Sep 2023, at 07:47, jbf mailto:roma83...@gmail.com>> 
wrote:
When I come to bodymatter and Chapter 1, again it works, except that the 
positions of the languages are reversed, so I end up with vi on the left and en 
on the right. By Chapter 2 we are back to the correct position once more (en 
left and vi right).
I want to know why this is happening, and if I can prevent it happening.

I've modified the sample code you got from Wolfgang to include chapter headings 
and it all looks fine to me[1] - the red text is all on the right hand side and 
the greeen text is all on the left. If this doesn't help and you still have 
problems then you'll need to post a sample that actually shows the problem. I'm 
using ConTeXt ver: 2023.09.04 19:15.

\starttext

\startoutputstream[one]
\startcolor[red]
\dorecurse{5}{\chapter{Stream One}
\dorecurse{10}{\input knuth\par}
}
\stopcolor
\stopoutputstream

\startoutputstream[two]
\startcolor[green]
\dorecurse{5}{\chapter{Stream Two}
\dorecurse{10}{\input zapf\par}
}
\stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
{\ifvoid\scratchboxone
\exitloop
\else
\setbox\scratchboxfour\vsplit\scratchboxone to \textheight
\vbox to \vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight
\vbox to \vsize{\box\scratchboxfive\vss}%
\fi}

\stoptext


[1] Apart from unnecessary blank pages at the beginning but that's a different 
problem so I'm not addressing that for now.

—
Bruce Horrocks
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
___
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: Chapters without new page

2023-09-15 Thread Rik Kabel


On 9/15/2023 4:10 AM, Taco Hoekwater wrote:



On 15 Sep 2023, at 09:58,wrote:

I thought there should be a setups key on \setupsectionblock, but apparently 
there isn’t. So, the example below does not work, but maybe it wouldn’t be too 
hard to add it…

There is a ‘before' key, but note that the sectionblock itself is called 
“backpart”, not “backmatter”

Either use

\setupsectionblock[backpart][before={\setuphead[chapter][page=no]}]

Or, nicer:

\startsectionblockenvironment[backpart]
   \setuphead[chapter][page=no]
\stopsectionblockenvironment


  Best,
Denis
   \setuphead[chapter][page=yes]
  \setupsectionblock[backmatter][setups={\setuphead[chapter][page=no]}]
  \starttext
  \chapter{One}
\input knuth
  \chapter{Two}
\input ward
   \startbackmatter
\chapter{Three}
\input knuth
  \chapter{Four}
\input ward
\stopbackmatter
\stoptext
   Von: Jeroen  
Gesendet: Donnerstag, 14. September 2023 23:50

An: mailing list for ConTeXt users
Betreff: [NTG-context] Chapters without new page
  In the \startbackmatter ... \stopbackmatter section i would like to have some 
chapters that are not automatically placed on a new page for the next chapter. 
Is there an easy way to suppress the new page for these chapters?
Thanks, Jeroen

Best wishes,
Taco

While this works, it changes behavior for **all** chapters. It does not 
address the original question of how to have **some** chapters  "not 
automatically placed on a new page."


--
Rik
___
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: Chapters without new page

2023-09-15 Thread Taco Hoekwater


> On 15 Sep 2023, at 09:58,   wrote:
> 
> I thought there should be a setups key on \setupsectionblock, but apparently 
> there isn’t. So, the example below does not work, but maybe it wouldn’t be 
> too hard to add it…

There is a ‘before' key, but note that the sectionblock itself is called 
“backpart”, not “backmatter”

Either use

\setupsectionblock[backpart][before={\setuphead[chapter][page=no]}]

Or, nicer:

\startsectionblockenvironment[backpart]
  \setuphead[chapter][page=no]
\stopsectionblockenvironment

>  Best,
> Denis
>   \setuphead[chapter][page=yes]
>  \setupsectionblock[backmatter][setups={\setuphead[chapter][page=no]}]
>  \starttext
>  \chapter{One}
> \input knuth
>  \chapter{Two}
> \input ward
>   \startbackmatter
> \chapter{Three}
> \input knuth
>  \chapter{Four}
> \input ward
> \stopbackmatter
> \stoptext
>   Von: Jeroen  
> Gesendet: Donnerstag, 14. September 2023 23:50
> An: mailing list for ConTeXt users 
> Betreff: [NTG-context] Chapters without new page
>  In the \startbackmatter ... \stopbackmatter section i would like to have 
> some chapters that are not automatically placed on a new page for the next 
> chapter. Is there an easy way to suppress the new page for these chapters?
> Thanks, Jeroen

Best wishes,
Taco

___
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: Chapters without new page

2023-09-15 Thread denis.maier
I thought there should be a setups key on \setupsectionblock, but apparently 
there isn’t. So, the example below does not work, but maybe it wouldn’t be too 
hard to add it…

Best,
Denis


\setuphead[chapter][page=yes]

\setupsectionblock[backmatter][setups={\setuphead[chapter][page=no]}]

\starttext

\chapter{One}
\input knuth

\chapter{Two}
\input ward


\startbackmatter
\chapter{Three}
\input knuth

\chapter{Four}
\input ward
\stopbackmatter
\stoptext


Von: Jeroen 
Gesendet: Donnerstag, 14. September 2023 23:50
An: mailing list for ConTeXt users 
Betreff: [NTG-context] Chapters without new page

In the \startbackmatter ... \stopbackmatter section i would like to have some 
chapters that are not automatically placed on a new page for the next chapter. 
Is there an easy way to suppress the new page for these chapters?
Thanks, Jeroen
___
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: streams reversed?

2023-09-14 Thread jbf
Bruce, that was kind of you to reply. I think we both know that the 
streams mechanism, while 'workable' for the most part, is still in need 
of refinement.


It is quite possible that what is causing my problem has less to do with 
'streams' per se, and more to do with the use of this mechanism in a 
'real book' using frontmatter, bodymatter etc. etc.


Since it would be too long and complicated an MWE to place here in the 
list to demonstrate my problem, I will send you the file separately so 
you can see the issue: effectively, the streams have worked for 
frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they 
are reversed. You will see that. I can't work out why, but you might be 
able to see what is causing that.


And of course, I have two other problems to work out before I could use 
this in a real production scenario: there is the one you have already 
alluded to of extra pages occasionally beforehand (hopefully easily 
solvable) but I can see another problem when the text is a lengthy 
one... and this is the result of synchronization: when one language (vi) 
takes up more space than the other (en), we get an awkward break at the 
end of the chapter in en, so that the last line can 'catch up' with the 
last paragraph (in vi). Maybe this one will be harder to solve!


Julian

On 14/9/23 20:14, Bruce Horrocks wrote:

On 13 Sep 2023, at 07:47, jbf  wrote:

When I come to bodymatter and Chapter 1, again it works, except that the 
positions of the languages are reversed, so I end up with vi on the left and en 
on the right. By Chapter 2 we are back to the correct position once more (en 
left and vi right).
I want to know why this is happening, and if I can prevent it happening.


I've modified the sample code you got from Wolfgang to include chapter headings 
and it all looks fine to me[1] - the red text is all on the right hand side and 
the greeen text is all on the left. If this doesn't help and you still have 
problems then you'll need to post a sample that actually shows the problem. I'm 
using ConTeXt  ver: 2023.09.04 19:15.

\starttext

\startoutputstream[one]
\startcolor[red]
\dorecurse{5}{\chapter{Stream One}
  \dorecurse{10}{\input knuth\par}
  }
\stopcolor
\stopoutputstream

\startoutputstream[two]
\startcolor[green]
\dorecurse{5}{\chapter{Stream Two}
  \dorecurse{10}{\input zapf\par}
  }
\stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
  {\ifvoid\scratchboxone
 \exitloop
   \else
 \setbox\scratchboxfour\vsplit\scratchboxone to \textheight
 \vbox to \vsize{\box\scratchboxfour\vss}%
 \setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight
 \vbox to \vsize{\box\scratchboxfive\vss}%
   \fi}

\stoptext


[1] Apart from unnecessary blank pages at the beginning but that's a different 
problem so I'm not addressing that for now.

—
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 / 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: streams reversed?

2023-09-14 Thread Bruce Horrocks
On 13 Sep 2023, at 07:47, jbf  wrote:
> 
> When I come to bodymatter and Chapter 1, again it works, except that the 
> positions of the languages are reversed, so I end up with vi on the left and 
> en on the right. By Chapter 2 we are back to the correct position once more 
> (en left and vi right).
> I want to know why this is happening, and if I can prevent it happening.


I've modified the sample code you got from Wolfgang to include chapter headings 
and it all looks fine to me[1] - the red text is all on the right hand side and 
the greeen text is all on the left. If this doesn't help and you still have 
problems then you'll need to post a sample that actually shows the problem. I'm 
using ConTeXt  ver: 2023.09.04 19:15.

\starttext

\startoutputstream[one]
   \startcolor[red]
   \dorecurse{5}{\chapter{Stream One}
 \dorecurse{10}{\input knuth\par}
 }
   \stopcolor
\stopoutputstream

\startoutputstream[two]
   \startcolor[green]
   \dorecurse{5}{\chapter{Stream Two}
 \dorecurse{10}{\input zapf\par}
 }
   \stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
 {\ifvoid\scratchboxone
\exitloop
  \else
\setbox\scratchboxfour\vsplit\scratchboxone to \textheight
\vbox to \vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight
\vbox to \vsize{\box\scratchboxfive\vss}%
  \fi}

\stoptext


[1] Apart from unnecessary blank pages at the beginning but that's a different 
problem so I'm not addressing that for now.

—
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 / 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: Using structureuservariables before the heading

2023-09-14 Thread Wolfgang Schuster

denis.ma...@unibe.ch schrieb am 12.09.2023 um 23:32:


You need a box to get the author on a separate line.

% \define[2]\ChapterCommand
%   {\vbox
%  {\structureuservariable{author}
%  \blank
%  #1\space#2}}

\starttexdefinition protected ChapterCommand #1#2
   \vbox\bgroup
     \structureuservariable{author}
     \blank
     #1\space#2
   \egroup
\stoptexdefinition

Thank you so much, Wolfgang!

Why do you need protected here? I’ve realized that \protected\def also 
helps a bit, but, of course, paragraph breaks are ignored there as well…


You probably haven't noticed it yet but unlike the other predefined 
layouts for sections you don't have to write "alternative=command" to 
use the layout which is passed to the command key.


To make this work ConTeXt has to check whether the argument of the 
command key is empty or not but this is problematic when you pass 
commands with arguments.


When you try to example below you can see that the first definition of 
\Mycommand fails because \edef\CheckMycommand tries to expand its 
argument which causes problems because \Mycommand tries to read the 
following argument. To solve this problem you can use the \protected 
modifier when you create \Mycommand.


\starttext

\def\Mycommand#1{#1}% fails
%\protected\def\Mycommand#1{#1}% works

\edef\CheckMycommand{\Mycommand}
\ifempty\CheckMycommand
   \tex{Mycommand} is empty
\else
   \tex{Mycommand} has content
\fi

\stoptext



If just found the following in the lowlevel-macros manual:

«Traditional TEX has three prefixes that can be used with macros: 
\global, \outer and \long. The last two are no-op's in LuaMetaTEX and if 
you want to know what they do (did) you can look it up in the TEXbook.»


So, \long is gone, but why is that? Is there a new mechanism that serves 
the same purpose? Other than using a vbox, I mean…


The purpose of the \long modifier is to specify whether the argument of 
a command can or cannot contain multiple paragraph (either by an empty 
line or with \par). This was needed by TeX in the early days where 
memory was limited but not on the current machines.


For a very long time ConTeXt made each command definition long by 
default (i.e. \def\...{...} behaved the same way as \long\def\...{...}) 
and as a result \long was dropped.


\def\CommandA#1{#1}

\long\def\CommandB#1{#1}

\starttext

\CommandA{xxx}% works

\CommandA{xxx

yyy}% fails because you have a empty line in the argument

\CommandA{xxx\par yyy}%fails because you have \par in the argument

\CommandB{xxx\par yyy}% works because \CommandB is \long

\stoptext

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: tiffs: autoconversion via graphicsmagick produces invalid pdfs

2023-09-13 Thread denis.maier
Ok, I've found a solution.

%
\enabletrackers[graphics.conversion]

\startluacode
local function convert(oldname, newname)
os.execute(string.format(
'gm convert "%s" "%s"', oldname, newname)
)
end

-- Set the PDF, JPEG and default TIFF converters to the above function.
figures.converters.tif.pdf = convert
figures.converters.tif.jpg = convert
figures.converters.tif.default = convert
\stopluacode

\setfigureconversion[tif][jpg] % has no effect

\starttext

\externalfigure[test.tif][conversion=jpg]

\stoptext
%%%

Would it make sense to add
tifconverter.pdf = converter
to grph-con.lua (line 293) ?

Why is it that \setfigureconversion has no effect? Without conversion=jpg on 
\externalfigure, ConTeXt insists on converting to PDF. (I couldn't find the 
command in the sources, but I'm not getting a undef'ed cs error either, so it 
must be defined somewhere...)

I've also found out I can use a custom command that calls \externalfigure with 
the right settings depending on the filetype:

%%%
\enabletrackers[graphics.conversion]

\startluacode
local function convert(oldname, newname)
os.execute(string.format(
'gm convert "%s" "%s"', oldname, newname)
)
end

-- Set the PDF and default TIFF converters to the above function.
figures.converters.tif.pdf = convert
figures.converters.tif.jpg = convert
figures.converters.tif.default = convert
\stopluacode

\setfigureconversion[tif][jpg] % has no effect

\defineexternalfigure[tif][conversion=jpg]

\starttexdefinition includegraphics #1
  \splitfilename{#1}

  \processaction[\splitofftype][
tif=>{\externalfigure[#1][tif]},
default=>{\externalfigure[#1]},
unknown=>{\externalfigure[#1]}
  ]
\stoptexdefinition

\starttext

\includegraphics{test.tif} % will be converted to jpg

\externalfigure[test.tif] % will be converted to pdf

\stoptext


But I think it would be nicer to stick to the default \externalfigure.

Best,
Denis

Von: denis.ma...@unibe.ch 
Gesendet: Dienstag, 12. September 2023 17:09
An: ntg-context@ntg.nl
Betreff: [NTG-context] Re: tiffs: autoconversion via graphicsmagick produces 
invalid pdfs

Sorry, that was too quick...

Hi,

currently, ConTeXt can't use tiffs directly, but it uses Graphicsmagick to 
convert tiffs to pdf on the fly. However, as it seems, graphicsmagick is 
producing invalid pdfs.

For every included tiff I have something like this in the log:
luatex warning  > pdfe: invalid 11 0 R object at offset 573751
luatex warning  > pdfe: invalid 11 0 R object at offset 629127

The offsets are different, but it's always this .

This bug has been known for quite some time, but it apparently hasn't been 
fixed yet: https://sourceforge.net/p/graphicsmagick/bugs/513/

Converting the tiffs to jpeg circumvents the problem. Would it be an option to 
convert tiffs to jpegs instead of to pdf? (Is that already possible?)

Best,
Denis



Von: denis.ma...@unibe.ch<mailto:denis.ma...@unibe.ch> 
mailto:denis.ma...@unibe.ch>>
Gesendet: Dienstag, 12. September 2023 17:03
An: ntg-context@ntg.nl<mailto:ntg-context@ntg.nl>
Betreff: [NTG-context] tiffs: autoconversion via graphicsmagick produces 
invalid pdfs

Hi,

currently, ConTeXt can't use tiffs directly, but it uses
___
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] My example, with \blackrule, works perfect

2023-09-13 Thread Ursula Hermann
Dear List,
I just finished my example, did some changes today and it works perfect
\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\}\blackrule[color=black, height=0.05ex, width=4cm]
\starttext
\margintext{2.1.1}\
{Ach ist das schön, dass du da bist.}
\stoptext

Uschi
___
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] streams reversed?

2023-09-13 Thread jbf
I am making some progress with a bilingual text using the streams 
mechanism suggested by Wolfgang: https://wiki.contextgarden.net/Columns, 
but see below.


The aim has been to have en and vi on facing pages (en left, vi right).

It works correctly for the Foreword in two languages (en, vi) in 
frontmatter.


When I come to bodymatter and Chapter 1, again it works, except that the 
positions of the languages are reversed, so I end up with vi on the left 
and en on the right. By Chapter 2 we are back to the correct position 
once more (en left and vi right).


I want to know why this is happening, and if I can prevent it happening.

I am using the code you can see below, except that instead of 
\startoutputstream[one] and \startoutputstream[two] etc.  I am using 
[en-front][vi-front], and then in bodymatter [en-chap1][vi-chap1] etc. 
etc. with the relevant repetitions of these identifiers where needed. I 
assume that to get a degree of synchronization I need to use this 
approach for each set of chapters. But I cannot understand why the 
languages alternate their starting page positions each chapter.


There are other issues I have to solve, but first of all I wish to 
resolve this one.


Julian


The original (Wolfgang) code is as follows:

\starttext

\startoutputstream[one]
   \startcolor[red]
   \dorecurse{10}{\input  knuth\par}
   \stopcolor
\stopoutputstream

\startoutputstream[two]
   \startcolor[green]
   \dorecurse{10}{\input  zapf\par}
   \stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
 {\ifvoid\scratchboxone
\exitloop
  \else
\setbox\scratchboxfour\vsplit\scratchboxone  to\textheight
\vbox  to\vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo  to\textheight
\vbox  to\vsize{\box\scratchboxfive\vss}%
  \fi}

\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: Using structureuservariables before the heading

2023-09-12 Thread Wolfgang Schuster

denis.ma...@unibe.ch schrieb am 12.09.2023 um 21:38:


*Von:*Wolfgang Schuster 
*Gesendet:* Dienstag, 12. September 2023 21:30
*An:* Maier, Denis Christian (UB) 
*Cc:* ntg-context@ntg.nl
*Betreff:* Re: [NTG-context] Using structureuservariables before the 
heading


denis.ma...@unibe.ch <mailto:denis.ma...@unibe.ch> schrieb am 
12.09.2023 um 21:24:


*Von:*Wolfgang Schuster 
<mailto:wolfgang.schuster.li...@gmail.com>
*Gesendet:* Dienstag, 12. September 2023 20:41
*An:* mailing list for ConTeXt users 
<mailto:ntg-context@ntg.nl>; Maier, Denis Christian (UB)
 <mailto:denis.ma...@unibe.ch>
*Betreff:* Re: [NTG-context] Using structureuservariables before
the heading

denis.ma...@unibe.ch <mailto:denis.ma...@unibe.ch> schrieb am
12.09.2023 um 17:47:


Hi,

is it possible to access a structureuservariable before the
heading’s title ?

Using the «before» key does not seem to work.


There are ways but not in a general way because you try to access
the values
before they are known to ConTeXt. To provide a proper solution you
have
to tell what you're trying to achieve.

I’m just trying to output the author’s name above a chapter
heading. Do you need more information?


You can create a custom header for the chapter page and show the value 
of the author key
which works without problems because the header is added after to the 
finished page

after the value is available.

Another option when the name should appear in the same space as the 
chapter title

is a custom layout for the title.

Yes, I’ve tried that in the original MWE:

%%

\setuphead[chapter][

    before={Before: \structureuservariable{author}\blank},

    beforesection={Beforesection: \structureuservariable{author}\blank},

    insidesection={Insidesection: \structureuservariable{author}\blank},

    after={After: \structureuservariable{author}\blank},

    ]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}

\define[2]\myChapterCommand{\structureuservariable{author}\blank 
#1\space#2}


%\def\myChapterCommand#1#2{\structureuservariable{author}\blank 
#1\space#2} % does not work


% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, 
but at least blanks should work


%   \structureuservariable{author}

%   Test

%   \blank

%   #1\space#2

% \stoptexdefinition

\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]

\input knuth

\stopchapter

\startchapter[title=Second][author=Second Author]

\input knuth

\stopchapter

\setuphead[chapter]

    [

    before=,after=,beforesection=,insidesection=,

    command=\myChapterCommand,

]

\startchapter[title=Third][author={Third Author}]

\input knuth

\stopchapter

\stoptext

%%

Here, I’m getting «Third author» just before «3 Third». So I guess 
this goes in the right direction, but \define doesn’t allow for blanks 
etc. \starttexdefinition and \def on the other hand gave me erros.




You need a box to get the author on a separate line.

% \define[2]\ChapterCommand
%   {\vbox
%  {\structureuservariable{author}
%  \blank
%  #1\space#2}}

\starttexdefinition protected ChapterCommand #1#2
  \vbox\bgroup
    \structureuservariable{author}
    \blank
    #1\space#2
  \egroup
\stoptexdefinition

\setuphead
  [chapter]
  [command=\ChapterCommand]

\starttext

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter

\stoptext

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: Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Von: Wolfgang Schuster 
Gesendet: Dienstag, 12. September 2023 21:30
An: Maier, Denis Christian (UB) 
Cc: ntg-context@ntg.nl
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch<mailto:denis.ma...@unibe.ch> schrieb am 12.09.2023 um 
21:24:


Von: Wolfgang Schuster 
<mailto:wolfgang.schuster.li...@gmail.com>
Gesendet: Dienstag, 12. September 2023 20:41
An: mailing list for ConTeXt users 
<mailto:ntg-context@ntg.nl>; Maier, Denis Christian (UB) 
<mailto:denis.ma...@unibe.ch>
Betreff: Re: [NTG-context] Using structureuservariables before the heading

denis.ma...@unibe.ch<mailto:denis.ma...@unibe.ch> schrieb am 12.09.2023 um 
17:47:


Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

There are ways but not in a general way because you try to access the values
before they are known to ConTeXt. To provide a proper solution you have
to tell what you're trying to achieve.

I'm just trying to output the author's name above a chapter heading. Do you 
need more information?

You can create a custom header for the chapter page and show the value of the 
author key
which works without problems because the header is added after to the finished 
page
after the value is available.

Another option when the name should appear in the same space as the chapter 
title
is a custom layout for the title.
Yes, I've tried that in the original MWE:

%%
\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, but at 
least blanks should work
%   \structureuservariable{author}
%   Test
%   \blank
%   #1\space#2
% \stoptexdefinition

\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter

\stoptext
%%

Here, I'm getting  just before <3 Third>. So I guess this goes in 
the right direction, but \define doesn't allow for blanks etc. 
\starttexdefinition and \def on the other hand gave me erros.

Denis

___
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: Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Ok, \starttexdefinition allows blanks, apparently just like setups.
But, it still fails exactly like the version with \def


\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

% \starttexdefinition myChapterCommand #1 #2 % doesn't work either, but at 
least blanks should work
%   \structureuservariable{author}
%   Test
%   \blank
%   #1\space#2
% \stoptexdefinition


\starttext

\myChapterCommand{1}{asdf}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author={Third Author}]
\input knuth
\stopchapter


\stoptext

Von: denis.ma...@unibe.ch 
Gesendet: Dienstag, 12. September 2023 17:48
An: ntg-context@ntg.nl
Betreff: [NTG-context] Using structureuservariables before the heading

Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

As an aside, I've tried to use the < command > key to provide my own command, 
but while \define works here (but ignores \blank), \def gives me an error.
Why is that?
How would you add blanks to a user-defined command?

Best,
Denis



\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

\starttext
\macro{1}{2}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author=Third Author]
\input knuth
\stopchapter


\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] Using structureuservariables before the heading

2023-09-12 Thread denis.maier
Hi,

is it possible to access a structureuservariable before the heading's title ?
Using the  key does not seem to work.

As an aside, I've tried to use the < command > key to provide my own command, 
but while \define works here (but ignores \blank), \def gives me an error.
Why is that?
How would you add blanks to a user-defined command?

Best,
Denis



\setuphead[chapter][
before={Before: \structureuservariable{author}\blank},
beforesection={Beforesection: \structureuservariable{author}\blank},
insidesection={Insidesection: \structureuservariable{author}\blank},
after={After: \structureuservariable{author}\blank},
]

\def\myChapterCommand#1#2{\structureuservariable{author}\space\blank}
\define[2]\myChapterCommand{\structureuservariable{author}\blank #1\space#2}
%\def\myChapterCommand#1#2{\structureuservariable{author}\blank #1\space#2} % 
does not work

\starttext
\macro{1}{2}

\startchapter[title=First][author=First Author]
\input knuth
\stopchapter

\startchapter[title=Second][author=Second Author]
\input knuth
\stopchapter

\setuphead[chapter]
[
before=,after=,beforesection=,insidesection=,
command=\myChapterCommand,
]

\startchapter[title=Third][author=Third Author]
\input knuth
\stopchapter


\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: \dontleavethemode

2023-09-12 Thread Wolfgang Schuster

Ursula Hermann schrieb am 12.09.2023 um 11:19:


Dear List,

I have done an little example with a \blackrule:

\setuppapersize[A8,landscape]

\setuplayout[leftmargin=2.5cm,

leftmargindistance=0.2cm,

backspace=2.9cm,

width=4cm]

\starttext

\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm]


\startformula

a^n + b^n = c^n.

\stopformula

\stoptext

My Question is , where to put margintext, with \dontleavethemode, with 
blackrule, because if I put it after \starttext:


\margintext{\blackrule\\{Me}}\dontleavehmode\blackrule

Before :

\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm] there 
is no pdf after compiling.


[...]



\margintext{\blackrule\\{Me}}\dontleavethemode

\blackrule

[...]

The control sequence at the end of the top line of your error message 
was never


\def'ed. You can just continue as I'll forget about whatever was 
undefined.


mtx-context | fatal error: return code: 1



You get a error message because you have a spelling error in the name of 
the \dontleavehmode command.


You wrote "dontleave*the*mode" but the correct name "dontleave*h*mode".

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] \dontleavethemode

2023-09-12 Thread Ursula Hermann
Dear List,

I have done an little example with a \blackrule:

\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\starttext
\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm]
\startformula
a^n + b^n = c^n.
\stopformula
\stoptext

My Question is , where to put margintext, with \dontleavethemode, with 
blackrule, because if I put it after \starttext:
\margintext{\blackrule\\{Me}}\dontleavehmode\blackrule
Before :
\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm] there is no 
pdf after compiling.

I get:
Command Line:   context.exe --synctex=-1 "pablo.tex"
Startup Folder: 
C:\Users\Hermann\Downloads\context-mswin\tex\texmf-context\tex\context\test\mkiv


resolvers   | formats | executing runner 'run luametatex format': 
luametatex --jobname="./pablo.tex" --socket --shell-escape 
--fmt=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./pablo.tex" --c:input="./pablo.tex" 
--c:kindofrun=1 --c:maxnofruns=9 --c:synctex="-1" 
--c:texmfbinpath="C:/Users/Hermann/Downloads/context-mswin/tex/texmf-mswin/bin"
system  >
system  > ConTeXt  ver: 2023.09.03 19:03 LMTX  fmt: 2023.9.4  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './pablo', input './pablo.tex', result 
'./pablo'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
open source > level 1, order 2, name './pablo.tex'
modules > using user prefixed file 's-layout-show'
modules > 's-layout-show' is loaded
open source > level 2, order 3, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/modules/mkxl/s-layout-show.mkxl'
loading > ConTeXt Page Macros / Runtime Macros
resolvers   > lua > loading file 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkiv/page-run.lua'
 succeeded
close source> level 2, order 3, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/modules/mkxl/s-layout-show.mkxl'
fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
pack quality> underfull hbox at line 7 in file './pablo.tex':  (badness 
1490)
pack quality> underfull hbox at line 7 in file './pablo.tex': Me (badness 
1448)
tex error   > tex error on line 7 in file ./pablo.tex: Undefined control 
sequence


\margintext{\blackrule\\{Me}}\dontleavethemode
\blackrule

1 \setuppapersize[A8,landscape]
2 \setuplayout[leftmargin=2.5cm,
3  leftmargindistance=0.5cm,
4  backspace=2.9cm,
5  width=4cm]
6 \showframe
7 >>  \margintext{\blackrule\\{Me}}\dontleavethemode\blackrule
8 margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\Me}\blackrule[color=black, height=0.05ex, width=4cm]
9 \starttext
10 \startformula
11 a^n + b^n = c^n.
12 \stopformula
13 \stoptext
The control sequence at the end of the top line of your error message was never
\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 1


_

ConTeXt Compilation Report (Pages: 0)

Errors: 0   Warnings: 0   Bad Boxes: 0

Thanks
Uschi




blackrule1.pdf
Description: blackrule1.pdf
___
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: XML: flush to lua function

2023-09-12 Thread Taco Hoekwater
Hi,

xml.text(t) is safer than directly accessing t.dt[1].

Note: you may need to strip some XML tags from that content. 

If the element is not straight-up data but has nested elements, then this will 
return the full xml representation instead:

 A short title=> ‘A short title'
 A short title=> ‘'
 A short title => 'A short 
title'


Best wishes,
Taco

> On 12 Sep 2023, at 08:56,   wrote:
> 
> Ok, I’ve found a way, see below.
> But maybe someone has some nice lua (or other) tricks to share… (I’m not sure 
> accessing t.dt[1] is particularly safe when operating on nested structures.)
>  Best,
> Denis
>  \startbuffer[test]
> 
> 
> 
> A short title
> asdf asdf asdf jklö jklö jklö
>   
>   
> A longer title bla bla bla bla bla bla bla bla
> 
> asdf asdf asdf jklö jklö jklö
> 
>   
> 
> \stopbuffer
>  \startxmlsetups xml:test
> \xmlsetsetup{#1}{*}{-}
> \xmlsetsetup{#1}{doc|chapter|p}{xml:*}
> \stopxmlsetups
>  \xmlregisterdocumentsetup{test}{xml:test}
>  \startxmlsetups xml:doc
>\xmlflush{#1}
> \stopxmlsetups
>  \setuphead[chapter][expansion=yes] % make sure the stuff gets expanded on 
> time
> \startxmlsetups xml:chapter
> \startchapter
>[
>
> title={\xmlfilter{#1}{/title/command(xml:chapter:title)}},
>
> marking={\xmlfilter{#1}{/title/command(xml:chapter:title:marking)}},
>]
>\xmlflush{#1}
> \stopchapter
> \stopxmlsetups
>  \startxmlsetups xml:p
> \xmlflush{#1}\par
> \stopxmlsetups
>  \startluacode
> function xml.functions.getMarking(t)
> _,n = t.dt[1]:gsub("%S+","")
> if n > 10 then   local words = {} 
>   for word in t.dt[1]:gmatch("%S+") do table.insert(words, word) end
>   local resWords = {}
>   resWords =  { unpack( words, 1, 7 ) }
>   res = table.concat(resWords, " ") .. " …"
> else   res = t.dt[1]
> end
> context(res)
> end
> \stopluacode
>  \startxmlsetups xml:chapter:title:marking
> \xmlfunction{#1}{getMarking}
> \stopxmlsetups
>  \startxmlsetups xml:chapter:title
> \xmlflush{#1}
> \stopxmlsetups
>   \setupheadertexts[chapter]
>  \starttext
>  \xmlprocessbuffer{test}{test}{}
>  \stoptext
>   Von: denis.ma...@unibe.ch  
> Gesendet: Montag, 11. September 2023 16:47
> An: ntg-context@ntg.nl
> Betreff: [NTG-context] XML: flush to lua function
>  Hi,
> I have the following xml setup with a lua function:
>  \startluacode
> function markingLength(s)
> _,n = s:gsub("%S+","")
> if n > 3 then context("yes" .. " …") else 
> context("no") end
> end
> \stopluacode
>  \startxmlsetups xml:ink:ink-title:marking
> %\ctxlua{markingLength(\xmlflush{#1})}  % does not work
> \ctxlua{markingLength{"1 2 3 4"}}
> \stopxmlsetups
>  While the function works, I cannot use xmlflush here. How can I properly 
> pass the xml content to the lua function?
>  Best,
> Denis
> ___
> 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
> ___


— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


___
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: XML: flush to lua function

2023-09-12 Thread denis.maier
Ok, I've found a way, see below.
But maybe someone has some nice lua (or other) tricks to share... (I'm not sure 
accessing t.dt[1] is particularly safe when operating on nested structures.)

Best,
Denis

\startbuffer[test]



A short title
asdf asdf asdf jklö jklö jklö
  
  
A longer title bla bla bla bla bla bla bla bla

asdf asdf asdf jklö jklö jklö

  

\stopbuffer

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|chapter|p}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:doc
   \xmlflush{#1}
\stopxmlsetups

\setuphead[chapter][expansion=yes] % make sure the stuff gets expanded on time
\startxmlsetups xml:chapter
\startchapter
   [
   
title={\xmlfilter{#1}{/title/command(xml:chapter:title)}},
   
marking={\xmlfilter{#1}{/title/command(xml:chapter:title:marking)}},
   ]
   \xmlflush{#1}
\stopchapter
\stopxmlsetups

\startxmlsetups xml:p
\xmlflush{#1}\par
\stopxmlsetups

\startluacode
function xml.functions.getMarking(t)
_,n = t.dt[1]:gsub("%S+","")
if n > 10 then
  local words = {}
  for word in t.dt[1]:gmatch("%S+") do table.insert(words, 
word) end
  local resWords = {}
  resWords =  { unpack( words, 1, 7 ) }
  res = table.concat(resWords, " ") .. " ..."
else
  res = t.dt[1]
end
context(res)
end
\stopluacode

\startxmlsetups xml:chapter:title:marking
\xmlfunction{#1}{getMarking}
\stopxmlsetups

\startxmlsetups xml:chapter:title
\xmlflush{#1}
\stopxmlsetups


\setupheadertexts[chapter]

\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext


Von: denis.ma...@unibe.ch 
Gesendet: Montag, 11. September 2023 16:47
An: ntg-context@ntg.nl
Betreff: [NTG-context] XML: flush to lua function

Hi,
I have the following xml setup with a lua function:

\startluacode
function markingLength(s)
_,n = s:gsub("%S+","")
if n > 3 then
context("yes" .. " ...") else context("no") end
end
\stopluacode

\startxmlsetups xml:ink:ink-title:marking
%\ctxlua{markingLength(\xmlflush{#1})}  % does not work
\ctxlua{markingLength{"1 2 3 4"}}
\stopxmlsetups

While the function works, I cannot use xmlflush here. How can I properly pass 
the xml content to the lua function?

Best,
Denis
___
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: Reduce space between lines in Natural Tables

2023-09-11 Thread Wolfgang Schuster

Jeroen schrieb am 10.09.2023 um 22:05:
Is there an easy way to reduce the line space between rows in a 
natural table so the table takes less vertical space.


Natural tables and extreme tables take extra vertical space because the 
table cell use the framed-mechanism
which add a small margin on all sides, to get rid of this space set the 
offset value to 0pt. A unwanted side
effect when you set the offset to 0pt is that you no longer have a 
distance between each row, to get the space
between the columns back you can either use the loffset and roffset keys 
(when you have visible border)

or the columndistance key (when you have invisible borders).

% Alternative 1:
% \setupTABLE[frame=on,offset=0pt,columndistance=1em]

% Alternative 2:
\setupTABLE [frame=off,offset=0pt,loffset=.5em,roffset=.5em]
\setupTABLE [column] [first] [loffset=0pt]
\setupTABLE [column] [last]  [roffset=0pt]

\starttext

\bTABLE
   \bTR
  \bTD Cell 1:1 \eTD
  \bTD Cell 1:2 \eTD
  \bTD Cell 1:3 \eTD
   \eTR
   \bTR
  \bTD Cell 2:1 \eTD
  \bTD Cell 2:2 \eTD
  \bTD Cell 2:3 \eTD
   \eTR
   \bTR
  \bTD Cell 3:1 \eTD
  \bTD Cell 3:2 \eTD
  \bTD Cell 3:3 \eTD
   \eTR
\eTABLE

\stoptext

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-10 Thread Jim
Hi Lutz,

thanks very much for that example, it does show me a way to answer my
question.  Although the messages from Wolfgang had already solved my
problem, your solution in instructional in a different way, and so quite
helpful.

Cheers.

Jim

On Sat, Sep  9, 2023 at 21:38 (+0200), Lutz Haseloff wrote:

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

___
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 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] 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] Text runs out of Verbatim Frame

2023-09-08 Thread Jeroen
I am using the following to print some verbatim text in a frame. At the
right side, it keeps running out of the frame, is there a way to prevent
this with the MWE? This verbatim frame always is textwidth, is there a way
for a single frame just for if the situation asks for it to have it only
have a frame half pagewidth, like a width=0.5\textwidth

Thanks
Jeroen


\unprotect

\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]}]

\protect

\starttext
\startListing
test test test test test test test test test test test test test test test
test test test test test test test test
\stopListing
\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: # verbatim typesetting

2023-09-07 Thread Marcus Vinicius Mesquita
Dear Hans,

Thank you for your detailed answer. I'll wait then the next upload.

Kind regards

Marcus Vinicius

On Thu, Sep 7, 2023 at 2:36 PM Hans Hagen via ntg-context
 wrote:
>
> On 9/7/2023 2:47 PM, Marcus Vinicius Mesquita wrote:
> > Dear List,
> >
> > The MWE below gives a pdf with two #'s instead of only one. Why is that?
> >
> > \starttext
> >
> > \startluacode
> >  context.type("#")
> > \stopluacode
> >
> > \stoptext
> because by default tex loves to duplicate hashes when it serializes
> token lists
>
> as this seems to be "the month of the duplicate hashes" i looked it what
> we did so far can also work here and i sort of managed although there
> might be more cases (when im done with this we probably "have it the
> other way around" which could mean adapting some code in the tex-lua
> context system that actually depends on duplication or where we work
> around it and no longer need to)
>
> the complication is mostly in moving token lists around, them beign
> serialized and deserialized etc but i guesa at some point we'll get
> there (original tex doesn't really have this problem because there
> serialization hashes will triggere errors in cases where they are not
> permitted anyway)
>
> no upload as i need to test more
>
> Hans
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> 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
> ___



-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
corpo nem seus membros, por ser descanso da alma, primavera do
coração, distração do aflito, entretenimento do solitário, e viático
do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___
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: # verbatim typesetting

2023-09-07 Thread Hans Hagen via ntg-context

On 9/7/2023 2:47 PM, Marcus Vinicius Mesquita wrote:

Dear List,

The MWE below gives a pdf with two #'s instead of only one. Why is that?

\starttext

\startluacode
 context.type("#")
\stopluacode

\stoptext
because by default tex loves to duplicate hashes when it serializes 
token lists


as this seems to be "the month of the duplicate hashes" i looked it what 
we did so far can also work here and i sort of managed although there 
might be more cases (when im done with this we probably "have it the 
other way around" which could mean adapting some code in the tex-lua 
context system that actually depends on duplication or where we work 
around it and no longer need to)


the complication is mostly in moving token lists around, them beign 
serialized and deserialized etc but i guesa at some point we'll get 
there (original tex doesn't really have this problem because there 
serialization hashes will triggere errors in cases where they are not 
permitted anyway)


no upload as i need to test more

Hans

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

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

2023-09-07 Thread Marcus Vinicius Mesquita
Dear List,

The MWE below gives a pdf with two #'s instead of only one. Why is that?

\starttext

\startluacode
context.type("#")
\stopluacode

\stoptext

-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
corpo nem seus membros, por ser descanso da alma, primavera do
coração, distração do aflito, entretenimento do solitário, e viático
do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___
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: Vertical Space between Text and Itemize List

2023-09-06 Thread Mikael Sundqvist
Hi,

You can use before, inbetween and after.

\setupitemgroup
[itemize]
[inbetween={\blank[1cm]},
before={\blank[2cm]},
after={\blank[3cm]}]

\starttext

\samplefile{ward}

\startitemize
\dorecurse{4}{
\startitem
\samplefile{knuthmath}
\stopitem
}
\stopitemize

\samplefile{ward}

\stoptext

/Mikael

On Thu, Sep 7, 2023 at 12:57 AM Jeroen  wrote:
>
> To get a packed itemize list I use this in the preamble
>
> \setupitemgroup
>   [itemize]
>   [packed]
>
> To get less vspace between the text and the first item, i changed it to this
>
> \setupitemgroup
>   [itemize]
>   [packed,
>nowhite]
>
> now there is indeed no whitespace. Is there a more granular way to place just 
> a little vertical whitespace between the text and the first item?
> ___
> 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: XML, multiple spaces encoded as %20 get merged into one space

2023-09-06 Thread Hans Hagen via ntg-context

On 9/6/2023 4:59 PM, Pablo Rodriguez wrote:

On 9/6/23 12:28, denis.ma...@unibe.ch wrote:

Hi,

I have the example below that uses the three images in the attachment.
For some reason multiple spaces encoded as %20 get merged into a single %20.


Hi Denis,

this is standard TeX behavior (not only related to XML):

   \starttext
   \externalfigure[test  two spaces.pdf]
   \externalfigure[test  not two spaces.pdf]
   \stoptext

I don‘t know whether this is intended or not.

That being said, more than one consecutive space in a file name (I would
say it) is rather an exception than the rule.

Fixing this may cause more trouble that it might seem at first.
The problem with escaping is that there can be several round trips and 
it's kind of hard to predict usage and such. Also, take this:




Then, as i don't have these graphics, the test failed after a catch on 
the fact that tex didn't like the string for rendering in the 'unknown 
figure' drop in and after another catch the { } were not shown ...


Anyway, with a little magic i can now at least make this work but it 
needs testing with existing documents because it's not like we can 
update the xml stuff every thiem we have yet another exception (ok, 
those using sane image names are probably okay).


So, in a next update you can test some,

Hans


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

___
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: XML, multiple spaces encoded as %20 get merged into one space

2023-09-06 Thread Pablo Rodriguez
On 9/6/23 12:28, denis.ma...@unibe.ch wrote:
> Hi,
>
> I have the example below that uses the three images in the attachment.
> For some reason multiple spaces encoded as %20 get merged into a single %20.

Hi Denis,

this is standard TeX behavior (not only related to XML):

  \starttext
  \externalfigure[test  two spaces.pdf]
  \externalfigure[test  not two spaces.pdf]
  \stoptext

I don‘t know whether this is intended or not.

That being said, more than one consecutive space in a file name (I would
say it) is rather an exception than the rule.

Fixing this may cause more trouble that it might seem at first.

Best,

Pablo


___
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] XML, multiple spaces encoded as %20 get merged into one space

2023-09-06 Thread denis.maier
Hi,

I have the example below that uses the three images in the attachment.
For some reason multiple spaces encoded as %20 get merged into a single %20.

The first image () does not get included even though the 
name is correct.
The second image () gets included. Filename is correct.
The third image () gets included even though the actual 
file name does not contain two spaces (but @xlink:href does).

Any ideas what is going on here?

Then, in the case of the link, the two %20 end up as a single %20.

Best,
Denis

\setupinteraction[state=start]

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|fig}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:document
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:fig
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:graphic
  \externalfigure[\xmlfilter{#1}{./url('xlink:href')}]
\stopxmlsetups

\startxmlsetups xml:link
  https://uv-v4.netlify.app/\#?manifest=\xmlfilter{#1}{./url('xlink:href')}
\stopxmlsetups

\startxmlsetups xml:fig
\startplacefigure[title=Test]
\startalignment[center]
   \goto
   {\xmlfilter{#1}{/graphic/command(xml:graphic)}}
   [url(\xmlfilter{#1}{/link/command(xml:link)})]
\stopalignment
\stopplacefigure

\goto{test}[url(\xmlfilter{#1}{/link/command(xml:link)})]
\stopxmlsetups


\startbuffer[test]





https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>




https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>




https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>


\stopbuffer


\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext



test  two spaces.pdf
Description: test  two spaces.pdf


test one space.pdf
Description: test one space.pdf


test not two spaces.pdf
Description: test not two spaces.pdf
___
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] Fwd: escaping \ in Lua

2023-09-05 Thread Hans Hagen via ntg-context





 Forwarded Message 
Subject: Re: [NTG-context] escaping \ in Lua
Date: Tue, 5 Sep 2023 21:00:21 +0200
From: Hans Hagen 
To: Pablo Rodriguez 

On 9/5/2023 6:43 PM, Pablo Rodriguez wrote:

Dear list,

I have the following source:

   \setupinteraction[state=start, display=new]
   \enabledirectives[references.border=darkgreen]
   \starttext
   \startTEXpage[offset=1dk]
   \attachment[method=hidden, file=a(b).pdf]
   \stopTEXpage
   \stoptext

The name in EmbeddedFiles is "a\(b\).pdf".

Sorry for the obscure question, but how can I access this with
"\goto{link to external}[a(b).pdf]"?

I guess there may be some Lua magic, but I cannot write a proper
":gsub("%(", "%\%("))".

Many thanks for your help,

\goto{link to external}[file(a(b).pdf)]


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

___
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] escaping \ in Lua

2023-09-05 Thread Pablo Rodriguez
Dear list,

I have the following source:

  \setupinteraction[state=start, display=new]
  \enabledirectives[references.border=darkgreen]
  \starttext
  \startTEXpage[offset=1dk]
  \attachment[method=hidden, file=a(b).pdf]
  \stopTEXpage
  \stoptext

The name in EmbeddedFiles is "a\(b\).pdf".

Sorry for the obscure question, but how can I access this with
"\goto{link to external}[a(b).pdf]"?

I guess there may be some Lua magic, but I cannot write a proper
":gsub("%(", "%\%("))".

Many thanks for your help,

Pablo
___
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: out of order sectionsblocks

2023-09-05 Thread Hans Hagen via ntg-context

On 9/5/2023 4:06 AM, Rik Kabel wrote:

The following example generates a log file which begins with the line

    structure   > lists > out of order sectionsblocks, maybe use
    \setsectionblock

My larger document has over a hundred of these at the beginning.

    \setupnote [endnote] [location=none]
    \starttext
      \startbodymatter
       \startchapter[title={Body}]
        \startparagraph
         \input knuthmath
         \startendnote
         \input knuth-gpt
         \stopendnote
        \stopparagraph
       \stopchapter
      \stopbodymatter
      \startbackmatter
       \startchapter[title={Notes}]
        \placenotes [endnote]
       \stopchapter
      \stopbackmatter
    \stoptext

Can the message be suppressed? Is there a better way to set up the 
document to have endnotes for text in other-than-backmatter 
sectionblocks appear in the backmatter sectionblock?


i'll bring the mewssage under tracker control and assume that you will 
answer all questions wrt side effects (in this case probably harmless 
but who knows when there is a real messed up block order cq. multiple 
same blocks used)


Hans

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

___
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: Tikz calendar problem.

2023-09-05 Thread Fabrice L
Dear Aditya,

> Le 5 sept. 2023 à 04:21, Aditya Mahajan  a écrit :
> 
> On Mon, 4 Sep 2023, Fabrice L wrote:
> 
>> Dear list,
>> 
>> I have a problem with tikzCalendar on a recent installation. This minimal 
>> example :
>> 
>> 8< 
>> 
>> \usemodule[tikz]
>> \usetikzlibrary[calendar]
>> 
>> \starttext
>> This should works:
>> \blank
>> \tikz  \calendar[dates=2000-01-01 to 2000-01-31,week list];
>> \blank
>> but this does not !
>> \stoptext
>> 
>> 8< 
>> 
>> should work, but does not. The problem seems to be here:
>> 
>> open source > level 2, order 61, name 'tikzlibrarycalendar.code.tex'
>> modules > 'pgfcalendar' is not found
>> close source> level 2, order 61, name ‘tikzlibrarycalendar.code.tex'
>> 
>> The file « tikzlibrarycalendar.code.tex » is read, but the file « 
>> pgfcalendar » seems missing. I have reinstall a new standalone version of 
>> ConTeXt, with all the modules (with the new script from ConTeXt Garden), but 
>> nothing works. 
> 
> Here is what is going on:
> 
> `tikzlibrarycalendar.code.tex` contains the line:
> 
>  \pgfutil@usemodule{pgfcalendar}
> 
> In `generic/pgf/utilities/pgfutil-context.def`, \pgfutil@usemodule is defined 
> as:
> 
>  \def\pgfutil@usemodule#1{\usemodule[#1]}
> 
> which is supposed to load the file `plain/pgf/utilities/pgfcalendar.tex` 
> which just a wrapper to load `pgfcalendar.code.tex`:
> 
> 
>\edef\pgfcalendaratcode{\the\catcode`\@}
>\catcode`\@=11
> 
>\input pgfrcs.tex
>\input pgfcalendar.code.tex
> 
>\catcode`\@=\pgfcalendaratcode
> 
>\endinput
> 
> Now, the reason that this is not working is that the new module installer for 
> tikz removes all the files from `tex/plain`. It appears that tikz is at fault 
> here. If the file `pgfcalendar.tex` is supposed to used by both plain and 
> context, then it should be in `tex/generic` directory rather than `tex/plain` 
> directory. 
> 
> However, moving the file to `tex/generic` will not fix the issue directly 
> loading the above `pgfcalendar.code.tex` in context is surely going to fail 
> because of the manual catcode changes that are being done by pgfcalendar. 
> 
> So, I propose that we add a file `m-tikz-pgfcalendar.tex` as a wrapper around 
> `pgfcalendar.code.tex` and in `m-tikz.mk(xl|iv)` add
> 
> 
>  \definefilesynonym [pgfcalendar]  [tikz-pgfcalendar]
> 
> 
> I am attaching `m-tikz-calendar` which causes the original example to compile 
> (provided one adds the definefilesynonym before calling 
> \usetikzlibrary[calendar]). Can you please test if other features of 
> pgfcalendar are working with this file.
> 

This is working, thanks ! I tested some features of the calendar, and 
everything seems in order. I will continue today to work on this (a course 
syllabus).

> Aditya

Thanks again, you are a life saver ! 
Fabrice.


___
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: Tikz calendar problem.

2023-09-05 Thread Aditya Mahajan
On Mon, 4 Sep 2023, Fabrice L wrote:

> Dear list,
> 
> I have a problem with tikzCalendar on a recent installation. This minimal 
> example :
> 
> 8< 
> 
> \usemodule[tikz]
> \usetikzlibrary[calendar]
>  
> \starttext
> This should works:
> \blank
> \tikz  \calendar[dates=2000-01-01 to 2000-01-31,week list];
> \blank
> but this does not !
> \stoptext
> 
> 8< 
> 
> should work, but does not. The problem seems to be here:
> 
> open source > level 2, order 61, name 'tikzlibrarycalendar.code.tex'
> modules > 'pgfcalendar' is not found
> close source> level 2, order 61, name ‘tikzlibrarycalendar.code.tex'
> 
> The file « tikzlibrarycalendar.code.tex » is read, but the file « pgfcalendar 
> » seems missing. I have reinstall a new standalone version of ConTeXt, with 
> all the modules (with the new script from ConTeXt Garden), but nothing works. 

Here is what is going on:

`tikzlibrarycalendar.code.tex` contains the line:

  \pgfutil@usemodule{pgfcalendar}

In `generic/pgf/utilities/pgfutil-context.def`, \pgfutil@usemodule is defined 
as:

  \def\pgfutil@usemodule#1{\usemodule[#1]}

which is supposed to load the file `plain/pgf/utilities/pgfcalendar.tex` which 
just a wrapper to load `pgfcalendar.code.tex`:


\edef\pgfcalendaratcode{\the\catcode`\@}
\catcode`\@=11

\input pgfrcs.tex
\input pgfcalendar.code.tex

\catcode`\@=\pgfcalendaratcode

\endinput

Now, the reason that this is not working is that the new module installer for 
tikz removes all the files from `tex/plain`. It appears that tikz is at fault 
here. If the file `pgfcalendar.tex` is supposed to used by both plain and 
context, then it should be in `tex/generic` directory rather than `tex/plain` 
directory. 

However, moving the file to `tex/generic` will not fix the issue directly 
loading the above `pgfcalendar.code.tex` in context is surely going to fail 
because of the manual catcode changes that are being done by pgfcalendar. 

So, I propose that we add a file `m-tikz-pgfcalendar.tex` as a wrapper around 
`pgfcalendar.code.tex` and in `m-tikz.mk(xl|iv)` add


  \definefilesynonym [pgfcalendar]  [tikz-pgfcalendar]


I am attaching `m-tikz-calendar` which causes the original example to compile 
(provided one adds the definefilesynonym before calling 
\usetikzlibrary[calendar]). Can you please test if other features of 
pgfcalendar are working with this file.

Aditya



m-tikz-calendar.tex
Description: m-tikz-pgfcalendar.tex
___
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] (no subject)

2023-09-05 Thread Ursula Hermann
Dear List,

After compiling the following example, which is from February 2021:
\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\showframe
\starttext
\margintext{\hairline\\{Me}}\dontleavehmode\hairline
\startformula
a^n + b^n = c^n.
\stopformula
\stoptext





I get:
Command Line:   context.exe --synctex=-1 "blackrule1.tex"
Startup Folder: \\ub.univie.ac.at\U_Dom\Users G-L\Hermann\Documents\Texlive


resolvers   | formats | executing runner 'run luametatex format': 
luametatex --jobname="./blackrule1.tex" --socket --shell-escape 
--fmt=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./blackrule1.tex" 
--c:input="./blackrule1.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:synctex="-1" 
--c:texmfbinpath="C:/Users/Hermann/Downloads/context-mswin/tex/texmf-mswin/bin"
"\\ub.univie.ac.at\U_Dom\Users G-L\Hermann\Documents\Texlive"
CMD.EXE wurde mit dem oben angegebenen Pfad als aktuellem Verzeichnis gestartet.
UNC-Pfade werden nicht untersttzt.
Stattdessen wird das Windows-Verzeichnis als aktuelles Verzeichnis gesetzt.
system  >
system  > ConTeXt  ver: 2023.09.03 19:03 LMTX  fmt: 2023.9.4  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './blackrule1', input './blackrule1.tex', 
result './blackrule1'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
runtime error : input file './blackrule1.tex' is not found, quitting
mtx-context | fatal error: return code: 1


_

ConTeXt Compilation Report (Pages: 0)

Errors: 0   Warnings: 0   Bad Boxes: 0
___
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] Tikz calendar problem.

2023-09-04 Thread Fabrice L
Dear list,

I have a problem with tikzCalendar on a recent installation. This minimal 
example :

8< 

\usemodule[tikz]
\usetikzlibrary[calendar]
 
\starttext
This should works:
\blank
\tikz  \calendar[dates=2000-01-01 to 2000-01-31,week list];
\blank
but this does not !
\stoptext

8< 

should work, but does not. The problem seems to be here:

open source > level 2, order 61, name 'tikzlibrarycalendar.code.tex'
modules > 'pgfcalendar' is not found
close source> level 2, order 61, name ‘tikzlibrarycalendar.code.tex'

The file « tikzlibrarycalendar.code.tex » is read, but the file « pgfcalendar » 
seems missing. I have reinstall a new standalone version of ConTeXt, with all 
the modules (with the new script from ConTeXt Garden), but nothing works. 


Thanks for any help,
Fabrice. ___
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] out of order sectionsblocks

2023-09-04 Thread Rik Kabel

The following example generates a log file which begins with the line

   structure   > lists > out of order sectionsblocks, maybe use
   \setsectionblock

My larger document has over a hundred of these at the beginning.

   \setupnote [endnote] [location=none]
   \starttext
 \startbodymatter
  \startchapter[title={Body}]
   \startparagraph
    \input knuthmath
    \startendnote
    \input knuth-gpt
    \stopendnote
   \stopparagraph
  \stopchapter
 \stopbodymatter
 \startbackmatter
  \startchapter[title={Notes}]
   \placenotes [endnote]
  \stopchapter
 \stopbackmatter
   \stoptext

Can the message be suppressed? Is there a better way to set up the 
document to have endnotes for text in other-than-backmatter 
sectionblocks appear in the backmatter sectionblock?


--
Rik
___
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: ifxmlselfempty

2023-09-04 Thread Hans van der Meer via ntg-context
I changed this in the source of lxml-ini.lua (line 225). It seems the 'not' has been accidentally crept in (from  copying that line in ifxmlempty, the item above?)Anyway, remade the format and now the result is as I expected it to be. See below in the output of the MWE from my first post on this subject. I added the relevant portion of the code for clarity.I am sure the next update will reflect it in the source ;-)dr. Hans van der Meer   implement {        name      = "ifxmlselfempty",        public    = true,        usage     = "condition",        arguments = "argument",        actions   = function(id)--            return boolean_code, not checkedempty(getid(id)) and true            return boolean_code, checkedempty(getid(id)) and true        end    }

xmlsetup-template.pdf
Description: Adobe PDF document
On 4 Sep 2023, at 10:05, denis.ma...@unibe.ch wrote:IDK. But why do have a setup for , which does not appear in your xml source (shouldn’t it be ?)?  Von: Hans van der Meer via ntg-context <ntg-context@ntg.nl> Gesendet: Sonntag, 3. September 2023 14:11An: NTG ConTeXt <ntg-context@ntg.nl>Cc: Hans van der Meer <havdm...@ziggo.nl>Betreff: [NTG-context] ifxmlselfempty Is it possible that  the new \ifxmlselfempty has reversed its outcome? Or did I something wrong in this MWE?Here an MWE. yours sincerelydr. Hans van der Meer   \startbuffer[test]!not empty node!\stopbuffer \startxmlsetups xml:mysetups   \xmlsetsetup{\xmldocument}{something|emptynode|notemptynode}{xml:*}\stopxmlsetups \xmlregistersetup{xml:mysetups} \startxmlsetups xml:emptynodenode=\xmltag{#1}:\crlfifxmlselfempty-else-fi:\space\ifxmlselfempty{#1}attribute = \xmlatt{#1}{value}\elsecontent = \xmlflush{#1}\fi\crlfifxmlselfempty-else-fi reversed:\space\ifxmlselfempty{#1}content = \xmlflush{#1}\elseattribute = \xmlatt{#1}{value}\fi\blank\stopxmlsetups \startxmlsetups xml:notemptynodenode=\xmltag{#1}:\crlfifxmlselfempty-else-fi:\space\ifxmlselfempty{#1}attribute = \xmlatt{#1}{value}\elsecontent = \xmlflush{#1}\fi\crlfifxmlselfempty-else-fi reversed:\space\ifxmlselfempty{#1}content = \xmlflush{#1}\elseattribute = \xmlatt{#1}{value}\fi\blank\stopxmlsetups \startxmlsetups xml:something\xmlall{#1}{./emptynode}\blank\xmlall{#1}{./notemptynode}\blank\stopxmlsetups \starttext\ConTeXt\ \contextversion\blank   \xmlprocessbuffer{main}{test}{}\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: no packed in current latest (LMTX only)

2023-09-04 Thread Hans Hagen via ntg-context

On 9/4/2023 6:12 PM, Pablo Rodriguez wrote:

Dear list,

after updating to current latest (from 2023.09.03 19:03), packed list
doesn’t seem to work in LMTX:

   \starttext
   \startTEXpage[offset=1em]
   \startitemize[packed]
   \item item
   \item item
   \stopitemize
   \stopTEXpage
   \stoptext

MkIV gets packed lists just right.

Could anyone confirm this?

Many thanks for your help,
hm, accidently removed line ... (there have been some 'additions' to 
itemize wrt tabulated items which makes things even more complex)


Hans


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

___
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: no packed in current latest (LMTX only)

2023-09-04 Thread Rik Kabel


On 9/4/2023 12:12 PM, Pablo Rodriguez wrote:

Dear list,

after updating to current latest (from 2023.09.03 19:03), packed list
doesn’t seem to work in LMTX:

   \starttext
   \startTEXpage[offset=1em]
   \startitemize[packed]
   \item item
   \item item
   \stopitemize
   \stopTEXpage
   \stoptext

MkIV gets packed lists just right.

Could anyone confirm this?

Many thanks for your help,

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



I can confirm the problem.

--
Rik
___
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] no packed in current latest (LMTX only)

2023-09-04 Thread Pablo Rodriguez
Dear list,

after updating to current latest (from 2023.09.03 19:03), packed list
doesn’t seem to work in LMTX:

  \starttext
  \startTEXpage[offset=1em]
  \startitemize[packed]
  \item item
  \item item
  \stopitemize
  \stopTEXpage
  \stoptext

MkIV gets packed lists just right.

Could anyone confirm this?

Many thanks for your help,

Pablo
___
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: Trimming (rearranging) long section name

2023-09-04 Thread Lukas via ntg-context

Hello,

On 2023-09-04 12:06, Wolfgang Schuster wrote:

\mainlanguage[cz]

\setuphead
  [section]
  [distance=1.25em,
   style=\bfc,
   align={flushleft,broad,nothyphenated}]


that's it, thank you!

Lukas


\setupbodyfont[8pt]

\starttext

\chapter{Dummy}

\samplefile{lorem}

\section{Specifické požadavky pro předpokládanou technologii stavby 
(přístupy, přívody el. energie, skladovací plochy, montážní a pomocné 
plochy, montážní a pomocné konstrukce, ...)}


\stoptext

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: Different Layout for First Page

2023-09-04 Thread Wolfgang Schuster

Jeroen schrieb am 04.09.2023 um 14:10:
I have a document with the first page in startfrontmatter and all 
other pages in  startbodymatter. The layout setting is as following


[...]

What would be the easiest way to change the layout only for the first 
page since it has no footer. For the first page, I would like to have 
the text run all the way to the bottom with \vfill where normally the 
footer would be.


You need the two settings

\setupheader[state=high]
\setupfooter[state=high]

to get rid of the header and footer on the page where the commands take 
effect.


The nice thing is that both values are reset on the following page and 
with \startsectionblockenvironment

you can make this layout change in the style file of your document.

\startsectionblockenvironment[frontpart]
\setupheader[state=high]
\setupfooter[state=high]
\stopsectionblockenvironment

\showframe

\starttext

\startfrontmatter
\samplefile{lorem}
\stopfrontmatter

\startbodymatter
\dorecurse{10}{\samplefile{lorem}}
\stopbodymatter

\stoptext

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: Trimming (rearranging) long section name

2023-09-04 Thread Wolfgang Schuster

Lukas via ntg-context schrieb am 04.09.2023 um 13:33:

Hello,

just

"
\setuphead[section][distance=1.25em]
\setuphead[section][style=\bfc]
"

Lukas


On 2023-09-04 11:25, Henning Hraban Ramm wrote:

Am 04.09.23 um 13:06 schrieb Lukas via ntg-context:

IOW to force the word "stavby" not to cross the right border (see the
green vertical line) but to appear on the next line?

I played with "strict", "verytolerant" and similar options but they 
seem

not to affect section titles.


What’s your section setup, esp. the align settings?


Please try to provide a *working* minimal example the next time, 
otherwise we have

to fill the missing parts (\starttext ... \stoptext).

\mainlanguage[cz]

\setuphead
  [section]
  [distance=1.25em,
   style=\bfc,
   align={flushleft,broad,nothyphenated}]

\setupbodyfont[8pt]

\starttext

\chapter{Dummy}

\samplefile{lorem}

\section{Specifické požadavky pro předpokládanou technologii stavby 
(přístupy, přívody el. energie, skladovací plochy, montážní a pomocné 
plochy, montážní a pomocné konstrukce, ...)}


\stoptext

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] After compiling

2023-09-04 Thread Ursula Hermann
There is no pdf to read.
Uschi Hermann.
Sorry, dindn't write my name in the first Mail Today.


Von: Ursula Hermann
Gesendet: Montag, 04. September 2023 11:44
An: 'ntg-context@ntg.nl' mailto:ntg-context@ntg.nl>>
Betreff:

Dear List,

After compiling the following example, which is from February 2021:
\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\showframe
\starttext
\margintext{\hairline\\{Me}}\dontleavehmode\hairline
\startformula
a^n + b^n = c^n.
\stopformula
\stoptext





I get:
Command Line:   context.exe --synctex=-1 "blackrule1.tex"
Startup Folder: 
\\ub.univie.ac.at\U_Dom\Users 
G-L\Hermann\Documents\Texlive


resolvers   | formats | executing runner 'run luametatex format': 
luametatex --jobname="./blackrule1.tex" --socket --shell-escape 
--fmt=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./blackrule1.tex" 
--c:input="./blackrule1.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:synctex="-1" 
--c:texmfbinpath="C:/Users/Hermann/Downloads/context-mswin/tex/texmf-mswin/bin"
"\\ub.univie.ac.at\U_Dom\Users 
G-L\Hermann\Documents\Texlive"
CMD.EXE wurde mit dem oben angegebenen Pfad als aktuellem Verzeichnis gestartet.
UNC-Pfade werden nicht untersttzt.
Stattdessen wird das Windows-Verzeichnis als aktuelles Verzeichnis gesetzt.
system  >
system  > ConTeXt  ver: 2023.09.03 19:03 LMTX  fmt: 2023.9.4  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './blackrule1', input './blackrule1.tex', 
result './blackrule1'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
runtime error : input file './blackrule1.tex' is not found, quitting
mtx-context | fatal error: return code: 1

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

2023-09-04 Thread Ursula Hermann
There is no pdf to read.
Uschi Hermann.
Sorry, dindn't write my name in the first Mail Today.


Von: Ursula Hermann
Gesendet: Montag, 04. September 2023 11:44
An: 'ntg-context@ntg.nl' 
Betreff:

Dear List,

After compiling the following example, which is from February 2021:
\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\showframe
\starttext
\margintext{\hairline\\{Me}}\dontleavehmode\hairline
\startformula
a^n + b^n = c^n.
\stopformula
\stoptext





I get:
Command Line:   context.exe --synctex=-1 "blackrule1.tex"
Startup Folder: 
\\ub.univie.ac.at\U_Dom\Users 
G-L\Hermann\Documents\Texlive


resolvers   | formats | executing runner 'run luametatex format': 
luametatex --jobname="./blackrule1.tex" --socket --shell-escape 
--fmt=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=C:/Users/Hermann/Downloads/context-mswin/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./blackrule1.tex" 
--c:input="./blackrule1.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:synctex="-1" 
--c:texmfbinpath="C:/Users/Hermann/Downloads/context-mswin/tex/texmf-mswin/bin"
"\\ub.univie.ac.at\U_Dom\Users 
G-L\Hermann\Documents\Texlive"
CMD.EXE wurde mit dem oben angegebenen Pfad als aktuellem Verzeichnis gestartet.
UNC-Pfade werden nicht untersttzt.
Stattdessen wird das Windows-Verzeichnis als aktuelles Verzeichnis gesetzt.
system  >
system  > ConTeXt  ver: 2023.09.03 19:03 LMTX  fmt: 2023.9.4  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'C:/Users/Hermann/Downloads/context-mswin/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './blackrule1', input './blackrule1.tex', 
result './blackrule1'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
runtime error : input file './blackrule1.tex' is not found, quitting
mtx-context | fatal error: return code: 1


_

ConTeXt Compilation Report (Pages: 0)

Errors: 0   Warnings: 0   Bad Boxes: 0
___
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: Bug or feature? \numexpression and hashes

2023-09-04 Thread Hans Hagen via ntg-context

On 9/4/2023 8:17 AM, Jairo A. del Rio wrote:

Hi, list. The following fails with a "Missing number, treated as zero"
error prompt:

\starttext
\expandedrepeat2{\expandedrepeat2{\the\numexpression#I+#P\relax\ }}
\stoptext

OTOH, \numexpr works seamlessly. Tested on ConTeXt 2023.09.03 19:03. Thanks
in advance.
bug or feature: just something not done yet (there are probably a few 
more places) ... i added it (no upload)


Hans

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

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

2023-09-04 Thread denis.maier
IDK. But why do have a setup for , which does not appear in your xml 
source (shouldn't it be ?)?


Von: Hans van der Meer via ntg-context 
Gesendet: Sonntag, 3. September 2023 14:11
An: NTG ConTeXt 
Cc: Hans van der Meer 
Betreff: [NTG-context] ifxmlselfempty

Is it possible that  the new \ifxmlselfempty has reversed its outcome? Or did I 
something wrong in this MWE?
Here an MWE.

yours sincerely
dr. Hans van der Meer



\startbuffer[test]


!not empty node!

\stopbuffer

\startxmlsetups xml:mysetups
   \xmlsetsetup{\xmldocument}{something|emptynode|notemptynode}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:mysetups}

\startxmlsetups xml:emptynode
node=\xmltag{#1}:\crlf
ifxmlselfempty-else-fi:\space
\ifxmlselfempty{#1}
attribute = \xmlatt{#1}{value}
\else
content = \xmlflush{#1}
\fi
\crlf
ifxmlselfempty-else-fi reversed:\space
\ifxmlselfempty{#1}
content = \xmlflush{#1}
\else
attribute = \xmlatt{#1}{value}
\fi
\blank
\stopxmlsetups

\startxmlsetups xml:notemptynode
node=\xmltag{#1}:\crlf
ifxmlselfempty-else-fi:\space
\ifxmlselfempty{#1}
attribute = \xmlatt{#1}{value}
\else
content = \xmlflush{#1}
\fi
\crlf
ifxmlselfempty-else-fi reversed:\space
\ifxmlselfempty{#1}
content = \xmlflush{#1}
\else
attribute = \xmlatt{#1}{value}
\fi
\blank
\stopxmlsetups

\startxmlsetups xml:something
\xmlall{#1}{./emptynode}\blank
\xmlall{#1}{./notemptynode}\blank
\stopxmlsetups

\starttext
\ConTeXt\ \contextversion\blank
   \xmlprocessbuffer{main}{test}{}
\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: TOC with sections titles and page numbers like a paragraph beneath chapter

2023-09-04 Thread Wolfgang Schuster

jbf schrieb am 04.09.2023 um 08:34:


I am attempting to get a TOC that looks like the following (in other 
words with section titles and their relative page numbers in a block 
below the chapter):


Chapter 1 ...5

Section 1   5, Section 2  6, Section 3  7,

Section 4   8, Section 5   9 etc

Chapter 2 10

Section 1   10, Section 2  11, Section 3  12,

Section 4   13, Section 5   14 etc

As I really had no idea how to do this, I found 
https://wiki.contextgarden.net/Horizontal_Table_of_Contents thinking 
it might help, but none of it compiles (for me) in LMTX. So I tried 
something different, e.g.


[...]

While that produces a result, it is nothing like what I want above. 
Has anyone put together a TOC of this kind and might be able to give 
me a hint to follow?




Please send *working* (which include some dummy content) examples.

The example below results in section entries which are listed as a 
paragraph, what output do you expect here.


\setuplist[chapter][alternative=c]
\setuplist[section][alternative=d]

\starttext

\completecontent

\dorecurse{2}
  {\chapter{Chapter #1}
   \dorecurse{10}{\section{Section ##1}}}

\stoptext

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] Bug or feature? \numexpression and hashes

2023-09-04 Thread Jairo A. del Rio
Hi, list. The following fails with a "Missing number, treated as zero"
error prompt:

\starttext
\expandedrepeat2{\expandedrepeat2{\the\numexpression#I+#P\relax\ }}
\stoptext

OTOH, \numexpr works seamlessly. Tested on ConTeXt 2023.09.03 19:03. Thanks
in advance.

Best regards,

Jairo
___
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: (feature proposal) link to attachments: /GoToE

2023-09-03 Thread Pablo Rodriguez
On 9/3/23 16:02, Henning Hraban Ramm wrote:
> Am 03.09.23 um 13:03 schrieb Pablo Rodriguez:
> [...]
> While I don’t know what’s missing under the hood, I think there’s just a
> “reference” key missing in \attachment or \setupattachment:

Many thanks for your reply, Hraban.

I’m afraid that \in{attachment}[foobar] doesn‘t generate a link in your
sample.

Or do you get a link border from the following source?

  \setupinteraction[state=start]
  \enabledirectives[references.border=green]
  \starttext
  \startTEXpage[offset=1em]

  \attachment[
 file={hacker.jpg},
 method=hidden,
 reference=foobar,
  ]
  \goto{Link to attachment}[foobar]
  \stopTEXpage
  \stoptext

Many thanks for your help,

Pablo
___
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: (feature proposal) link to attachments: /GoToE

2023-09-03 Thread Henning Hraban Ramm

Am 03.09.23 um 13:03 schrieb Pablo Rodriguez:

On 9/3/23 12:46, Hans Hagen wrote:

On 9/3/2023 12:17 PM, Pablo Rodriguez wrote:

[...]
This basic implementation of GoToE links would be extremely helpful to
access embedded documents (believe it or not, this is something I
explain almost every week at work).

I would be happy to provide the code to implement this, but I’m
afraid this is way beyond my knowledge.

remind me in a month or so ... i'm not going to touch that part of the
code now (some other priorities)


Perfectly fine for me, Hans.


While I don’t know what’s missing under the hood, I think there’s just a 
“reference” key missing in \attachment or \setupattachment:



\setupinteraction[state=start]

\starttext

\samplefile{lorem}

\attachment[
  file={hacker.jpg},
  title={Hacker},
  symbol=Paperclip,
  author=Hans,
  location=inmargin,
  reference=foobar,
]

As you can see in \in{attachment}[foobar], we’re hacking away …

\stoptext


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
___

[NTG-context] ifxmlselfempty

2023-09-03 Thread Hans van der Meer via ntg-context
Is it possible that  the new \ifxmlselfempty has reversed its outcome? Or did I something wrong in this MWE?Here an MWE.
yours sincerelydr. Hans van der Meer






xmlsetup-template.pdf
Description: Adobe PDF document
\startbuffer[test]!not empty node!\stopbuffer\startxmlsetups xml:mysetups   \xmlsetsetup{\xmldocument}{something|emptynode|notemptynode}{xml:*}\stopxmlsetups\xmlregistersetup{xml:mysetups}\startxmlsetups xml:emptynodenode=\xmltag{#1}:\crlfifxmlselfempty-else-fi:\space\ifxmlselfempty{#1}	attribute = \xmlatt{#1}{value}\else	content = \xmlflush{#1}\fi\crlfifxmlselfempty-else-fi reversed:\space\ifxmlselfempty{#1}	content = \xmlflush{#1}\else	attribute = \xmlatt{#1}{value}\fi\blank\stopxmlsetups\startxmlsetups xml:notemptynodenode=\xmltag{#1}:\crlfifxmlselfempty-else-fi:\space\ifxmlselfempty{#1}	attribute = \xmlatt{#1}{value}\else	content = \xmlflush{#1}\fi\crlfifxmlselfempty-else-fi reversed:\space\ifxmlselfempty{#1}	content = \xmlflush{#1}\else	attribute = \xmlatt{#1}{value}\fi\blank\stopxmlsetups\startxmlsetups xml:something\xmlall{#1}{./emptynode}\blank\xmlall{#1}{./notemptynode}\blank\stopxmlsetups\starttext\ConTeXt\ \contextversion\blank   \xmlprocessbuffer{main}{test}{}\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: slanted font feature: LMTX vs. MkIV

2023-09-02 Thread Pablo Rodriguez
On 9/2/23 12:18, Wolfgang Schuster wrote:
> Hans Hagen schrieb am 02.09.2023 um 11:53:
> [...]
>> in lpdf-lmt.lmt you can try:
>>
>> l 593
>>
>> tmsy = tmsy * sc
>>
>> l 610
>>
>> tmsy = tmsy * f_y_scale
>
> I get now with LMTX the same output as I get with MkIV, the slant stays
> the same for all sizes.

This works also perfectly fine for me now.

Many thanks for the fix and the help, Hans and Wolfgang.

Sorry, but I don‘t know why this doesn‘t get the slanted font as bold (I
know I should know better, but I‘m stuck at this):

  \definefontfamily[mainface][rm][DejaVu Sans]
   [sl≃style:bf]
  \setupbodyfont
   [mainface, 100pt]
  \starttext
  \startTEXpage[offset=1ex]
  a {\em b}
  \stopTEXpage
  \stoptext

Many thanks for your help again,

Pablo
___
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: slanted font feature: LMTX vs. MkIV

2023-09-02 Thread Wolfgang Schuster

Hans Hagen schrieb am 02.09.2023 um 11:53:

On 9/2/2023 11:45 AM, Wolfgang Schuster wrote:

Pablo Rodriguez schrieb am 02.09.2023 um 10:25:

Dear list,

I have the following sample (using current latest from 2023.08.27 
13:48):


   \setupinteractionscreen[option=max]
   \definefontfamily[maf][rm][DejaVu Sans]
 [sl={style:tf, features:{default,slanted}}]
   \setupbodyfont[maf, 8pt]
   \setupfittingpage[offset=1ex]
   \starttext
   \startTEXpage
   a {\em b}
   \stopTEXpage
   \startTEXpage[foregroundstyle={\setupbodyfont[100pt]}]
   a {\em b}
   \stopTEXpage
   \stoptext

Using LMTX higher font size gives less slanted text (or not at all).

Using MkIV text is slanted fine, independent from font size.

Could anyone confirm the issue?


I can confirm the slant decreases at larger font sizes.

\starttext

\dostepwiserecurse{10}{100}{1}
{{\switchtobodyfont[#1pt]#1pt:\definedfont[Serif*slanted]\vrule\relax 
S\vrule\relax lanted}\par}


\stoptext

in lpdf-lmt.lmt you can try:

l 593

tmsy = tmsy * sc

l 610

tmsy = tmsy * f_y_scale


I get now with LMTX the same output as I get with MkIV, the slant stays 
the same for all sizes.


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: slanted font feature: LMTX vs. MkIV

2023-09-02 Thread Hans Hagen

On 9/2/2023 11:45 AM, Wolfgang Schuster wrote:

Pablo Rodriguez schrieb am 02.09.2023 um 10:25:

Dear list,

I have the following sample (using current latest from 2023.08.27 13:48):

   \setupinteractionscreen[option=max]
   \definefontfamily[maf][rm][DejaVu Sans]
 [sl={style:tf, features:{default,slanted}}]
   \setupbodyfont[maf, 8pt]
   \setupfittingpage[offset=1ex]
   \starttext
   \startTEXpage
   a {\em b}
   \stopTEXpage
   \startTEXpage[foregroundstyle={\setupbodyfont[100pt]}]
   a {\em b}
   \stopTEXpage
   \stoptext

Using LMTX higher font size gives less slanted text (or not at all).

Using MkIV text is slanted fine, independent from font size.

Could anyone confirm the issue?


I can confirm the slant decreases at larger font sizes.

\starttext

\dostepwiserecurse{10}{100}{1}
   {{\switchtobodyfont[#1pt]#1pt:\definedfont[Serif*slanted]\vrule\relax 
S\vrule\relax lanted}\par}


\stoptext

in lpdf-lmt.lmt you can try:

l 593

tmsy = tmsy * sc

l 610

tmsy = tmsy * f_y_scale

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

___
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: slanted font feature: LMTX vs. MkIV

2023-09-02 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 02.09.2023 um 10:25:

Dear list,

I have the following sample (using current latest from 2023.08.27 13:48):

   \setupinteractionscreen[option=max]
   \definefontfamily[maf][rm][DejaVu Sans]
 [sl={style:tf, features:{default,slanted}}]
   \setupbodyfont[maf, 8pt]
   \setupfittingpage[offset=1ex]
   \starttext
   \startTEXpage
   a {\em b}
   \stopTEXpage
   \startTEXpage[foregroundstyle={\setupbodyfont[100pt]}]
   a {\em b}
   \stopTEXpage
   \stoptext

Using LMTX higher font size gives less slanted text (or not at all).

Using MkIV text is slanted fine, independent from font size.

Could anyone confirm the issue?


I can confirm the slant decreases at larger font sizes.

\starttext

\dostepwiserecurse{10}{100}{1}
  {{\switchtobodyfont[#1pt]#1pt:\definedfont[Serif*slanted]\vrule\relax 
S\vrule\relax lanted}\par}


\stoptext

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] slanted font feature: LMTX vs. MkIV

2023-09-02 Thread Pablo Rodriguez
Dear list,

I have the following sample (using current latest from 2023.08.27 13:48):

  \setupinteractionscreen[option=max]
  \definefontfamily[maf][rm][DejaVu Sans]
[sl={style:tf, features:{default,slanted}}]
  \setupbodyfont[maf, 8pt]
  \setupfittingpage[offset=1ex]
  \starttext
  \startTEXpage
  a {\em b}
  \stopTEXpage
  \startTEXpage[foregroundstyle={\setupbodyfont[100pt]}]
  a {\em b}
  \stopTEXpage
  \stoptext

Using LMTX higher font size gives less slanted text (or not at all).

Using MkIV text is slanted fine, independent from font size.

Could anyone confirm the issue?

Many thanks for your help,

Pablo
___
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] Fwd: Kerning feature not working

2023-08-30 Thread Hans Hagen




 Forwarded Message 
Subject: Re: [NTG-context] Kerning feature not working
Date: Wed, 30 Aug 2023 22:17:43 +0200
From: Hans Hagen 
To: Marcus Vinicius Mesquita 

On 8/30/2023 9:37 PM, Marcus Vinicius Mesquita wrote:

Dear List

In the MWE below, the kerning feature works OK for ebgaramonditalic
but not for ebgaramondregular.
How do I fix it?

I'm using ConTeXt version: 2023.08.27 13:48


\startluacode
 fonts.handlers.otf.addfeature {
 name = "kernit",
 type = "kern",
nocheck = true,
 data = {
   [0x27E8] = { ["f"] = 300, ["fi"] = 300, ["fl"] = 300 }
 }
 }
\stopluacode


you need to know the code points and eb garamond is not so predictable 
(welcome to fonts ...)


\startluacode
fonts.handlers.otf.addfeature {
name = "kernit",
type = "kern",
 nocheck = true,
data = {
  [0x27E8] = {
["f"]= 300,
["f_l"]  = 300,
["f_i"]  = 300,
[0xFB01] = 300,
[0xFB02] = 300,
    }
}
}
\stopluacode


\definefontfeature[kernit][mode=node,kernit=yes]

\starttext
\definedfont[name:ebgaramondregular*default,kernit]

⟨f ile

⟨f lame

⟨file

⟨flame

\definedfont[name:ebgaramonditalic*default,kernit]

⟨f ile

⟨f lame

⟨file

⟨flame

\stoptext
but easier is this (an old mechanism, maybe time for an upgrade with 
merged vectors)


\definecharacterspacing [myspacing]

\setupcharacterspacing [myspacing] ["27E8] [right=0.25,alternative=1]
\setupcharacterspacing [myspacing] ["27E9] [left=0.25,alternative=1]

and then

\setcharacterspacing[myspacing]


Hans

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

___
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] Kerning feature not working

2023-08-30 Thread Marcus Vinicius Mesquita
Dear List

In the MWE below, the kerning feature works OK for ebgaramonditalic
but not for ebgaramondregular.
How do I fix it?

I'm using ConTeXt version: 2023.08.27 13:48


\startluacode
fonts.handlers.otf.addfeature {
name = "kernit",
type = "kern",
   nocheck = true,
data = {
  [0x27E8] = { ["f"] = 300, ["fi"] = 300, ["fl"] = 300 }
}
}
\stopluacode

\definefontfeature[kernit][mode=node,kernit=yes]

\starttext
\definedfont[name:ebgaramondregular*default,kernit]

⟨f ile

⟨f lame

⟨file

⟨flame

\definedfont[name:ebgaramonditalic*default,kernit]

⟨f ile

⟨f lame

⟨file

⟨flame

\stoptext


--
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
corpo nem seus membros, por ser descanso da alma, primavera do
coração, distração do aflito, entretenimento do solitário, e viático
do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
\startluacode
	fonts.handlers.otf.addfeature {
		name = "kernit",
		type = "kern",
   nocheck = true,
		data = {
 [0x27E8] = { ["f"] = 300, ["fi"] = 300, ["fl"] = 300 }
		}
	}
\stopluacode
\definefontfeature[kernit][mode=node,kernit=yes]

\starttext
\definedfont[name:ebgaramondregular*default,kernit]

⟨f ile

⟨f lame

⟨file

⟨flame

\definedfont[name:ebgaramonditalic*default,kernit]

⟨f ile

⟨f lame

⟨file

⟨flame

\stoptext


MWE.pdf
Description: Adobe PDF document
___
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: attribute selection

2023-08-30 Thread Hans van der Meer via ntg-context
Finally I saw the problem. Calling 
\xmlfilter{#1}{./node/command(demo:attribute:node)} is the right way.
Sorry for the noise.

dr. Hans van der Meer
> On 30 Aug 2023, at 13:49, Hans van der Meer via ntg-context 
>  wrote:
> 
> This line of code comes from the xml documentation (page 31):
> \xmlfilter{#1}{./node[@type=="cleanup"]}
> It should select among the 's those with .
> However, this node is not selected in the call to \xmlfilter.
> Where am I wrong?
> 
> MWE follows
> 
> 
> % failure to typeset attribute selected.
> \setuppapersize[A5][A5]
> \startxmlsetups demo:attribute
>   \xmlsetsetup{#1}{root|node}{demo:attribute:*}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{demo:attribute}
> \startxmlsetups demo:attribute:root
>   Execute \type{\xmlall{#1}{./node}}
>   \crlf
>   \xmlall{#1}{./node}
>   \crlf
>   Execute \type{\xmlfilter{#1}{./node[@type=="cleanup"]}}
>   \xmlfilter{#1}{./node[@type=="cleanup"]}
>   \crlf
> \stopxmlsetups
> \startxmlsetups demo:attribute:node
>   calling node <\xmltag{#1}>
>   \xmlflush{#1}
>   \crlf
> \stopxmlsetups
> \startbuffer[attribute]
> 
> no attribute
> attribute type = cleanup
> 
> \stopbuffer
> \startbuffer[attribute2]
> 
> no attribute
> attribute type=cleanup
> 
> \stopbuffer
> \starttext
> \ConTeXt\ version\contextversion\blank
> \xmlprocessbuffer{demo}{attribute}{}
> \stoptext
> 
> 
> 
> 
> Hans van der Meer
> ___
> 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] attribute selection

2023-08-30 Thread Hans van der Meer via ntg-context
This line of code comes from the xml documentation (page 31):
\xmlfilter{#1}{./node[@type=="cleanup"]}
It should select among the 's those with .
However, this node is not selected in the call to \xmlfilter.
Where am I wrong?

MWE follows


% failure to typeset attribute selected.
\setuppapersize[A5][A5]
\startxmlsetups demo:attribute
\xmlsetsetup{#1}{root|node}{demo:attribute:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:attribute}
\startxmlsetups demo:attribute:root
Execute \type{\xmlall{#1}{./node}}
\crlf
\xmlall{#1}{./node}
\crlf
Execute \type{\xmlfilter{#1}{./node[@type=="cleanup"]}}
\xmlfilter{#1}{./node[@type=="cleanup"]}
\crlf
\stopxmlsetups
\startxmlsetups demo:attribute:node
calling node <\xmltag{#1}>
\xmlflush{#1}
\crlf
\stopxmlsetups
\startbuffer[attribute]

no attribute
attribute type = cleanup

\stopbuffer
\startbuffer[attribute2]

no attribute
attribute type=cleanup

\stopbuffer
\starttext
\ConTeXt\ version\contextversion\blank
\xmlprocessbuffer{demo}{attribute}{}
\stoptext



xml-tex-attribute-select.pdf
Description: Adobe PDF document



Hans van der Meer
___
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: Bug between \definealternativestyle and makeup?

2023-08-27 Thread Alex Leray

Ouch, thanks for opening my eyes!

Le 27/08/23 à 21:42, Mikael Sundqvist a écrit :

Remove the period:

\definecharacterkerning [mykerning] [factor=0.15]
\definealternativestyle[mystyle][{\setcharacterkerning[mykerning]}]

\definemakeup [title] [doublesided=empty, pagestate=start]
\starttext
\starttitlemakeup
Title
\stoptitlemakeup
\stoptext

/Mikael

On Sun, Aug 27, 2023 at 9:32 PM Alex Leray  wrote:


Hi,

I found that using \definealternativestyle in conjunction with Makeup
insert a page before my Makeup page.

Any idea?

Thanks

* * *

\definecharacterkerning [mykerning] [factor=0.15]
\definealternativestyle[mystyle][{\setcharacterkerning[mykerning]}]. %%%
BUG!!!

\definemakeup [title] [doublesided=empty, pagestate=start]
\starttext
\starttitlemakeup
Title
\stoptitlemakeup
\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
___

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


--
Alexandre Leray
+32 487 947 030

Avez-vous pensé à (vous) offrir Médor ?
https://medor.coop/ideescadeau
___
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: Bug between \definealternativestyle and makeup?

2023-08-27 Thread Mikael Sundqvist
Remove the period:

\definecharacterkerning [mykerning] [factor=0.15]
\definealternativestyle[mystyle][{\setcharacterkerning[mykerning]}]

\definemakeup [title] [doublesided=empty, pagestate=start]
\starttext
\starttitlemakeup
Title
\stoptitlemakeup
\stoptext

/Mikael

On Sun, Aug 27, 2023 at 9:32 PM Alex Leray  wrote:
>
> Hi,
>
> I found that using \definealternativestyle in conjunction with Makeup
> insert a page before my Makeup page.
>
> Any idea?
>
> Thanks
>
> * * *
>
> \definecharacterkerning [mykerning] [factor=0.15]
> \definealternativestyle[mystyle][{\setcharacterkerning[mykerning]}]. %%%
> BUG!!!
>
> \definemakeup [title] [doublesided=empty, pagestate=start]
> \starttext
> \starttitlemakeup
> Title
> \stoptitlemakeup
> \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
> ___
___
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] Bug between \definealternativestyle and makeup?

2023-08-27 Thread Alex Leray

Hi,

I found that using \definealternativestyle in conjunction with Makeup 
insert a page before my Makeup page.


Any idea?

Thanks

* * *

\definecharacterkerning [mykerning] [factor=0.15]
\definealternativestyle[mystyle][{\setcharacterkerning[mykerning]}]. %%% 
BUG!!!


\definemakeup [title] [doublesided=empty, pagestate=start]
\starttext
\starttitlemakeup
Title
\stoptitlemakeup
\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: xmldoif: checking for contents of attribute

2023-08-25 Thread denis.maier
> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Freitag, 25. August 2023 09:06
> An: Maier, Denis Christian (UB) ; mailing list for
> ConTeXt users 
> Betreff: Re: [NTG-context] Re: xmldoif: checking for contents of attribute
> 
> On 8/25/2023 8:22 AM, denis.ma...@unibe.ch wrote:
> 
> > Thanks for your help. I can use that, but why is this sort of 
> > double-checking
> necessary here?
> 
> because containsa in a function that has checking while find is just the lua 
> find
> .. so i've added a check in that one too now but no upload
> 

So, that would mean that the double checking is only necessary for find, not 
for contains. And indeed the example below works.
Is that correct or are there any unwanted side-effects?

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:element
1 \xmldoifelse{#1}{.[contains(@class,'abc')]}{Yes}{No} \par
2 \xmldoifelse{#1}{.[@class and find(@class,'abc')]}{Yes}{No} \par % runs, but 
no match

\stopxmlsetups

\startxmlsetups xml:whatever
Yes
\stopxmlsetups

\startbuffer[test]


Yes
No

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\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] XML: Correct usage of hash symbol in url

2023-08-25 Thread denis.maier
Hi,

I need to process URLs in XML documents differently depending on the target. 
Thanks to Hans and Thomas I can now deal with the attributes.
Now I need to prefix certain kind of targets with a certain URL (a web viewer 
for IIIF images in this particular case). The prefix contains a #, which, as a 
special character seems to cause an error. Adding a double hash seems to work, 
but those ## will end up in the link URL. How can I properly escape a single #? 
I've already tried using \Ux{23}, but that won't work either.

Best,
Denis

\setupinteraction[state=start]

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startluacode
 function xml.finalizers.tex.url(e,a)
 local u = #e > 0 and e[1].at[a]
 local s = u and lpeg.match(lpeg.patterns.urlunescaper,u)
 context(s)
 end
\stopluacode

\startxmlsetups xml:element
\xmldoifelse{#1}{.[@href and contains(@href,'https://iiif.ub.unibe.ch')]}


{\goto{\xmlflush{#1}}[url(https://uv-v4.netlify.app/##?manifest=\xmlatt{#1}{href})]}
 % gives me two hashes in the Link


%{\goto{\xmlflush{#1}}[url(https://uv-v4.netlify.app/#?manifest=\xmlatt{#1}{xlink:href})]}
 \par % does not work

{\goto{\xmlflush{#1}}[url(\xmlatt{#1}{href})]}
\stopxmlsetups


\startbuffer[test]


https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20I%20104%20fol%20a1r;>IIIF-Link
https://wiki.contextgarden.net/;>Other Link

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\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: xmldoif: checking for contents of attribute

2023-08-25 Thread denis.maier
> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Donnerstag, 24. August 2023 16:54
> An: ntg-context@ntg.nl
> Betreff: [NTG-context] Re: xmldoif: checking for contents of attribute
> 
> On 8/24/2023 4:11 PM, denis.ma...@unibe.ch wrote:
> > Hi,
> >
> > I'm trying to check whether an attribute contains (or, actually starts 
> > with) a
> given string.


> \xmldoifelse{#1}{.[@class and contains(@class,'abc')]}{Yes}{No}
> \xmldoifelse{#1}{.[@class and find(@class,"abc")]}{Yes}{No}

Thanks for your help. I can use that, but why is this sort of double-checking 
necessary here?

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:element
1 \xmldoifelse{#1}{.[@class and contains(@class,'abc')]}{Yes}{No} \par
2 \xmldoifelse{#1}{.[@class and find(@class,"abc")]}{Yes}{No} \par
3 \xmldoifelse{#1}{.[True and contains(@class,'abc')]}{Yes}{No} \par % runs, 
but no match
4 \xmldoifelse{#1}{.[True and find(@class,"abc")]}{Yes}{No} \par % run, but no 
match
% 5 \xmldoifelse{#1}{.[contains(@class,'abc')]}{Yes}{No} \par % causes an error
% 6 \xmldoifelse{#1}{.[find(@class,"abc")]}{Yes}{No} \par % causes an error

\stopxmlsetups

\startxmlsetups xml:whatever
Yes
\stopxmlsetups

\startbuffer[test]


Yes
No

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\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: xmldoif: checking for contents of attribute

2023-08-24 Thread Hans Hagen

On 8/24/2023 4:11 PM, denis.ma...@unibe.ch wrote:

Hi,

I'm trying to check whether an attribute contains (or, actually starts with) a 
given string.
I've tried a whole bunch of different combinations, but I've had no luck so 
far. Minimal example below. Anyone has a hint?

Best,
Denis


%
\startxmlsetups xml:test
 \xmlsetsetup{#1}{*}{-}
 \xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}


\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:element
\xmlfilter{#1}{./find(attribute('class'), 'abc')/command(xml:whatever)}

\xmldoifelse{#1}{./attribute('class')/contains('abc')} {Yes}{No}
\stopxmlsetups

\startxmlsetups xml:whatever
Yes
\stopxmlsetups

\startbuffer[test]


Yes
No

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext

\xmldoifelse{#1}{.[@class and contains(@class,'abc')]}{Yes}{No}
\xmldoifelse{#1}{.[@class and find(@class,"abc")]}{Yes}{No}


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

___
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: xmldoif: checking for contents of attribute

2023-08-24 Thread Thomas A. Schmitz
One way would be to do the search in Lua; when you have multiple searches to 
perform, that may be the easiest way to go. For example:

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups
 
\xmlregisterdocumentsetup{test}{xml:test}
 
\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups
 
\startxmlsetups xml:element
 \xmlfunction {#1} {element}
\stopxmlsetups
 
\startluacode
function xml.functions.element (t)
 if t.at.class and t.at.class:find ("abc") then
context.startcolor { "blue" }
lxml.flush (t)
context.stopcolor ()
 else
context.startcolor { "red" }
lxml.flush (t)
context.stopcolor ()
 end
end
\stopluacode 
 
\startbuffer[test]


Yes
No

\stopbuffer
 
\starttext
 
\xmlprocessbuffer{test}{test}{}
 
\stoptext

Hope that gets you started.

Thomas

> On 24. Aug 2023, at 16:11, denis.ma...@unibe.ch wrote:
> 
> Hi,
>  I’m trying to check whether an attribute contains (or, actually starts with) 
> a given string.
> I’ve tried a whole bunch of different combinations, but I’ve had no luck so 
> far. Minimal example below. Anyone has a hint?
>  Best,
> Denis
>   %
> \startxmlsetups xml:test
> \xmlsetsetup{#1}{*}{-}
> \xmlsetsetup{#1}{doc|element}{xml:*} \stopxmlsetups
>  \xmlregisterdocumentsetup{test}{xml:test}
>   \startxmlsetups xml:doc
> \xmlflush{#1}
> \stopxmlsetups
>  \startxmlsetups xml:element
> \xmlfilter{#1}{./find(attribute('class'), 'abc')/command(xml:whatever)}
>  \xmldoifelse{#1}{./attribute('class')/contains('abc')} {Yes}{No}
> \stopxmlsetups
>  \startxmlsetups xml:whatever
> Yes
> \stopxmlsetups
>  \startbuffer[test]
> 
> 
> Yes
> No
> 
> \stopbuffer
>  \starttext
>  \xmlprocessbuffer{test}{test}{}
>  \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] xmldoif: checking for contents of attribute

2023-08-24 Thread denis.maier
Hi,

I'm trying to check whether an attribute contains (or, actually starts with) a 
given string.
I've tried a whole bunch of different combinations, but I've had no luck so 
far. Minimal example below. Anyone has a hint?

Best,
Denis


%
\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}


\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:element
\xmlfilter{#1}{./find(attribute('class'), 'abc')/command(xml:whatever)}

\xmldoifelse{#1}{./attribute('class')/contains('abc')} {Yes}{No}
\stopxmlsetups

\startxmlsetups xml:whatever
Yes
\stopxmlsetups

\startbuffer[test]


Yes
No

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\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: Question about building an array of values with Lua

2023-08-24 Thread Fabrice Couvreur
Hi Otared and Wolgang,
Thanks for the answers. In fact, being familiar with Python and not at all
with Lua, I didn't have the reflex to think of using a mathematical
function which gives the remainder in the Euclidean division by 10, it's
strange !!
Fabrice

Le jeu. 24 août 2023 à 04:06, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Otared Kavian schrieb am 24.08.2023 um 01:04:
>
> Hi Fabrice,
>
> As Wolfgang points out, it is indeed possible to fill-in your table with
> Lua: maybe you were wondering how to fill the columns 2, 3 and 4. In this
> case you need to use the Lua function math.mod as in the following, which
> is a completed version of what Wolfgang sent:
>
>
> I guess I completely missed the units digit part :)
>
> %% begin filling-with-lua.tex
> \starttext
>
> \startluacode
> context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor =
> "black" }
> context.startxrow{ background = "color", backgroundcolor = "lightgray"
> }
> context.startxcell{ nx = 4 }
> context("Units digit of")
> context.stopxcell()
> context.stopxrow()
> context.startxrow()
> context.startxcell{ width = "1cm" }
> context.im("a")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("a^2")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("b")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("2b^2")
> context.stopxcell()
> context.stopxrow()
> for i = 0,9 do
> context.startxrow()
> for j = 1,4 do
> context.startxcell()
> if j == 1 then
> context(i)
> elseif j == 2 then
> context(math.mod(i*i,10))
>  elseif j == 3 then
>   context(i)
>  else
>   context(math.mod(2*i*i,10))
> end
> context.stopxcell()
> end
> context.stopxrow()
> end
>
>
> I would drop the column check in this case.
>
> for i = 0,9 do
> context.startxrow()
> context.startxcell()
> context(i)
> context.stopxcell()
> context.startxcell()
> context(math.mod(i*i,10))
> context.stopxcell()
> context.startxcell()
> context(i)
> context.stopxcell()
> context.startxcell()
> context(math.mod(2*i*i,10))
> context.stopxcell()
> context.stopxrow()
> end
>
> 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
>
> ___
___
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: Question about building an array of values with Lua

2023-08-23 Thread Wolfgang Schuster

Otared Kavian schrieb am 24.08.2023 um 01:04:

Hi Fabrice,

As Wolfgang points out, it is indeed possible to fill-in your table 
with Lua: maybe you were wondering how to fill the columns 2, 3 and 4. 
In this case you need to use the Lua function math.mod as in the 
following, which is a completed version of what Wolfgang sent:


I guess I completely missed the units digit part :)


%% begin filling-with-lua.tex
\starttext

\startluacode
context.startxtable{ align = "middle,lohi", bodyfont = "9pt", 
framecolor = "black" }
    context.startxrow{ background = "color", backgroundcolor = 
"lightgray" }

        context.startxcell{ nx = 4 }
            context("Units digit of")
  context.stopxcell()
    context.stopxrow()
    context.startxrow()
context.startxcell{ width = "1cm" }
context.im("a")
        context.stopxcell()
        context.startxcell{ width = "1cm" }
          context.im("a^2")
context.stopxcell()
        context.startxcell{ width = "1cm" }
            context.im("b")
        context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("2b^2")
        context.stopxcell()
    context.stopxrow()
    for i = 0,9 do
        context.startxrow()
            for j = 1,4 do
                context.startxcell()
                    if j == 1 then
              context(i)
                    elseif j == 2 then
context(math.mod(i*i,10))
 elseif j == 3 then
context(i)
 else
context(math.mod(2*i*i,10))
                    end
context.stopxcell()
            end
        context.stopxrow()
    end


I would drop the column check in this case.

    for i = 0,9 do
    context.startxrow()
    context.startxcell()
    context(i)
    context.stopxcell()
    context.startxcell()
    context(math.mod(i*i,10))
    context.stopxcell()
    context.startxcell()
    context(i)
    context.stopxcell()
    context.startxcell()
    context(math.mod(2*i*i,10))
    context.stopxcell()
    context.stopxrow()
    end

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: Question about building an array of values with Lua

2023-08-23 Thread Otared Kavian
Hi Fabrice,

As Wolfgang points out, it is indeed possible to fill-in your table with Lua: 
maybe you were wondering how to fill the columns 2, 3 and 4. In this case you 
need to use the Lua function math.mod as in the following, which is a completed 
version of what Wolfgang sent:

%% begin filling-with-lua.tex
\starttext

\startluacode
context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor = 
"black" }
context.startxrow{ background = "color", backgroundcolor = "lightgray" }
context.startxcell{ nx = 4 }
context("Units digit of")
context.stopxcell()
context.stopxrow()
context.startxrow()
context.startxcell{ width = "1cm" }
context.im("a")
context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("a^2")
context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("b")
context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("2b^2")
context.stopxcell()
context.stopxrow()
for i = 0,9 do
context.startxrow()
for j = 1,4 do
context.startxcell()
if j == 1 then
context(i)
elseif j == 2 then
context(math.mod(i*i,10))
  elseif j == 3 then
context(i)
  else
context(math.mod(2*i*i,10))
end
context.stopxcell()
end
context.stopxrow()
end
context.stopxtable()
\stopluacode

\stoptext
%% end filling-with-lua.tex

Best regards: Otared

> On 23 Aug 2023, at 17:48, Wolfgang Schuster 
>  wrote:
> 
> Fabrice Couvreur schrieb am 23.08.2023 um 19:28:
>> Hi,
>> I'm trying to fill an array using lua. So far it works but then I don't know 
>> if it's possible.
> 
> Where do you have problems (look into cld-mkiv.pdf for hins)?
> 
> \starttext
> 
> \startluacode
> context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor = 
> "black" }
> context.startxrow{ background = "color", backgroundcolor = "lightgray" }
> context.startxcell{ nx = 4 }
> context("Units digit of")
> context.stopxcell()
> context.stopxrow()
> context.startxrow()
> context.startxcell{ width = "1cm" }
> context.im("a")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("a^2")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("b")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("2b^2")
> context.stopxcell()
> context.stopxrow()
> for i = 0,9 do
> context.startxrow()
> for j = 1,4 do
> context.startxcell()
> if j == 1 then
> context(i)
> end
> context.stopxcell()
> end
> context.stopxrow()
> end
> context.stopxtable()
> \stopluacode
> 
> \stoptext
> 
> 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
> ___

Otared Kavian
e-mail: ota...@gmail.com
Phone: +33 6 88 26 70 95




___
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: Question about building an array of values with Lua

2023-08-23 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 23.08.2023 um 19:28:

Hi,
I'm trying to fill an array using lua. So far it works but then I 
don't know if it's possible.


Where do you have problems (look into cld-mkiv.pdf for hins)?

\starttext

\startluacode
context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor 
= "black" }
    context.startxrow{ background = "color", backgroundcolor = 
"lightgray" }

    context.startxcell{ nx = 4 }
    context("Units digit of")
    context.stopxcell()
    context.stopxrow()
    context.startxrow()
    context.startxcell{ width = "1cm" }
    context.im("a")
    context.stopxcell()
    context.startxcell{ width = "1cm" }
    context.im("a^2")
    context.stopxcell()
    context.startxcell{ width = "1cm" }
    context.im("b")
    context.stopxcell()
    context.startxcell{ width = "1cm" }
    context.im("2b^2")
    context.stopxcell()
    context.stopxrow()
    for i = 0,9 do
    context.startxrow()
    for j = 1,4 do
    context.startxcell()
    if j == 1 then
    context(i)
    end
    context.stopxcell()
    end
    context.stopxrow()
    end
context.stopxtable()
\stopluacode

\stoptext

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: Better option for a macro with lots of arguments

2023-08-23 Thread Hans Hagen via ntg-context

On 8/23/2023 4:12 AM, Andres Conrado Montoya wrote:

I have been using the following macro to add a bunch of sections to the
start of chapters in a book, it works but I think is kind of weak:

%%%

\define[7]\metadatos{
   \startsection[title={Resumen}] #1 \stopsection
   \startsection[title={Palabras clave}] #2 \stopsection
   \start
   \language[en]
   \startsection[title={Abstract}] #3  \stopsection
   \startsection[title={Keywords}] #4 \stopsection
   \stop
   \startsection[title={¿Cómo citar este capítulo? / How to cite this book?}]
 \startsubsection[title={Apa}] #5 \stopsubsection
 \startsubsection[title={Chicago}] #6 \stopsubsection
 \startsubsection[title={MLA}] #7 \stopsubsection
\stopsection
}

\starttext
% Then I call the macro like this:
\metadatos{spanish abstract \input knuth}{some, comma, separated, keywords,
in, spanish}{english abstract \input knuth}{same, comma, separated,
keywords, in, english}{Apa citation style for this article}{Chicago
citation style for this article}{MLA citation style for this article}
\stoptext
%%%

I've been exploring different ways to do it better, but with not much luck,
I was thinking something based in key=value assignments? setups? datasets?
Not really sure, but If you know a better solution or point me in the
direction of something I can use to replace that macro, it would be greatly
appreciated.

\startsetups [document:start]
   \doifdocumentvariable {englishabstract} {
 \startsection[title={Resumen}]
   \documentvariable{englishabstract}
 \stopsection
   }
   \doifdocumentvariable {spanisabstract} {
 \startsection[title={Palabras clave}]
   \documentvariable{spanishabstract}
 \stopsection
   }
   ...
\stopsetups

\startbuffer english
   ...
\stopbuffer

\startbuffer spanish
   ...
\stopbuffer


\startsetups [document:stop]
   ...
\stopsetups


\startdocument
  [spanisabstract={\getbuffer[spanish]},
   ]

...

\stopdocument

untested, just keyed in


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

___
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] Better option for a macro with lots of arguments

2023-08-22 Thread Andres Conrado Montoya
I have been using the following macro to add a bunch of sections to the
start of chapters in a book, it works but I think is kind of weak:

%%%

\define[7]\metadatos{
  \startsection[title={Resumen}] #1 \stopsection
  \startsection[title={Palabras clave}] #2 \stopsection
  \start
  \language[en]
  \startsection[title={Abstract}] #3  \stopsection
  \startsection[title={Keywords}] #4 \stopsection
  \stop
  \startsection[title={¿Cómo citar este capítulo? / How to cite this book?}]
\startsubsection[title={Apa}] #5 \stopsubsection
\startsubsection[title={Chicago}] #6 \stopsubsection
\startsubsection[title={MLA}] #7 \stopsubsection
   \stopsection
}

\starttext
% Then I call the macro like this:
\metadatos{spanish abstract \input knuth}{some, comma, separated, keywords,
in, spanish}{english abstract \input knuth}{same, comma, separated,
keywords, in, english}{Apa citation style for this article}{Chicago
citation style for this article}{MLA citation style for this article}
\stoptext
%%%

I've been exploring different ways to do it better, but with not much luck,
I was thinking something based in key=value assignments? setups? datasets?
Not really sure, but If you know a better solution or point me in the
direction of something I can use to replace that macro, it would be greatly
appreciated.

-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
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: An strange error with section and page

2023-08-22 Thread Wolfgang Schuster

Xavier B. schrieb am 22.08.2023 um 19:32:

Hi,

I have a long document 
[https://repo.or.cz/apunts-espa-matematiques.git/blob/HEAD:/ng-exercicis.conTeXt.pdf]
 which I migrated from MKIV to LMTX version of ConTeXt. As Wolfgang recommened. 
I migrated old syntax to new one and replace \page[yes] before each section to

\setupheads[section][style={\bf \ssc}, alternative=margin, page=yes]

but now after each section there is a new page.

Why? I don't know.
Can someone help me to see what happens?

The source code is here [https://repo.or.cz/apunts-espa-matematiques.git]


You're using the structure for section of the following example in your 
document. This is a problem
because subjects are the same level as section or to be precise, 
subjects are unnumbered versions

of sections and inherit all settings from them unless configured otherwise.

While the solution here is to convert all subject headings to subsubject 
(be sure to also take care
of even lower section) a quick way to fix the page break is to disable 
the page-value for subject,

look at the commented line in the example how this can be done.

 begin example
\setuphead[section][page=yes]
%\setuphead[subject][page=no]

\starttext

\startsection[title=Section]

\startsubject [title=Subject]

\stopsubject

\stopsection

\stoptext
 end example

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: Equivalent of the \cancel command with conTeXt

2023-08-22 Thread Fabrice Couvreur
Hi Mikael,
Thank you for this command ; there must be many others that I don't know
how they work.
Fabrice

Le mar. 22 août 2023 à 10:54, Mikael Sundqvist  a écrit :

> Hi,
>
> On Tue, Aug 22, 2023 at 12:25 PM Fabrice Couvreur
>  wrote:
> >
> > Hi,
> > In an algebraic expression, it is sometimes interesting to cross out
> terms. With LaTeX, there is the \cancel command from the package cancel. Is
> there an equivalent with conTeXt ?
> > Thanks
> > Fabrice
>
> I don't know what the cancel package gives, but since December 22 or
> so, one can do
>
> \starttext
>
> \setupframed
> [mathstrikeout]
> [color=darkgreen,
> backgroundcolor=darkred,
> frame=off]
>
> \startTEXpage[offset=4dk,align=flushleft]
> \dm{1+\mathstrikeout[strike:text={what is this?}]{(2x-x)}+2=3+x}
> \blank
> \dm{1+\mathstrikeout[strike:math={=x}]{(2x-x)}+2=3+x}
> \blank
> \dm{1+\mathstrikeout[strike:math=u,arrow=no]{(2x-x)}+2=3+x}
> \blank
> \dm{1+\mathcrossout[strike:math={=x}]{(2x-x)}+2=3+x}
> \stopTEXpage
>
> \stoptext
>
> /Mikael
>
> ___
> 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: Nested itemize

2023-08-22 Thread fv leung
It seems that displaystyle fractions insert extra vertical space before the
main item.
With textstyle fractions, the code works fine.
\blank[back,overlay] can get rid of the gap above the first row, but not
the space inserted by \dfrac.


\defineitemgroup[alex]

\setupitemgroup
 [alex]
 [each]
 [a,two]
 [
 margin=2cm,
 before={\blank[overlay,-depth]},
 after={\blank[nowhite]},
 stopper=)
 ]

%\showboxes
\autofences

\starttext
\samplefile{ward}
\startitemize[n][style=\bf,before={\blank[back,overlay]},after={\blank[medium]}]
  \startitem
\startalextable
  \startitem
\m{6(x - \frac{5}{12})^2 - \frac{1}{24}}
  \stopitem
  \startitem
\m{-3(x - \frac{1}{3})^2 + \frac{1}{3}}
  \stopitem
  \startitem
\m{7(x + \frac{5}{14})^2 + \frac{199}{28}}
  \stopitem
  \startitem
\m{-\frac{1}{2}(x + 2)^2 + \frac{9}{2}}
  \stopitem
\stopalextable
  \stopitem
\stopitemize

\samplefile{ward}
\stoptext

Alexandre Christe  於 2023年8月22日 週二 下午5:48寫道:

> Hi Mikael,
>
> That looks very attractive. However, with the following code, I end up
> with a large gap above the first row.
>
> \defineitemgroup[alex]
>
> \setupitemgroup
>  [alex]
>  [each]
>  [a,two]
>  [
>  margin=2cm,
>  before=\blank[overlay,-depth],
>  stopper=)
>  ]
>
> \showboxes
> \autofences
>
> \starttext
> \samplefile{ward}
>
> \startitemize[n][style=\bf]
>  \startitem
>  \startalextable
>  \startitem $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$ \stopitem
>  \startitem $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$ \stopitem
>  \startitem $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$ \stopitem
>  \startitem $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$ \stopitem
>  \stopalextable
>  \stopitem
> \stopitemize
>
> \samplefile{ward}
> \stoptext
>
> A. Christe
> Le 22 août 2023 à 07:12 +0200, Alexandre Christe ,
> a écrit :
>
> It’s true that \vtop{…} does the job for a single line of items, but it
> doesn’t in the case there’re multiple (\vtop{}) aligns with the bottom.
>
> Here’s a modified MWE
>
> \startitemize[n][style=\bf]
>   \item \godown[-\lineheight] \startitemize
> [a,columns,two,packed,broad][stopper=),before={\blank[nowhite]}]
> \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
>   \stopitemize
> \stopitemize
>
> A. Christe
> Le 22 août 2023 à 04:08 +0200, fv leung , a écrit :
>
> I'd do it this way:
>
> \starttext
> \startitemize[n][style=\bf]
> \item\vtop{%
>   \startitemize[a,horizontal,four][stopper=\)]
> \startitem
>   $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> \stopitem
> \startitem
>   $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> \stopitem
> \startitem
>   $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> \stopitem
> \startitem
>   $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
> \stopitem
>   \stopitemize
> }
> \stopitemize
>
> \stoptext
>
> Alexandre Christe  於 2023年8月22日 週二 上午2:58寫道:
>
>> Dear ConTeXt users,
>>
>> Time goes by but I haven't yet found a nice solution to this issue. When
>> having mathematics, I'd not like to adjust by hand the factor of \linewidth
>> for the \godown command.
>>
>> Here's a MWE
>>
>> \starttext
>>
>> \startitemize[n][style=\bf]
>>   \item \godown[-\lineheight] \startitemize
>> [a,columns,four,packed,broad][stopper=),before={\blank[nowhite]}]
>> \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
>> \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
>> \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
>> \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
>>   \stopitemize
>> \stopitemize
>>
>> \stoptext
>>
>> Thanks in advance.
>>
>> Le ven. 2 sept. 2022 à 11:24, fv leung via ntg-context <
>> ntg-context@ntg.nl> a écrit :
>>
>>>
>>> \starttext
>>>
>>> \startitemize[n]
>>> \item\godown[-\lineheight]
>>>
>>> \startitemize[a,columns,packed][before={\blank[nowhite]},right=\),stopper=]
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \stopitemize
>>> \item\godown[-\lineheight]
>>>
>>> \startitemize[a,columns,packed][before={\blank[nowhite]},n=3,right=\),stopper=]
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \stopitemize
>>> \item\godown[-\lineheight]
>>>
>>> \star

[NTG-context] Re: Equivalent of the \cancel command with conTeXt

2023-08-22 Thread Mikael Sundqvist
Hi,

On Tue, Aug 22, 2023 at 12:25 PM Fabrice Couvreur
 wrote:
>
> Hi,
> In an algebraic expression, it is sometimes interesting to cross out terms. 
> With LaTeX, there is the \cancel command from the package cancel. Is there an 
> equivalent with conTeXt ?
> Thanks
> Fabrice

I don't know what the cancel package gives, but since December 22 or
so, one can do

\starttext

\setupframed
[mathstrikeout]
[color=darkgreen,
backgroundcolor=darkred,
frame=off]

\startTEXpage[offset=4dk,align=flushleft]
\dm{1+\mathstrikeout[strike:text={what is this?}]{(2x-x)}+2=3+x}
\blank
\dm{1+\mathstrikeout[strike:math={=x}]{(2x-x)}+2=3+x}
\blank
\dm{1+\mathstrikeout[strike:math=u,arrow=no]{(2x-x)}+2=3+x}
\blank
\dm{1+\mathcrossout[strike:math={=x}]{(2x-x)}+2=3+x}
\stopTEXpage

\stoptext

/Mikael
___
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: Nested itemize

2023-08-22 Thread Alexandre Christe
Hi Mikael,

That looks very attractive. However, with the following code, I end up with a 
large gap above the first row.

\defineitemgroup[alex]

\setupitemgroup
 [alex]
 [each]
 [a,two]
 [
 margin=2cm,
 before=\blank[overlay,-depth],
 stopper=)
 ]

\showboxes
\autofences

\starttext
\samplefile{ward}

\startitemize[n][style=\bf]
 \startitem
 \startalextable
 \startitem $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$ \stopitem
 \startitem $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$ \stopitem
 \startitem $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$ \stopitem
 \startitem $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$ \stopitem
 \stopalextable
 \stopitem
\stopitemize

\samplefile{ward}
\stoptext

A. Christe
Le 22 août 2023 à 07:12 +0200, Alexandre Christe , a 
écrit :
> It’s true that \vtop{…} does the job for a single line of items, but it 
> doesn’t in the case there’re multiple (\vtop{}) aligns with the bottom.
>
> Here’s a modified MWE
>
> \startitemize[n][style=\bf]
>   \item \godown[-\lineheight] \startitemize 
> [a,columns,two,packed,broad][stopper=),before={\blank[nowhite]}]
>     \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
>     \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
>     \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
>     \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
>   \stopitemize
> \stopitemize
>
> A. Christe
> Le 22 août 2023 à 04:08 +0200, fv leung , a écrit :
> > I'd do it this way:
> >
> > \starttext
> > \startitemize[n][style=\bf]
> > \item\vtop{%
> >   \startitemize[a,horizontal,four][stopper=\)]
> >     \startitem
> >       $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> >     \stopitem
> >     \startitem
> >       $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> >     \stopitem
> >     \startitem
> >       $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> >     \stopitem
> >     \startitem
> >       $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
> >     \stopitem
> >   \stopitemize
> > }
> > \stopitemize
> >
> > \stoptext
> >
> > > Alexandre Christe  於 2023年8月22日 週二 上午2:58寫道:
> > > > Dear ConTeXt users,
> > > >
> > > > Time goes by but I haven't yet found a nice solution to this issue. 
> > > > When having mathematics, I'd not like to adjust by hand the factor of 
> > > > \linewidth for the \godown command.
> > > >
> > > > Here's a MWE
> > > >
> > > > \starttext
> > > >
> > > > \startitemize[n][style=\bf]
> > > >   \item \godown[-\lineheight] \startitemize 
> > > > [a,columns,four,packed,broad][stopper=),before={\blank[nowhite]}]
> > > >     \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> > > >     \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> > > >     \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> > > >     \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
> > > >   \stopitemize
> > > > \stopitemize
> > > >
> > > > \stoptext
> > > >
> > > > Thanks in advance.
> > > >
> > > > > Le ven. 2 sept. 2022 à 11:24, fv leung via ntg-context 
> > > > >  a écrit :
> > > > > >
> > > > > > \starttext
> > > > > >
> > > > > > \startitemize[n]
> > > > > > \item\godown[-\lineheight]
> > > > > >   
> > > > > > \startitemize[a,columns,packed][before={\blank[nowhite]},right=\),stopper=]
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \stopitemize
> > > > > > \item\godown[-\lineheight]
> > > > > >   
> > > > > > \startitemize[a,columns,packed][before={\blank[nowhite]},n=3,right=\),stopper=]
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \stopitemize
> > > > > > \item\godown[-\lineheight]
> > > > > >   
> > > > > > \startitemize[a,columns,packed][before={\blank[nowhite]},n=4,right=\),stopper=]
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > > >   \item bla
> > > > >

[NTG-context] Re: Nested itemize

2023-08-22 Thread Mikael Sundqvist
Hi,

On Tue, Aug 22, 2023 at 7:16 AM Alexandre Christe
 wrote:
>
> It’s true that \vtop{…} does the job for a single line of items, but it 
> doesn’t in the case there’re multiple (\vtop{}) aligns with the bottom.
>
> Here’s a modified MWE
>
> \startitemize[n][style=\bf]
>   \item \godown[-\lineheight] \startitemize 
> [a,columns,two,packed,broad][stopper=),before={\blank[nowhite]}]
> \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
>   \stopitemize
> \stopitemize
>
> A. Christe
> Le 22 août 2023 à 04:08 +0200, fv leung , a écrit :
>
> I'd do it this way:
>
> \starttext
> \startitemize[n][style=\bf]
> \item\vtop{%
>   \startitemize[a,horizontal,four][stopper=\)]
> \startitem
>   $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> \stopitem
> \startitem
>   $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> \stopitem
> \startitem
>   $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> \stopitem
> \startitem
>   $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
> \stopitem
>   \stopitemize
> }
> \stopitemize
>
> \stoptext
>
> Alexandre Christe  於 2023年8月22日 週二 上午2:58寫道:
>>
>> Dear ConTeXt users,
>>
>> Time goes by but I haven't yet found a nice solution to this issue. When 
>> having mathematics, I'd not like to adjust by hand the factor of \linewidth 
>> for the \godown command.
>>
>> Here's a MWE
>>
>> \starttext
>>
>> \startitemize[n][style=\bf]
>>   \item \godown[-\lineheight] \startitemize 
>> [a,columns,four,packed,broad][stopper=),before={\blank[nowhite]}]
>> \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
>> \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
>> \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
>> \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
>>   \stopitemize
>> \stopitemize
>>
>> \stoptext
>>
>> Thanks in advance.
>>
>> Le ven. 2 sept. 2022 à 11:24, fv leung via ntg-context  
>> a écrit :
>>>
>>>
>>> \starttext
>>>
>>> \startitemize[n]
>>> \item\godown[-\lineheight]
>>>   
>>> \startitemize[a,columns,packed][before={\blank[nowhite]},right=\),stopper=]
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \stopitemize
>>> \item\godown[-\lineheight]
>>>   
>>> \startitemize[a,columns,packed][before={\blank[nowhite]},n=3,right=\),stopper=]
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \stopitemize
>>> \item\godown[-\lineheight]
>>>   
>>> \startitemize[a,columns,packed][before={\blank[nowhite]},n=4,right=\),stopper=]
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \item bla
>>>   \stopitemize
>>> \stopitemize
>>>
>>> \stoptext
>>>
>>> Alexandre Christe via ntg-context  於 2022年9月2日 週五 
>>> 下午5:08寫道:
>>>>
>>>> Dear all,
>>>>
>>>> I'm struggling to setup a nested itemize with no blank line and several 
>>>> columns.
>>>>
>>>> What I mean is something like
>>>> 1. a) bla   c) bla
>>>> b) bla   d) bla
>>>>
>>>> The following MWE is my starting point
>>>>
>>>> \starttext
>>>> \startitemize[n]
>>>> \item \blank[-line]
>>>> \startitemize[a,horizontal,two] [margin=2cm]
>>>> \item First
>>>> \item Second
>>>> \item Third
>>>> \item Fourth
>>>> \stopitemize
>>>> \item \blank[-line]
>>>> \startitemize[a,horizontal,columns,two]
>>>> \item First
>>>> \item Second
>>>> \item Third
>>>> \item Fourth
>>>> \stopitemize
>>>> \stopitemize
>>>> \stoptext
>>>>
>>>> Thanks in advance

Not really tested, but \blank[overlay,-depth] seems to work OK (thanks Hans!).

I also take the opportunity to push a bit for the new itemtable mechanism:

\defineitemgroup[alex]

\setupitemgroup
[alex]
[each]
[a,two]
[margin=2cm,
before=\blank[overlay,-depth]]

\showboxes

\starttext
\startitemize[n]
\startitem
\startalextable
\startitem First \stopitem
\startitem Second \stopitem
\startitem Third \stopitem
\startitem Fourth \stopitem
\stopalextable
\stopitem
\stopitemize
\stoptext

Please test for a larger document to see if it works well.

/Mikael
___
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: Not getting a page break in the ToC

2023-08-22 Thread Hans Hagen via ntg-context

On 8/22/2023 8:51 AM, Andres Conrado Montoya wrote:

Apologies, I just found the solution:
https://wiki.contextgarden.net/Command/setinjector

El lun, 21 ago 2023 a las 23:43, Andres Conrado Montoya (<
andresconr...@gmail.com>) escribió:


I'm trying to force a page break in a table of contents, using what is
recommended at
https://wiki.contextgarden.net/Table_of_Contents#Forced_Page_Break

However, it does not work. Here's a MWE:

\definelistextra[page][before=\page]
\starttext
\starttitle[title={Table of contents}]
\placecontent[extras={2=page}]
\stoptitle
\startchapter[title={First chapter}]
\input knuth
\stopchapter
\startchapter[title={Second chapter}]
\input knuth
\stopchapter
\startchapter[title={Third chapter}]
\input knuth
\stopchapter
\stoptext

Is there a new way of obtaining a page break before a given part, chapter
or section in the ToC?

Here is another method:

\showpageprogress % [all]
%resetforcedbreak

\starttext
\registerforcedbreak[8][before]
\dorecurse{10}{\samplefile{tufte}\par}
\page
\resetforcedbreak
\registerforcedbreak[12][after]
\dorecurse{10}{\samplefile{tufte}\par}
\stoptext

(by-product of some new mechanisms that we are exploring)

(not yet wikified)

Hans


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

___
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: Not getting a page break in the ToC

2023-08-22 Thread Andres Conrado Montoya
Apologies, I just found the solution:
https://wiki.contextgarden.net/Command/setinjector

El lun, 21 ago 2023 a las 23:43, Andres Conrado Montoya (<
andresconr...@gmail.com>) escribió:

> I'm trying to force a page break in a table of contents, using what is
> recommended at
> https://wiki.contextgarden.net/Table_of_Contents#Forced_Page_Break
>
> However, it does not work. Here's a MWE:
>
> \definelistextra[page][before=\page]
> \starttext
> \starttitle[title={Table of contents}]
> \placecontent[extras={2=page}]
> \stoptitle
> \startchapter[title={First chapter}]
> \input knuth
> \stopchapter
> \startchapter[title={Second chapter}]
> \input knuth
> \stopchapter
> \startchapter[title={Third chapter}]
> \input knuth
> \stopchapter
> \stoptext
>
> Is there a new way of obtaining a page break before a given part, chapter
> or section in the ToC?
>
> Thank you in advance.
>
> --
> Andrés Conrado Montoya
> Andi Kú
> andresconr...@gmail.com
> http://sesentaycuatro.com
> http://messier87.com
> http://chiquitico.org
> 
> Los fines no justifican los medios, porque la medida verdadera de nuestro
> carácter está dada por los medios que estamos dispuestos a utilizar, no por
> los fines que proclamamos.
> 
>
> “You develop an instant global consciousness, a people orientation, an
> intense dissatisfaction with the state of the world, and a compulsion to do
> something about it. From out there on the moon, international politics look
> so petty. You want to grab a politician by the scruff of the neck and drag
> him a quarter of a million miles out and say, ‘Look at that, you son of a
> bitch.’” — Apollo 14 astronaut Edgar Mitchell
>


-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
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: Nested itemize

2023-08-21 Thread Alexandre Christe
It’s true that \vtop{…} does the job for a single line of items, but it doesn’t 
in the case there’re multiple (\vtop{}) aligns with the bottom.

Here’s a modified MWE

\startitemize[n][style=\bf]
  \item \godown[-\lineheight] \startitemize 
[a,columns,two,packed,broad][stopper=),before={\blank[nowhite]}]
    \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
    \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
    \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
    \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
  \stopitemize
\stopitemize

A. Christe
Le 22 août 2023 à 04:08 +0200, fv leung , a écrit :
> I'd do it this way:
>
> \starttext
> \startitemize[n][style=\bf]
> \item\vtop{%
>   \startitemize[a,horizontal,four][stopper=\)]
>     \startitem
>       $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
>     \stopitem
>     \startitem
>       $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
>     \stopitem
>     \startitem
>       $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
>     \stopitem
>     \startitem
>       $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
>     \stopitem
>   \stopitemize
> }
> \stopitemize
>
> \stoptext
>
> > Alexandre Christe  於 2023年8月22日 週二 上午2:58寫道:
> > > Dear ConTeXt users,
> > >
> > > Time goes by but I haven't yet found a nice solution to this issue. When 
> > > having mathematics, I'd not like to adjust by hand the factor of 
> > > \linewidth for the \godown command.
> > >
> > > Here's a MWE
> > >
> > > \starttext
> > >
> > > \startitemize[n][style=\bf]
> > >   \item \godown[-\lineheight] \startitemize 
> > > [a,columns,four,packed,broad][stopper=),before={\blank[nowhite]}]
> > >     \item $6(x - \dfrac{5}{12})^2 - \dfrac{1}{24}$
> > >     \item $-3(x - \dfrac{1}{3})^2 + \dfrac{1}{3}$
> > >     \item $7(x + \dfrac{5}{14})^2 + \dfrac{199}{28}$
> > >     \item $-\dfrac{1}{2}(x + 2)^2 + \dfrac{9}{2}$
> > >   \stopitemize
> > > \stopitemize
> > >
> > > \stoptext
> > >
> > > Thanks in advance.
> > >
> > > > Le ven. 2 sept. 2022 à 11:24, fv leung via ntg-context 
> > > >  a écrit :
> > > > >
> > > > > \starttext
> > > > >
> > > > > \startitemize[n]
> > > > > \item\godown[-\lineheight]
> > > > >   
> > > > > \startitemize[a,columns,packed][before={\blank[nowhite]},right=\),stopper=]
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \stopitemize
> > > > > \item\godown[-\lineheight]
> > > > >   
> > > > > \startitemize[a,columns,packed][before={\blank[nowhite]},n=3,right=\),stopper=]
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \stopitemize
> > > > > \item\godown[-\lineheight]
> > > > >   
> > > > > \startitemize[a,columns,packed][before={\blank[nowhite]},n=4,right=\),stopper=]
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \item bla
> > > > >   \stopitemize
> > > > > \stopitemize
> > > > >
> > > > > \stoptext
> > > > >
> > > > > > Alexandre Christe via ntg-context  於 2022年9月2日 
> > > > > > 週五 下午5:08寫道:
> > > > > > > Dear all,
> > > > > > >
> > > > > > > I'm struggling to setup a nested itemize with no blank line and 
> > > > > > > several columns.
> > > > > > >
> > > > > > > What I mean is something like
> > > > > > > 1. a) bla   c) bla
> > > > > > >     b) bla   d) bla
> > > > > > >
> > > > > > > The following MWE is my starting point
> > > > > > >
> > > > > > > \starttext
> > > > > > > \startitemize[n]
> > > > > > > \item \blank[-line]
> > > > > > > \startitemize[a,horizontal,two] [margin=2cm]
> > > > > > > \item First
> > > > > > > \item Second
> > > > > > > \item T

<    4   5   6   7   8   9   10   11   12   13   >