Re: [NTG-context] What does #+ do?

2020-07-13 Thread Wolfgang Schuster

Jairo A. del Rio schrieb am 14.07.2020 um 02:08:

Hi list!

In evenmore pp. 76-77, concerning LMTX extended macro parsing, the 
following examples of #0, #+ and #- are given


\def\TestA#1#2#3{{(#1)(#2)(#3)}}
\def\TestB#1#0#3{(#1)(#2)(#3)}
\def\TestC#1#+#3{(#1)(#2)(#3)}
\def\TestD#1#-#2{(#1)(#2)}

So

\TestA1{\red 2}3
\TestB1{\red 2}3
\TestC1{\red 2}3
\TestD1{\red 2}3

give

(1)(2)(3) % red from "2" onward
(1)()(3)
(1)(2)(3) % only "2" is colored
(1)(3)

What I guess is that #+ pass an argument, grouping braces included (the 
report says an argument is passed "as-is"). I see it as really useful. 
But, apart from the example above, are there any other differences 
between doing, say, \def\foo#1#2#3 and \def\foo#+#+#+{#1#2#3}? Thank you 
very much.


It's usefull when you use optional arguments because TeX removes the 
braces around the content of the argument.


\starttext

\def\testa[#1]{\detokenize{#1}}
\def\testb[#+]{\detokenize{#1}}

\testa[{braces}]

\testb[{braces}]

\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] What does #+ do?

2020-07-13 Thread Jairo A. del Rio
Hi.
Sorry, I meant \def\foo#1#2#3{#1#2#3} and \def\foo#+#+#+{#1#2#3}.

Jairo :)

El lun., 13 de jul. de 2020 a la(s) 19:08, Jairo A. del Rio (
jairoadelr...@gmail.com) escribió:

> Hi list!
>
> In evenmore pp. 76-77, concerning LMTX extended macro parsing, the
> following examples of #0, #+ and #- are given
>
> \def\TestA#1#2#3{{(#1)(#2)(#3)}}
> \def\TestB#1#0#3{(#1)(#2)(#3)}
> \def\TestC#1#+#3{(#1)(#2)(#3)}
> \def\TestD#1#-#2{(#1)(#2)}
>
> So
>
> \TestA1{\red 2}3
> \TestB1{\red 2}3
> \TestC1{\red 2}3
> \TestD1{\red 2}3
>
> give
>
> (1)(2)(3) % red from "2" onward
> (1)()(3)
> (1)(2)(3) % only "2" is colored
> (1)(3)
>
> What I guess is that #+ pass an argument, grouping braces included (the
> report says an argument is passed "as-is"). I see it as really useful. But,
> apart from the example above, are there any other differences between
> doing, say, \def\foo#1#2#3 and \def\foo#+#+#+{#1#2#3}? Thank you very much.
>
> Cordially,
>
> Jairo :)
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] gnuplot module broken with latest 2020-07-13 16:31

2020-07-13 Thread Adam Reviczky
Many thanks for the quick fix Hans,

I have tried the lmtx inclusions as well, very nice indeed (and added it to
the wiki)!

Kind Regards,
Adam Reviczky

On Mon, Jul 13, 2020 at 10:38 PM Hans Hagen  wrote:

> On 7/13/2020 8:53 PM, Adam Reviczky wrote:
> > Hi,
> >
> > Using the minimal example from the contextgarden for gnuplot
> > (https://wiki.contextgarden.net/Gnuplot) I am getting the following
> > error message:
> >
> > This is LuaTeX, Version 1.13.0 (TeX Live 2021/dev/Debian)
> >   system commands enabled.
> > open source > level 1, order 1, name
> > '/usr/share/texmf/tex/context/base/mkiv/cont-yes.mkiv'
> > system  >
> > system  > ConTeXt  ver: 2020.07.13 16:23 MKIV  fmt: 2020.7.13
> >   int: english/english
> > system  >
> > system  > 'cont-new.mkiv' loaded
> > open source > level 2, order 2, name
> > '/usr/share/texmf/tex/context/base/mkiv/cont-new.mkiv'
> > system  > beware: some patches loaded from cont-new.mkiv
> > close source> level 2, order 2, name
> > '/usr/share/texmf/tex/context/base/mkiv/cont-new.mkiv'
> > system  > files > jobname 'mwe', input './mwe', result 'mwe'
> > fonts   > latin modern fonts are not preloaded
> > languages   > language 'en' is active
> > open source > level 2, order 3, name '/tmp/4/mwe.tex'
> > modules > 'gnuplot' is loaded
> > open source > level 3, order 4, name
> > '/usr/share/texmf/tex/context/third/gnuplot/t-gnuplot.mkiv'
> > loading > Gnuplot module
> > open source > level 4, order 5, name
> > '/usr/share/texmf/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
> > close source> level 4, order 5, name
> > '/usr/share/texmf/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
> > close source> level 3, order 5, name
> > '/usr/share/texmf/tex/context/third/gnuplot/t-gnuplot.mkiv'
> >
> > lua error   > lua error on line 4 in file /tmp/4/mwe.tex:
> >
> > /usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:439: attempt to call
> > a nil value (upvalue 'gettoken')
> > stack traceback:
> > /usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:439: in upvalue
> 'pickup'
> > /usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:635: in function
> > 
> > (...tail calls...)
> >
> >   1 \usemodule[gnuplot]
> >   2
> >   3 % write a script for gnuplot
> >   4 >>  \startGNUPLOTscript[sin]
> >   5plot sin(x)
> >   6 \stopGNUPLOTscript
> >   7
> >   8 % include the resulting graphic into the document
> >   9 \useGNUPLOTgraphic[sin]
> > 10
> >
> > mtx-context | fatal error: return code: 256
> >
> > Does the gnuplot module need adjustments?
> No, i messed up something ... will be fixed tomorrow
>
> Do you have lmtx installed? It has nicer gnuplot support:
>
> m-gnuplot-demo.gp :
>
> 
> set format xy "$%g$"
>
> set title  'This is a plot of $y=\\sin(x)$'
> set xlabel 'This is the $x$ axis'
> set ylabel 'This is the $y$ axis'
>
> plot [0:6.28] [0:1] sin(x)
> 
>
> Can be included with:
>
> \starttext
>
>  \externalfigure[m-gnuplot-demo.gp][conversion=svg,width=4cm]
>
>  \externalfigure[m-gnuplot-demo.gp][conversion=svg,width=8cm]
>
> \stoptext
>
>
> -
>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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] What does #+ do?

2020-07-13 Thread Jairo A. del Rio
Hi list!

In evenmore pp. 76-77, concerning LMTX extended macro parsing, the
following examples of #0, #+ and #- are given

\def\TestA#1#2#3{{(#1)(#2)(#3)}}
\def\TestB#1#0#3{(#1)(#2)(#3)}
\def\TestC#1#+#3{(#1)(#2)(#3)}
\def\TestD#1#-#2{(#1)(#2)}

So

\TestA1{\red 2}3
\TestB1{\red 2}3
\TestC1{\red 2}3
\TestD1{\red 2}3

give

(1)(2)(3) % red from "2" onward
(1)()(3)
(1)(2)(3) % only "2" is colored
(1)(3)

What I guess is that #+ pass an argument, grouping braces included (the
report says an argument is passed "as-is"). I see it as really useful. But,
apart from the example above, are there any other differences between
doing, say, \def\foo#1#2#3 and \def\foo#+#+#+{#1#2#3}? Thank you very much.

Cordially,

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] gnuplot module broken with latest 2020-07-13 16:31

2020-07-13 Thread Hans Hagen

On 7/13/2020 8:53 PM, Adam Reviczky wrote:

Hi,

Using the minimal example from the contextgarden for gnuplot 
(https://wiki.contextgarden.net/Gnuplot) I am getting the following 
error message:


This is LuaTeX, Version 1.13.0 (TeX Live 2021/dev/Debian)
  system commands enabled.
open source     > level 1, order 1, name 
'/usr/share/texmf/tex/context/base/mkiv/cont-yes.mkiv'

system          >
system          > ConTeXt  ver: 2020.07.13 16:23 MKIV  fmt: 2020.7.13 
  int: english/english

system          >
system          > 'cont-new.mkiv' loaded
open source     > level 2, order 2, name 
'/usr/share/texmf/tex/context/base/mkiv/cont-new.mkiv'

system          > beware: some patches loaded from cont-new.mkiv
close source    > level 2, order 2, name 
'/usr/share/texmf/tex/context/base/mkiv/cont-new.mkiv'

system          > files > jobname 'mwe', input './mwe', result 'mwe'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
open source     > level 2, order 3, name '/tmp/4/mwe.tex'
modules         > 'gnuplot' is loaded
open source     > level 3, order 4, name 
'/usr/share/texmf/tex/context/third/gnuplot/t-gnuplot.mkiv'

loading         > Gnuplot module
open source     > level 4, order 5, name 
'/usr/share/texmf/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
close source    > level 4, order 5, name 
'/usr/share/texmf/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
close source    > level 3, order 5, name 
'/usr/share/texmf/tex/context/third/gnuplot/t-gnuplot.mkiv'


lua error       > lua error on line 4 in file /tmp/4/mwe.tex:

/usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:439: attempt to call 
a nil value (upvalue 'gettoken')

stack traceback:
/usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:439: in upvalue 'pickup'
/usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:635: in function 


(...tail calls...)

  1     \usemodule[gnuplot]
  2
  3     % write a script for gnuplot
  4 >>  \startGNUPLOTscript[sin]
  5        plot sin(x)
  6     \stopGNUPLOTscript
  7
  8     % include the resulting graphic into the document
  9     \useGNUPLOTgraphic[sin]
10

mtx-context     | fatal error: return code: 256

Does the gnuplot module need adjustments?

No, i messed up something ... will be fixed tomorrow

Do you have lmtx installed? It has nicer gnuplot support:

m-gnuplot-demo.gp :


set format xy "$%g$"

set title  'This is a plot of $y=\\sin(x)$'
set xlabel 'This is the $x$ axis'
set ylabel 'This is the $y$ axis'

plot [0:6.28] [0:1] sin(x)


Can be included with:

\starttext

\externalfigure[m-gnuplot-demo.gp][conversion=svg,width=4cm]

\externalfigure[m-gnuplot-demo.gp][conversion=svg,width=8cm]

\stoptext


-
  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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] gnuplot module broken with latest 2020-07-13 16:31

2020-07-13 Thread Adam Reviczky
Hi,

Using the minimal example from the contextgarden for gnuplot (
https://wiki.contextgarden.net/Gnuplot) I am getting the following error
message:

This is LuaTeX, Version 1.13.0 (TeX Live 2021/dev/Debian)
 system commands enabled.
open source > level 1, order 1, name
'/usr/share/texmf/tex/context/base/mkiv/cont-yes.mkiv'
system  >
system  > ConTeXt  ver: 2020.07.13 16:23 MKIV  fmt: 2020.7.13  int:
english/english
system  >
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name
'/usr/share/texmf/tex/context/base/mkiv/cont-new.mkiv'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name
'/usr/share/texmf/tex/context/base/mkiv/cont-new.mkiv'
system  > files > jobname 'mwe', input './mwe', result 'mwe'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 2, order 3, name '/tmp/4/mwe.tex'
modules > 'gnuplot' is loaded
open source > level 3, order 4, name
'/usr/share/texmf/tex/context/third/gnuplot/t-gnuplot.mkiv'
loading > Gnuplot module
open source > level 4, order 5, name
'/usr/share/texmf/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
close source> level 4, order 5, name
'/usr/share/texmf/tex/context/fonts/mkiv/type-imp-texgyre.mkiv'
close source> level 3, order 5, name
'/usr/share/texmf/tex/context/third/gnuplot/t-gnuplot.mkiv'

lua error   > lua error on line 4 in file /tmp/4/mwe.tex:

/usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:439: attempt to call a
nil value (upvalue 'gettoken')
stack traceback:
/usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:439: in upvalue 'pickup'
/usr/share/texmf/tex/context/base/mkiv/buff-ini.lua:635: in function

(...tail calls...)

 1 \usemodule[gnuplot]
 2
 3 % write a script for gnuplot
 4 >>  \startGNUPLOTscript[sin]
 5plot sin(x)
 6 \stopGNUPLOTscript
 7
 8 % include the resulting graphic into the document
 9 \useGNUPLOTgraphic[sin]
10

mtx-context | fatal error: return code: 256

Does the gnuplot module need adjustments?
Version 2020-07-09 14:50 is fine.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Chapter numbering that does not follow a regular pattern

2020-07-13 Thread Hans Hagen

On 7/13/2020 11:27 AM, Julian Fox wrote:
That's obviously much simpler! I was under the impression that 'title' 
was only for use in front matter, or that if I used it elsewhere, then 
it didn't show the number but that the next use of 'chapter' would 
increment as if it had a number. I was wrong!


titles normally don't end up in the toc, chapters do ... in frontmatter 
chapters are unnumbered too so it's kind of a combination: 
numbers/unnumbered and tocontents/nottocontents depending on the 
'matter' at hand


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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Chapter numbering that does not follow a regular pattern

2020-07-13 Thread Julian Fox
That's obviously much simpler! I was under the impression that 'title' was
only for use in front matter, or that if I used it elsewhere, then it
didn't show the number but that the next use of 'chapter' would increment
as if it had a number. I was wrong!

On Mon, 13 Jul 2020, 5:13 PM Henning Hraban Ramm  wrote:

>
>
> > Am 13.07.2020 um 02:23 schrieb jbf :
> >
> > Hi there,
> >
> > I have a situation where numbered chapters are occasionally interspersed
> with unnumbered chapters, so, for example, it might be:
> >
> > 1 First chapter title with number
> >
> >   second chapter title unnumbered
> >
> > 2 Second chapter title with  number
> >
> > 3 Third chapter title with number
>
> Use \title (or \starttitle[title={}]) for unnumbered and \chapter
> (\startchaper) for numbered.
>
> If you need the unnumbered chapters in your ToC, you must add them like
> \setupcombinedlist[content][list={chapter,title}]
>
> You can setup most options for both using \setuphead[chapter,title][...]
>
> HTH
>
> Hraban
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Iterate over color scheme in ConTeXt/Lua

2020-07-13 Thread Hans Hagen

On 7/12/2020 11:54 PM, Jairo A. del Rio wrote:
El dom., 12 de jul. de 2020 a la(s) 16:20, Hans Hagen (j.ha...@xs4all.nl 
) escribió:


You get a list of defined color names in 'xwi' with:

     attributes.colors.setlist("xwi")

Nice, it works! I note the first method only works when \usecolors[xwi] 
is present; otherwise, it prints an interesting "themaintextcolor".


Here is a nostalgic mkii accessor for such a list (color support is a
real old feature and conceptually hasn't changed that much):

    \def\WhateverActionIWant#1{#1\par}

    \settrue\collectcolorsinlist \setupcolor[xwi]

    \processcommacommand[\colorlist]\WhateverActionIWant

but you probably don't want to catch up on that.


It doesn't work in Mark IV (\colorlist is undefined). Maybe I'm too 
young, but Mark II was already frozen when I was a teenager, so I'm not 
sure I want to try it now. Thanks, Hans!
It's low level mkii, never meant for usage outside core code (in this 
case in mkii it is used for typesetting color overviews); mkiv still has 
the same high level commands but different low level ... nothing to 
worry about. The only high level commands that were dropped in mkiv were 
those dealing with obsolete technologies, encodings and such)


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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Chapter numbering that does not follow a regular pattern

2020-07-13 Thread Henning Hraban Ramm


> Am 13.07.2020 um 02:23 schrieb jbf :
> 
> Hi there,
> 
> I have a situation where numbered chapters are occasionally interspersed with 
> unnumbered chapters, so, for example, it might be:
> 
> 1 First chapter title with number
> 
>   second chapter title unnumbered
> 
> 2 Second chapter title with  number
> 
> 3 Third chapter title with number

Use \title (or \starttitle[title={}]) for unnumbered and \chapter 
(\startchaper) for numbered.

If you need the unnumbered chapters in your ToC, you must add them like 
\setupcombinedlist[content][list={chapter,title}]

You can setup most options for both using \setuphead[chapter,title][...]

HTH

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___