[NTG-context] Re: \par and \startlines

2024-04-26 Thread Wolfgang Schuster

Denis Maier schrieb am 26.04.2024 um 19:52:


I see. But there's no command that could be used to simulate an empty line?
If not, me should I perhaps try to replicate the wrapper structure from 
the XML source in context? (I'll also look into the format module of 
course.) What do you think?


Below is a different solution to your problem with works without 
\startlines because you already mark up each individual line in the poem 
which make it possible to add a linebreak in the output.


With \blank options (samepage) you can avoid pagebreaks between stanzas.

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|poem|stanza|line}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

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

\startxmlsetups xml:poem
\blank[line]
\xmlflush{#1}
\blank[back,line]
\stopxmlsetups

\startxmlsetups xml:stanza
   \xmlflush{#1}\blank[preference,line]
\stopxmlsetups

\startxmlsetups xml:line
\xmlflush{#1}\blank[samepage,none]
\stopxmlsetups

\startbuffer[test]




The
lines
are
there!


The
lines
are
there!


The
lines
are
there!



\stopbuffer

\starttext

\samplefile{lorem}

\xmlprocessbuffer{test}{test}{}

\samplefile{lorem}

\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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Define a new command that inherits from multiple other command options

2024-04-26 Thread ai2472206007
Thanks for your reply. 

The kanji part requires a specific font and typescript file, which I defined on 
my own computer but forgot to add to this example. This is something I didn't 
take into account. It's true, I need to think about what exactly my command 
needs, not build an all-powerful command. It's my poor consideration.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Define a new command that inherits from multiple other command options

2024-04-26 Thread Bruce Horrocks


> On 25 Apr 2024, at 09:24, ai2472206...@yeah.net wrote:
> 
> But what I don't know is how to get it to inherit the options of other 
> commands and perform these features correctly.

Your example didn't work for me - none of the Chinese|Japanese[1] characters 
showed.

AFAIK there is no way to "inherit" functionality.

You still need to write \setupsidenote to call \setupcounter, \setupframed at 
the right points to achieve the right effects.

What you can do is have \setupsidenote accept all options in one big long list 
and then pass the ones that apply to setupcounter to each use of \setupcounter, 
pass on the ones that apply to setupframed to each use of \setupframed and so 
on.

Thsi is releatively easy in Lua where you could define a list of all possible 
commands and which macro they apply to then loop through it looking to see if 
that option had been supplied and building a set of parameters for 
\setupframed, \setupcounter etc.

Hope this makes sense.

But I feel there's probably a better way - it's a lot of effort to go to in 
order to have a single "does it all macro" instead of calling two or three 
macros each time.

Regards,

[1] Apologies for my ignorance.
—
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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Henning Hraban Ramm

Am 26.04.24 um 19:52 schrieb Denis Maier via ntg-context:

I see. But there's no command that could be used to simulate an empty line?


Did you try \vskip{…}?

Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Pablo Rodriguez via ntg-context
On 4/26/24 19:52, Denis Maier via ntg-context wrote:
>> Wolfgang Schuster hat am 26.04.2024 19:29 CEST geschrieben:
>> The inbetween setting works because ConTeXt checks at the start of
>> each line whether it's empty (in this case the value is used) or not.
>>
>> When you add a \par you just end the current line/paragraph and it
>> doesn't matter how many \par's you use because TeX just ignores them.
>  
> I see. But there's no command that could be used to simulate an empty line?

Crappy code:

  \starttext
  a\dorecurse{25}{\par}b
  a\dorecurse{25}{\null\par}b
  \stoptext

Just to show it could be achieved,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: wrong spacing after command with optional arguments

2024-04-26 Thread Pablo Rodriguez via ntg-context
On 4/26/24 19:50, Wolfgang Schuster wrote:
> Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 19:04:
>> I tried this approach (I hope it isn’t wrong):
>>
>>\starttext
>>\expanded\tolerant\def\MyCommand#_#,#_#,#_#,#_{%
>
> The \expanded modifier is wrong (I guess you meant \unexpanded) but
> which check for the number of arguments you use doesn't matter in a
> document.

You are right, I meant \unexpanded.

> The LMTX version of the \iffourthargument etc. checks is the
> \ifarguments commands where you use \or to set a case for the number of
> argument passed.

Many thanks for explaining this too.

>> But what are these "#_" (which don’t seem to come from TeX)?
>
> Hans added many additions to command parameters in Luametatex and #_
> means the argument to a commands has to be enclosed in braces while #1
> allows you to pass text without it.

I get it now.

> You can find a list with all new command parameters in lowlevel-macros.pdf.

An interesting reading for the weekend.

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Denis Maier via ntg-context


 
 
  
    
   
   
   
Wolfgang Schuster  hat am 26.04.2024 19:29 CEST geschrieben:

   
 

   
 
Denis Maier schrieb am 26.04.2024 um 19:18:



  
 
 
 
  Wolfgang Schuster  hat am 26.04.2024 18:24 CEST geschrieben:
  
 
   
  
 
   
  Denis Maier via ntg-context schrieb am 26.04.2024 um 18:10: 
  
  
   
   
Pablo Rodriguez via ntg-context  hat am 26.04.2024 17:25 CEST geschrieben:

   
 

   
 

   
On 4/26/24 15:33, denis.ma...@unibe.ch wrote:



 Hi,
 



 I’m trying to typeset a poem from XML, but I can’t figure out how to
 

 make the inbetween key working here.
 



 As the source is XML, I cannot just add an empty line to start a new
 

 group of lines inside \startlines…\stoplines. I guess, there must be a
 

 command to do that, but \par seems to have no effect here.
 



 How can this be done?
 

   
Hi Denis,

   
 

   
I must confess I don’t get which is your actual question.

   
 

   
\blank works here and you know that (since you included it in your code).

   
 

   
MkIV with \par works in your sample and LMTX with \par doesn’t.

   
 

   
I wonder whether this might be a bug in LMTX.

   
 

   
Just in case it might help,

   
  
    
   
  
   Thanks for your answer and sorry for not being clearer. I was just wondering why the \par seems to have no effect. (I first guessed that it might be related to XML, to but then realized it happens with context markup as well. Usually, you won't run into this because an empty line works, but with XML that's not am option.) As you've said, it looks like a bug then.
   
  
 The lines environment treats each line of the input as paragraph by adding \par at the end of it and adding another \par makes no difference here. 
 
 BTW: ConTeXt has a module for poems which can be loaded with \usemodule[format]. 
 
 Wolfgang 
 
 
 

 Ok. I'll have a look at this module. Just two questions:
 

 1. so did this behavior change? 
 

 2. What is inbetween referring to then? If each line is a paragraph, what's this group of paragraphs then? Can you manually switch to the next one?
 

   The inbetween setting works because ConTeXt checks at the start of each line whether it's empty (in this case the value is used) or not.
   
   When you add a \par you just end the current line/paragraph and it doesn't matter how many \par's you use because TeX just ignores them.
   
   Wolfgang
   
  
    
   
  
   I see. But there's no command that could be used to simulate an empty line?
   
  
   If not, me should I perhaps try to replicate the wrapper structure from the XML source in context? (I'll also look into the format module of course.) What do you think?
   
  
    
   
  
   Thank you so much for your help.
   
  
   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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: wrong spacing after command with optional arguments

2024-04-26 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 19:04:

On 4/26/24 18:18, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 17:29:

What is wrong in my definition above?


There is nothing wrong, this is just a side effect of the scanner used
with the \do...groupempty commands. To have more control about this
behavior use the \tolerant modifier for \def to change it.


Many thanks for your reply, Wolfgang.

I tried this approach (I hope it isn’t wrong):

   \starttext
   \expanded\tolerant\def\MyCommand#_#,#_#,#_#,#_{%
 \doiftextelse{#4}%
   {#4}
   {\doiftextelse{#3}
 {#3}
 {#2}}}


The \expanded modifier is wrong (I guess you meant \unexpanded) but 
which check for the number of arguments you use doesn't matter in a 
document.


The LMTX version of the \iffourthargument etc. checks is the 
\ifarguments commands where you use \or to set a case for the number of 
argument passed.


\protected\tolerant\def\MyCommand#_#,#_#,#_#,#_%
  {\ifarguments
 % no arguments are passed
   \or
 #1% one argument is passed
   \or
 #2% two arguments are passed
   \or
 #3% three arguments are passed
   \or
 #4% four arguments are passed
   \fi}



   \MyCommand{}{second}{third}{fourth},\\
   \MyCommand{}{second}{third}{fourth} e,\\

   \MyCommand{}{second}{third},\\
   \MyCommand{}{second}{third} e,\\

   \MyCommand{}{second},\\
   \MyCommand{}{second} e,\\
   \stoptext

BTW, this is the first time I see #_ instead of #1.

There is no way to search for "#_" in the wiki.

Grepping the source, "#_" seems to be used for optional arguments
(mainly in syst-aux.mkxl).

But what are these "#_" (which don’t seem to come from TeX)?


Hans added many additions to command parameters in Luametatex and #_ 
means the argument to a commands has to be enclosed in braces while #1

allows you to pass text without it.

In the following example \CommandA take in the first case "a" as 
argument while CommandB ignores it and would only accept "{a}" with 
braces around it.


 begin example
 \def\CommandA#1{(#1)}
\tolerant\def\CommandB#_{(#1)}

\starttext

\CommandA abc\par
\CommandB abc\blank

\CommandA {ab}c\par
\CommandB {ab}c\blank

\stoptext
 end example

You can find a list with all new command parameters in lowlevel-macros.pdf.

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Wolfgang Schuster

Denis Maier schrieb am 26.04.2024 um 19:18:
Wolfgang Schuster  hat am 
26.04.2024 18:24 CEST geschrieben:

Denis Maier via ntg-context schrieb am 26.04.2024 um 18:10:
Pablo Rodriguez via ntg-context > hat am 26.04.2024 17:25 CEST geschrieben:
On 4/26/24 15:33, denis.ma...@unibe.ch 
 wrote:
Hi, 
I’m trying to typeset a poem from XML, but I can’t figure out how to
make the inbetween key working here. 
As the source is XML, I cannot just add an empty line to start a new
group of lines inside \startlines…\stoplines. I guess, there must 
be a
command to do that, but \par seems to have no effect here. 
How can this be done? 

Hi Denis,
I must confess I don’t get which is your actual question.
\blank works here and you know that (since you included it in your 
code).

MkIV with \par works in your sample and LMTX with \par doesn’t.
I wonder whether this might be a bug in LMTX.
Just in case it might help, 
Thanks for your answer and sorry for not being clearer. I was just 
wondering why the \par seems to have no effect. (I first guessed 
that it might be related to XML, to but then realized it happens 
with context markup as well. Usually, you won't run into this 
because an empty line works, but with XML that's not am option.) As 
you've said, it looks like a bug then. 


The lines environment treats each line of the input as paragraph by 
adding \par at the end of it and adding another \par makes no 
difference here.


BTW: ConTeXt has a module for poems which can be loaded with 
\usemodule[format].


Wolfgang


Ok. I'll have a look at this module. Just two questions:
1. so did this behavior change?
2. What is inbetween referring to then? If each line is a paragraph, 
what's this group of paragraphs then? Can you manually switch to the 
next one?


The inbetween setting works because ConTeXt checks at the start of each 
line whether it's empty (in this case the value is used) or not.


When you add a \par you just end the current line/paragraph and it 
doesn't matter how many \par's you use because TeX just ignores them.


Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Denis Maier via ntg-context


 
 
  
    
   
   
   
Wolfgang Schuster  hat am 26.04.2024 18:24 CEST geschrieben:

   
 

   
 
Denis Maier via ntg-context schrieb am 26.04.2024 um 18:10:

   
  
 
 
  Pablo Rodriguez via ntg-context  hat am 26.04.2024 17:25 CEST geschrieben:
  
 
   
  
 
   
  
 
  On 4/26/24 15:33, denis.ma...@unibe.ch wrote:
  
  
  
   Hi,
   
  
  
  
   I’m trying to typeset a poem from XML, but I can’t figure out how to
   
  
   make the inbetween key working here.
   
  
  
  
   As the source is XML, I cannot just add an empty line to start a new
   
  
   group of lines inside \startlines…\stoplines. I guess, there must be a
   
  
   command to do that, but \par seems to have no effect here.
   
  
  
  
   How can this be done?
   
  
 
  Hi Denis,
  
 
   
  
 
  I must confess I don’t get which is your actual question.
  
 
   
  
 
  \blank works here and you know that (since you included it in your code).
  
 
   
  
 
  MkIV with \par works in your sample and LMTX with \par doesn’t.
  
 
   
  
 
  I wonder whether this might be a bug in LMTX.
  
 
   
  
 
  Just in case it might help,
  
 

  
 

 Thanks for your answer and sorry for not being clearer. I was just wondering why the \par seems to have no effect. (I first guessed that it might be related to XML, to but then realized it happens with context markup as well. Usually, you won't run into this because an empty line works, but with XML that's not am option.) As you've said, it looks like a bug then.
  

   The lines environment treats each line of the input as paragraph by adding \par at the end of it and adding another \par makes no difference here.
   
   BTW: ConTeXt has a module for poems which can be loaded with \usemodule[format].
   
   Wolfgang
   
   
   
   
   
  
   Ok. I'll have a look at this module. Just two questions:
   
  
   1. so did this behavior change? 
   
  
   2. What is inbetween referring to then? If each line is a paragraph, what's this group of paragraphs then? Can you manually switch to the next one?
   
  
    
   
  
   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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: wrong spacing after command with optional arguments

2024-04-26 Thread Pablo Rodriguez via ntg-context
On 4/26/24 18:18, Wolfgang Schuster wrote:
> Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 17:29:
>> What is wrong in my definition above?
>
> There is nothing wrong, this is just a side effect of the scanner used
> with the \do...groupempty commands. To have more control about this
> behavior use the \tolerant modifier for \def to change it.

Many thanks for your reply, Wolfgang.

I tried this approach (I hope it isn’t wrong):

  \starttext
  \expanded\tolerant\def\MyCommand#_#,#_#,#_#,#_{%
\doiftextelse{#4}%
  {#4}
  {\doiftextelse{#3}
{#3}
{#2}}}

  \MyCommand{}{second}{third}{fourth},\\
  \MyCommand{}{second}{third}{fourth} e,\\

  \MyCommand{}{second}{third},\\
  \MyCommand{}{second}{third} e,\\

  \MyCommand{}{second},\\
  \MyCommand{}{second} e,\\
  \stoptext

BTW, this is the first time I see #_ instead of #1.

There is no way to search for "#_" in the wiki.

Grepping the source, "#_" seems to be used for optional arguments
(mainly in syst-aux.mkxl).

But what are these "#_" (which don’t seem to come from TeX)?

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Wolfgang Schuster

Denis Maier via ntg-context schrieb am 26.04.2024 um 18:10:
Pablo Rodriguez via ntg-context > hat am 26.04.2024 17:25 CEST geschrieben:
On 4/26/24 15:33, denis.ma...@unibe.ch  
wrote:
Hi, 
I’m trying to typeset a poem from XML, but I can’t figure out how to
make the inbetween key working here. 
As the source is XML, I cannot just add an empty line to start a new

group of lines inside \startlines…\stoplines. I guess, there must be a
command to do that, but \par seems to have no effect here. 
How can this be done? 

Hi Denis,
I must confess I don’t get which is your actual question.
\blank works here and you know that (since you included it in your 
code).

MkIV with \par works in your sample and LMTX with \par doesn’t.
I wonder whether this might be a bug in LMTX.
Just in case it might help, 
Thanks for your answer and sorry for not being clearer. I was just 
wondering why the \par seems to have no effect. (I first guessed that 
it might be related to XML, to but then realized it happens with 
context markup as well. Usually, you won't run into this because an 
empty line works, but with XML that's not am option.) As you've said, 
it looks like a bug then.




The lines environment treats each line of the input as paragraph by 
adding \par at the end of it and adding another \par makes no difference 
here.


BTW: ConTeXt has a module for poems which can be loaded with 
\usemodule[format].


Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: wrong spacing after command with optional arguments

2024-04-26 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 17:29:

Dear list,

I have the following sample:

   \starttext
   \def\MyCommand{\doquadruplegroupempty\doMyCommand}

   \def\doMyCommand#1#2#3#4{%
 \iffourthargument
   #4%
 \orelse\ifthirdargument
   #3%
 \else
   #2%
 \fi}

   \MyCommand{}{second}{third}{fourth},\\
   \MyCommand{}{second}{third}{fourth} e,\\

   \MyCommand{}{second}{third},\\
   \MyCommand{}{second}{third} e,\\

   \MyCommand{}{second},\\
   \MyCommand{}{second} e,\\
   \stoptext

I don‘t know why only the command gets the space after right only when
the four arguments are provided.

What is wrong in my definition above?


There is nothing wrong, this is just a side effect of the scanner used 
with the \do...groupempty commands. To have more control about this 
behavior use the \tolerant modifier for \def to change it.


 begin example
\tolerant\def\CommandA#_#*#_#*#_#*#_{(#1)(#2)(#3)(#4)}
\tolerant\def\CommandB#_#,#_#,#_#,#_{(#1)(#2)(#3)(#4)}

\starttext

A: \CommandA{a}  xxx\par
B: \CommandB{a}  xxx\blank

A: \CommandA{a}{b}   xxx\par
B: \CommandB{a}{b}   xxx\blank

A: \CommandA{a}{b}{c}xxx\par
B: \CommandB{a}{b}{c}xxx\blank

A: \CommandA{a}{b}{c}{d} xxx\par
B: \CommandB{a}{b}{c}{d} xxx\blank

\stoptext
 end example

Another way to avoid this is to create a command with a key-value list.

 begin example
\tolerant\def\Command[#1]%
  {\begingroup
   \getdummyparameters[#1]%
   \doifsomething{\dummyparameter{a}}{(\dummyparameter{a})}%
   \doifsomething{\dummyparameter{b}}{(\dummyparameter{b})}%
   \doifsomething{\dummyparameter{c}}{(\dummyparameter{c})}%
   \doifsomething{\dummyparameter{d}}{(\dummyparameter{d})}%
   \endgroup}

\starttext

\Command[a=1,b=2,c=3,d=4] xxx\par
\Command[a=1,c=3] xxx\par

\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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Denis Maier via ntg-context


 
 
  
    
   
   
   
Pablo Rodriguez via ntg-context  hat am 26.04.2024 17:25 CEST geschrieben:

   
 

   
 

   
On 4/26/24 15:33, denis.ma...@unibe.ch wrote:



 Hi,
 



 I’m trying to typeset a poem from XML, but I can’t figure out how to
 

 make the inbetween key working here.
 



 As the source is XML, I cannot just add an empty line to start a new
 

 group of lines inside \startlines…\stoplines. I guess, there must be a
 

 command to do that, but \par seems to have no effect here.
 



 How can this be done?
 

   
Hi Denis,

   
 

   
I must confess I don’t get which is your actual question.

   
 

   
\blank works here and you know that (since you included it in your code).

   
 

   
MkIV with \par works in your sample and LMTX with \par doesn’t.

   
 

   
I wonder whether this might be a bug in LMTX.

   
 

   
Just in case it might help,

   
  
    
   
  
   Thanks for your answer and sorry for not being clearer. I was just wondering why the \par seems to have no effect. (I first guessed that it might be related to XML, to but then realized it happens with context markup as well. Usually, you won't run into this because an empty line works, but with XML that's not am option.) As you've said, it looks like a bug then.
   
  
    
   
  
   Thanks,
   
  
   Denis
   
   
   
 

   
Pablo

   
___

   
If your question is of interest to others as well, please add an entry to the Wiki!

   
 

   
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl

   
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)

   
archive : https://github.com/contextgarden/context

   
wiki : https://wiki.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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] wrong spacing after command with optional arguments

2024-04-26 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample:

  \starttext
  \def\MyCommand{\doquadruplegroupempty\doMyCommand}

  \def\doMyCommand#1#2#3#4{%
\iffourthargument
  #4%
\orelse\ifthirdargument
  #3%
\else
  #2%
\fi}

  \MyCommand{}{second}{third}{fourth},\\
  \MyCommand{}{second}{third}{fourth} e,\\

  \MyCommand{}{second}{third},\\
  \MyCommand{}{second}{third} e,\\

  \MyCommand{}{second},\\
  \MyCommand{}{second} e,\\
  \stoptext

I don‘t know why only the command gets the space after right only when
the four arguments are provided.

What is wrong in my definition above?

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Pablo Rodriguez via ntg-context
On 4/26/24 15:33, denis.ma...@unibe.ch wrote:
> Hi,
>
> I’m trying to typeset a poem from XML, but I can’t figure out how to
> make the inbetween key working here.
>
> As the source is XML, I cannot just add an empty line to start a new
> group of lines inside \startlines…\stoplines. I guess, there must be a
> command to do that, but \par seems to have no effect here.
>
> How can this be done?

Hi Denis,

I must confess I don’t get which is your actual question.

\blank works here and you know that (since you included it in your code).

MkIV with \par works in your sample and LMTX with \par doesn’t.

I wonder whether this might be a bug in LMTX.

Just in case it might 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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] \par and \startlines

2024-04-26 Thread denis.maier
Hi,

I'm trying to typeset a poem from XML, but I can't figure out how to make the 
inbetween key working here.
As the source is XML, I cannot just add an empty line to start a new group of 
lines inside \startlines...\stoplines. I guess, there must be a command to do 
that, but \par seems to have no effect here.
How can this be done?

Best,
Denis

%%%
\setuplines[before={\blank},after={\blank},inbetween={ARE WE INBETWEEN?\blank}]

% XML Nodes auswählen
\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|poem|stanza|line}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

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

\startxmlsetups xml:poem
\startlines
   \xmlflush{#1}
\stoplines
\stopxmlsetups

\startxmlsetups xml:stanza
   \xmlflushlinewise{#1}\par %this has no effect
\stopxmlsetups

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

\startbuffer[test]




The
lines
are
there!


The
lines
are
there!



\stopbuffer


\starttext

This works:

\startlines
The
lines
are
there!

The
lines
are
there!
\stoplines

Apparently, \type{\par} has no effect here:

\startlines
The
lines
are
there!\par% \par has no effect here
The
lines
are
there!
\stoplines

For background, this is what I'm actually trying to do:

\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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-26 Thread Fabrice Couvreur
Hi,
Thanks for your help. I did several tests playing only with the code of
component 5 which interferes with that of component 14.

@Aditya
begingroup;
.
endgroup;
does not work.

@Hans
save defaultfont, defaultscale;

maybe also:

save circle, p, q, b ;

I get an empty rectangle in place of the graph in composant 5.

@Taco
The solution that works is to add component 14 to the code

numeric a, b;

Fabrice


Le ven. 26 avr. 2024 à 10:45, Aditya Mahajan  a écrit :

> On Fri, 26 Apr 2024, Taco Hoekwater wrote:
>
> >
> >
> > > On 25 Apr 2024, at 23:12, Fabrice Couvreur <
> fabrice1.couvr...@gmail.com> wrote:
> > >
> > > Hi,
> > > Here is the code that interferes with the graph from the last chapter
> but why ?
> >
> > Because of this “path b”:
> >
> > >  path circle, p, q, b;
> >
> > which interferes with the assignment line from the other graphic code:
> >
> > >  b := xpart(reverse C_f intersectionpoint reverse C_g);
> >
> > because there “b” is a now a path, not a numeric.
> >
> > Adding
> >
> >numeric a,b;
> >
> > fixes the problem in chapter 14.
>
> Woundn't newnumeric be better?
>
> There are very few instances where I want variables defined in one block
> to be reused in another block. So, I almost always use
>
> \startMPcode
> begingroup;
> 
> endgroup;
> \stopMPcode
>
> to avoid such issues.
>
>
> Aditya___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Thomas A. Schmitz

On 4/26/24 10:22 AM, Hans Hagen wrote:



That's because mkii is AI enhanced. Can you try this:


Ah, I see where I was wrong, thank you! I'm mapping from xml, so I 
became confused with the optional parameters that I write as attributes, 
with a number of ifs... But now it should be clear!


All best

Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-26 Thread Aditya Mahajan
On Fri, 26 Apr 2024, Taco Hoekwater wrote:

> 
> 
> > On 25 Apr 2024, at 23:12, Fabrice Couvreur  
> > wrote:
> > 
> > Hi,
> > Here is the code that interferes with the graph from the last chapter but 
> > why ?
> 
> Because of this “path b”:
>   
> >  path circle, p, q, b;
> 
> which interferes with the assignment line from the other graphic code:
> 
> >  b := xpart(reverse C_f intersectionpoint reverse C_g);
> 
> because there “b” is a now a path, not a numeric.
> 
> Adding 
> 
>numeric a,b;
> 
> fixes the problem in chapter 14. 

Woundn't newnumeric be better? 

There are very few instances where I want variables defined in one block to be 
reused in another block. So, I almost always use

\startMPcode
begingroup;

endgroup;
\stopMPcode

to avoid such issues. 

Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Hans Hagen

On 4/26/2024 9:54 AM, Thomas A. Schmitz wrote:

On 4/26/24 9:30 AM, Thomas A. Schmitz wrote:
And here I am again! Both in mkiv and in mkxl, start/stopregister does 
not work when there is already an index entry before. Example below!


All best

Thomas

\setuppapersize [A6]

\starttext
 A\index{A} B \page
 A\startregister [index] {A} B\startregister [index] [B] {B}
 \dorecurse {10} {\input tufte}
 A\stopregister [index] {A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext


And I'm not even sure if this is allowed to say anymore, but: works in 
mkii...

That's because mkii is AI enhanced. Can you try this:

\setuppapersize [A6]

\starttext

A\index{A} B \page


\stopregister [index] [A]
B>
\stopregister [index] [B]

\page

\placeregister[index]

\stoptext

(Watch the [A] vs {A} usage where [A] is the label used for matching the 
potentially weiord nested start/stop ... maybe we need different aliases 
for these, like \fromregister and \toregister.)


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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Thomas A. Schmitz

On 4/26/24 9:30 AM, Thomas A. Schmitz wrote:
And here I am again! Both in mkiv and in mkxl, start/stopregister does 
not work when there is already an index entry before. Example below!


All best

Thomas

\setuppapersize [A6]

\starttext
     A\index{A} B \page
     A\startregister [index] {A} B\startregister [index] [B] {B}
     \dorecurse {10} {\input tufte}
     A\stopregister [index] {A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext


And I'm not even sure if this is allowed to say anymore, but: works in 
mkii...


Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Thomas A. Schmitz

On 4/25/24 6:27 PM, Thomas A. Schmitz wrote:
Ah, simple typo! After fixing abel to label, startregister gives the 
expected results again! Thanks Hans! I may be back with more register 
questions soon...


And here I am again! Both in mkiv and in mkxl, start/stopregister does 
not work when there is already an index entry before. Example below!


All best

Thomas

\setuppapersize [A6]

\starttext
A\index{A} B \page
A\startregister [index] {A} B\startregister [index] [B] {B}
\dorecurse {10} {\input tufte}
A\stopregister [index] {A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: The graph is not visible.

2024-04-26 Thread Taco Hoekwater


> On 25 Apr 2024, at 23:12, Fabrice Couvreur  
> wrote:
> 
> Hi,
> Here is the code that interferes with the graph from the last chapter but why 
> ?

Because of this “path b”:
  
>  path circle, p, q, b;

which interferes with the assignment line from the other graphic code:

>  b := xpart(reverse C_f intersectionpoint reverse C_g);

because there “b” is a now a path, not a numeric.

Adding 

   numeric a,b;

fixes the problem in chapter 14. 

But why it does not affect chapters 6-13, that I do not understand.


— 
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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___