[NTG-context] Re: How to use fonts without typescripts?

2024-05-15 Thread Henri Menke via ntg-context
On Wed, 2024-05-15 at 20:03 +0530, Shiv Shankar Dayal wrote:
> Hi,
> 
> Defining typescripts to use a font is very painful. How can I use a
> font
> without using a typescript?

Use \definefontfamily which is essentially the successor of the old
simplefonts module.

https://wiki.contextgarden.net/Command/definefontfamily

Cheers, Henri

> 
> _
> __
> 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: LuaMetaTeX code

2024-01-19 Thread Henri Menke via ntg-context
On Fri, 2024-01-19 at 13:56 +0530, Shiv Shankar Dayal wrote:
> Dear Hans,
> 
> I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not
> good
> coding practice. These potions of code which have goto should be
> refactored.

https://xkcd.com/292/

> I am a C programmer, but I know very little of TeX. If you can point
> me
> towards where should I start for TeX(perhaps TeX Book or TeX for the
> Impatient), I can help with refactoring of code to make is more
> efficient/easier.
> 
> _
> __
> 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: Triaging tikz error: Cannot parse this coordinate

2023-08-09 Thread Henri Menke via ntg-context
On 8/8/23 20:57, Hans Hagen wrote:
> On 8/8/2023 7:43 PM, Hans Hagen wrote:
>> On 8/8/2023 6:13 PM, Xavier B. wrote:
>>> After some time, I could write a minimal example with tikz with
>>> strange error: Cannot parse this coordinate.
>>>
>>> Can someone help me to find the bug?
>>>
>>> I attach the file and the log.
>>>
>>> Help very appreciate
>>> I run
>>   \starttikzpicture
>>     \foreach \p in {(6,2)}
>>     {
>>     \tracingall
>>   \startscope[shift={\p}]
>>  \draw[color=green!60, thick] (0,0) -- (1,1);
>>   \stopscope
>>     }
>>    \stoptikzpicture
>>
>> looks like some parsing issue, are you sure that you can assign \p to
>> shift this way?
> ok, i found it but i'm not going to make it custom to fix tikz
> 
> you need to use this:
> 
>  \normalexpanded{\noexpand\startscope[shift={\p}]}
> 
> instead of
> 
>   \startscope[shift={\p}]
> 
> this can be automated with (maybe we need a m-fixz module for that)
> 
> % fix
> 
> \appendtoks
>     \let\normaltikzstartscope\startscope
>     \def\startscope[#1]%
>   {\normalexpanded
>  {\noexpand\normaltikzstartscope[#1]}}%
> \to \everyinsidetikzpicture
> 
> % end of fix
> 
> but for that you need to use the attached module so that we hook it in
> aftert tikz sets itself up
> 
> the fix you can put in your style or in a cont-loc.mkxl in a local tree

This is likely going to break all kinds of stuff, because not everything
in \startscope[...] can always be expanded. Also the brackets are
optional in the original definition of \startscope, so a \dosingleempty
would at least be in order:

\appendtoks
\let\normaltikzstartscope\startscope
\def\dostartscope[#1]%
  {\normalexpanded
 {\noexpand\normaltikzstartscope[#1]}}%
\def\startscope{\dosingleempty\dostartscope}%
\to \everyinsidetikzpicture


In fact, pgfkeys has a handler for expanding keys before doing
assignment to work around exactly these situations:

\startscope[shift/.expanded={\p}]

No redefinition needed.

We could also do \edef or \romannumeral expansion in the shift key in
TikZ, but I'm not sure whether that would break someone's code.

Cheers,
Henri

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

Re: [NTG-context] protected macro vs protected luacall

2023-01-27 Thread Henri Menke via ntg-context
On Fri, 2023-01-27 at 11:01 +0100, Hans Hagen via ntg-context wrote:
> On 1/27/2023 10:35 AM, Henri Menke via ntg-context wrote:
> 
> > Thanks, this is indeed the workaround that I currently use.
> > However,
> > the downside is that this has to tokenize the contents of
> > \directlua
> > every time (and is therefore susceptible to surrounding \catcode
> > shenanigans) and it expands in at minimum two steps, whereas a
> > luacall
> > always expands in a single step. But I guess that's what I will
> > have to
> > live with.
> on my 2018 laptop, with
> 
>function FoO() end
> 
> this
> 
>\directlua{FoO()}}
> 
> takes 0.014 seconds so probably the least of your worries
> compared 
> to other macro and lua magic

True, but then there is still the problem with the number of
expansions. With a nested \directlua I always need at least two steps
to get the result from Lua.


\directlua{
function TestCmd()
  tex.print("\string\\numexpr 17\string\\relax")
end
lua.get_functions_table()[999] = TestCmd
}
\let\:\expandafter % I'm lazy
\tt
\directlua{token.set_lua("test", 999)}
\:\def\:\x\:{\test}\meaning\x % macro:->\numexpr 17\relax

\protected\def\test{\directlua{TestCmd()}}
\:\def\:\x\:{\test}\meaning\x\par % macro:->\directlua {TestCmd()}
\:\:\:\def\:\:\:\x\:\:\:{\test}\meaning\x % macro:->\numexpr 17\relax

\bye


How much do you think would break if protected luacall were treated
like protected macros after \the in the engine?

That would probably need an extra branch in the switch(cur_cmd) in
scan_something_internal. Currently protected luacall just goes to the
default branch (You can't use ...).

Cheers, Henri

> 
> 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
> _
> __

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


Re: [NTG-context] protected macro vs protected luacall

2023-01-27 Thread Henri Menke via ntg-context
On Fri, 2023-01-27 at 10:30 +0100, Hans Hagen via ntg-context wrote:
> On 1/27/2023 10:13 AM, Henri Menke via ntg-context wrote:
> > On Thu, 2023-01-26 at 23:07 +0100, Hans Hagen via ntg-context
> > wrote:
> > > On 1/26/2023 9:33 PM, Henri Menke via ntg-context wrote:
> > > > \directlua{
> > > > userdata = userdata or {}
> > > > function userdata.test()
> > > >   tex.print("\string\\numexpr 17\string\\relax")
> > > > end
> > > > }
> > > > 
> > > > \tt
> > > > \protected\def\test{\directlua{userdata.test()}}
> > > > \meaning\test\par
> > > > \edef\x{\test}\meaning\x\par
> > > > \the\test
> > > > 
> > > > \directlua{
> > > > local t = lua.get_functions_table()
> > > > t[\string#t + 1] = userdata.test
> > > > token.set_lua("test", userdata.test, \string#t,
> > > > "protected")
> > > > }
> > > > \meaning\test\par
> > > > \edef\x{\test}\meaning\x\par
> > > > \the\test
> > > from the code it looks like we're talking plain luatex ...
> > > 
> > > \the is very selective and doesn't work for all primitives or
> > > macros
> > > 
> > > compare it to \number which accepts any number representation
> > > following
> > > it while \the doesn't work ok 123
> > > 
> > > that said, your set_lua is wrong and passes a function as well as
> > > an
> > > index
> > > 
> > > \directlua{
> > >  lua.get_functions_table()[999] = function()
> > >tex.print("\string\\numexpr 17\string\\relax")
> > >  end
> > >  token.set_lua("test", 999)
> > > }
> > > 
> > > \the\test % needs the \numexpr
> > > 
> > > \number \test % doesn't
> > > 
> > > \count0 \test % needs the \numexpr
> > > 
> > > \count0=\test % doesn't
> > > 
> > > etc
> > 
> > Thanks for pointing out my mistake. Your example works fine but now
> > the
> > luacall is no longer protected and will therefore fully expand in
> > \edef. So do I understand this correctly that there is no way to
> > make
> > the second \the\test work?
> > 
> > \directlua{
> >  lua.get_functions_table()[999] = function()
> >tex.pri
> > nt("\string\\numexpr 17\string\\relax")
> >  end
> > }
> > 
> > \tt
> > \directlua{token.set_lua("test", 999)}
> > \meaning\test\par % expandable luacall 999
> > \edef\x{\test}\meaning\x\par % macro:->\numexpr 17\relax
> > \the\test % 17
> > 
> > \directlua{token.set_lua("test", 999, "protected")}
> > \meaning\test\par % luacall 999
> > \edef\x{\test}\meaning\x\par % macro:->\test
> > \the\test % ! You can't use `luacall 999' after \the.
> > 
> > \bye
> you can do
> 
> \directlua{
> function TestCmd()
>   tex.print("\string\\numexpr 17\string\\relax")
> end
> }
> 
> \protected\def\test{\directlua{TestCmd()}}
> 
> or, more efficient:
> 
> \directlua{
> function TestCmd()
>   tex.print("17")
> end
> }
> 
> \protected\def\test{\numexpr\directlua{TestCmd()}\relax}

Thanks, this is indeed the workaround that I currently use. However,
the downside is that this has to tokenize the contents of \directlua
every time (and is therefore susceptible to surrounding \catcode
shenanigans) and it expands in at minimum two steps, whereas a luacall
always expands in a single step. But I guess that's what I will have to
live with.

Cheers, Henri

> 
> 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
> _
> __

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


Re: [NTG-context] protected macro vs protected luacall

2023-01-27 Thread Henri Menke via ntg-context
On Thu, 2023-01-26 at 23:07 +0100, Hans Hagen via ntg-context wrote:
> On 1/26/2023 9:33 PM, Henri Menke via ntg-context wrote:
> > \directlua{
> >userdata = userdata or {}
> >function userdata.test()
> >  tex.print("\string\\numexpr 17\string\\relax")
> >end
> > }
> > 
> > \tt
> > \protected\def\test{\directlua{userdata.test()}}
> > \meaning\test\par
> > \edef\x{\test}\meaning\x\par
> > \the\test
> > 
> > \directlua{
> >local t = lua.get_functions_table()
> >t[\string#t + 1] = userdata.test
> >token.set_lua("test", userdata.test, \string#t, "protected")
> > }
> > \meaning\test\par
> > \edef\x{\test}\meaning\x\par
> > \the\test
> from the code it looks like we're talking plain luatex ...
> 
> \the is very selective and doesn't work for all primitives or macros
> 
> compare it to \number which accepts any number representation
> following 
> it while \the doesn't work ok 123
> 
> that said, your set_lua is wrong and passes a function as well as an
> index
> 
> \directlua{
> lua.get_functions_table()[999] = function()
>   tex.print("\string\\numexpr 17\string\\relax")
> end
> token.set_lua("test", 999)
> }
> 
> \the\test % needs the \numexpr
> 
> \number \test % doesn't
> 
> \count0 \test % needs the \numexpr
> 
> \count0=\test % doesn't
> 
> etc

Thanks for pointing out my mistake. Your example works fine but now the
luacall is no longer protected and will therefore fully expand in
\edef. So do I understand this correctly that there is no way to make
the second \the\test work?


\directlua{
lua.get_functions_table()[999] = function()
  tex.pri
nt("\string\\numexpr 17\string\\relax")
end
}

\tt
\directlua{token.set_lua("test", 999)}
\meaning\test\par % expandable luacall 999
\edef\x{\test}\meaning\x\par % macro:->\numexpr 17\relax
\the\test % 17

\directlua{token.set_lua("test", 999, "protected")}
\meaning\test\par % luacall 999
\edef\x{\test}\meaning\x\par % macro:->\test
\the\test % ! You can't use `luacall 999' after \the.

\bye


Cheers, Henri

> 
> 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
> _
> __

___
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] protected macro vs protected luacall

2023-01-26 Thread Henri Menke via ntg-context
Dear list,

I have noticed a somewhat strange difference between protected macros
and protected luacalls, namely that the latter cannot be expanded by
\the.  In the example below I define a Lua function that prints
\numexpr 17\relax to the token stream and I call it once from a
protected TeX macro wrapping \directlua and once from a protected
luacall registered with token.set_lua.


\directlua{
  userdata = userdata or {}
  function userdata.test()
tex.print("\string\\numexpr 17\string\\relax")
  end
}

\tt
\protected\def\test{\directlua{userdata.test()}}
\meaning\test\par
\edef\x{\test}\meaning\x\par
\the\test

\directlua{
  local t = lua.get_functions_table()
  t[\string#t + 1] = userdata.test
  token.set_lua("test", userdata.test, \string#t, "protected")
}
\meaning\test\par
\edef\x{\test}\meaning\x\par
\the\test

\bye


However, the second \the\test fails with the following error:


! You can't use `luacall 0' after \the.
l.21 \the\test


Is this asymmetry between luacalls and regular macros intended? Is
there a workaround where I can have a luacall that doesn't expand
inside of \edef but still expands after \the?

Cheers, Henri
___
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
___


Re: [NTG-context] pgfplots module wrecks in latest

2023-01-16 Thread Henri Menke via ntg-context
On Mon, 2023-01-16 at 11:56 -0500, Aditya Mahajan wrote:
> 
> On Mon, 16 Jan 2023, Hans Hagen via ntg-context wrote:
> 
> > just load tikz first so that the right loader helpers are there
> > 
> > \usemodule[tikz]
> > \usemodule[pgfplots]
> > 
> > \starttext
> > Hello
> > \stoptext
> > 
> > seems to work here
> 
> I did a fresh install of context and downloaded the latest version of
> pgf/tikz and pgfplots from ctan. Now, something is wrong with tikz:
> 
> \usemodule[tikz]
> 
> \starttext
> Hello
> \stoptext
> 
> gives the attached log file. Not sure what changed on the tikz end. 

That's most likely due to

https://github.com/pgf-tikz/pgf/issues/1062
https://github.com/pgf-tikz/pgf/pull/1073

but this MWE

\catcode`\@=11

\begingroup
  \lccode`\~=`\"
  \lowercase{\endgroup
\def\pgfmath@catcodes{%
  \catcode`\==12 %
  \catcode`\,=12 %
  \catcode`\|=12 %
  \catcode`\&=12 %
  \let~\pgfmath@char@quote
}}%

{\pgfmath@catcodes "}

\bye

works in Knuth TeX, so it's likely not our fault.

Cheers,
Henri

> 
> Thanks,
> Aditya
> 

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


Re: [NTG-context] Containerized ConTeXt

2022-12-14 Thread Henri Menke via ntg-context
The Island of TeX builds Docker images for ConTeXt weekly.

https://gitlab.com/islandoftex/images/context

registry.gitlab.com/islandoftex/images/context:lmtx

Cheers, Henri

On Tue, 2022-12-13 at 20:56 -0800, Thangalin via ntg-context wrote:
> Hi again,
> 
> I've added the start of a podman container for invoking ConTeXt that
> may be of interest:
> 
> https://github.com/DaveJarvis/keenwrite/tree/main/container
> 
> The Containerfile sets up ConTeXt to work with my themes:
> 
> https://github.com/DaveJarvis/keenwrite-themes
> 
> The manage.sh shell script is a wrapper around the podman command to
> help build, save, and load the container, as well as connect and run
> commands. It's a work-in-progress.
> 
> My goal is to simplify the setup and configuration of ConTeXt as well
> as make the instructions "cross platform" owing to containerization.
> From there, I want to call out to the container from KeenWrite to
> typeset PDF documents using one of the themes. Further, I'd like to
> have KeenWrite download and install ConTeXt automatically using
> podman. I believe this will make it easier for people to generate
> high-quality PDFs from (R) Markdown documents because they'd only
> have
> to download KeenWrite, then ask KeenWrite to download/configure
> ConTeXt automatically, in a cross-platform fashion.
> 
> Thoughts? Suggestions for improvement?
> _
> __
> 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
___


Re: [NTG-context] Microtipography

2022-05-25 Thread Henri Menke via ntg-context
On Wed, 2022-05-25 at 15:51 +0200, Tommaso Gordini via ntg-context
wrote:
> Hello list,
> 
> here and there on the Net there are slightly different ways to
> activate the
> microtypography functionality in a ConTeXt document.
> 
>  My question is: what is the most correct and clean way to do it?

I do not claim that this is the cleanest way. Probably it's better to
define a separate font feature for microtypography rather than
overwriting the default set, but this definitely works:

   \definefontfeature[default][default]
 [protrusion=quality,
  expansion=quality]
   
   \setupbodyfont[modern] % or whatever
   
   \setupalign[hz,hanging]

Unfortunately the global alignment settings do not propagate into
certain structures. For example itemizations, captions, and
bibliographies just reset it and need special treatment:

   \setupitemize[each][align={hz,hanging}]
   \setupbtxlist[align={hz,hanging,tolerant}]
   \setupcaption[figure][align={justified,hz,hanging}]

I think captions are not justified by default, so that might or might
not matter to you. Bibliographies are usually full or names and
academic words that do not hyphenate well, so adding tolerant relaxes
that a little bit.

Cheers, Henri

> 
> Thanks in advance
> Tommaso
> _
> __
> 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] Syntax highlighting using LMTX

2021-12-02 Thread Henri Menke via ntg-context
On Thu, 2021-12-02 at 12:07 -0500, Aditya Mahajan via ntg-context
wrote:
> On Thu, 2 Dec 2021, Thangalin via ntg-context wrote:
> 
> > Hi all,
> > 
> > There are a few technical hurdles with using the t-vim module in
> > LMTX.
> > First, users need to install the module using externally defined
> > shell
> > scripts. Second, it's awkward to communicate to users how to install
> > it,
> > especially for Windows users. Third, it likely requires installing
> > vim, as
> > a separate step. Fourth, making general-purpose XML setups that
> > optionally
> > rely on syntax highlighting when it is an optional install is a
> > little
> > laborious.
> > 
> > If installing a module was as easy as "install.sh --module=t-vim"
> > then that
> > would leap over most hurdles. 
> 
> You can always install manually as follows:
> 
> cd $TEXMFHOME
> wget
> https://mirrors.ctan.org/macros/context/contrib/context-{filter,vim}.zip
> unzip context-{filter,vim}.zip
> 
> > Although there'd still be a dependency on installing vim. 
> 
> Yes, that's a trade-off that the vim module makes. But, last time I
> used Windows (some 10 years ago), installing vim was relatively easy.
> Download the install from vim's website, and click next a couple of
> times. 
> 
> > How would you go about creating a syntax highlighter for Java that
> > can work
> > with LMTX? 
> 
> I'll let others answer that. Had I known that, I wouldn't have written
> a module to do syntax highlighting :-) In the end, it also depends on
> how refined a syntax highlighter you want. Writing a simple keyword
> based highlighter is relatively easy. See, for example, scite-context-
> lexer-cpp.lua in the distribution, which is based on the CPP lexer in
> scite.

I wrote an answer here some time ago.
https://tex.stackexchange.com/questions/333508/custom-pretty-printer-in-context

Cheers, Henri

> 
> Aditya
> ___
> 
> 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] Does the ConTeXt distro come with a PDFViewer?

2021-10-09 Thread Henri Menke via ntg-context
On Sat, 2021-10-09 at 18:47 +0200, Hans Hagen via ntg-context wrote:
> On 10/9/2021 3:07 PM, Ramkumar KB via ntg-context wrote:
> > Hello Community,
> > 
> > If my memory serves me correctly, I might have noticed (in one of the
> > presentations during the recent ConTeXt meeting) that the distro
> > comes 
> > with a PDFViewer. Is that a correct assumption?
> > 
> > I am currently using a VSCode extension for PDFViewing but it does
> > not 
> > work very reliably.
> just use an external one, normally it will update automatically (on 
> windows sumatrapdf is pretty ok, on linux i'd probably use okular 
> because mupdf has no real gui)

I know of two muPDF GUIs:

- llpp https://github.com/moosotc/llpp
- zathura https://pwmt.org/projects/zathura/

Both are fairly minimalistic, but if you only want to display pages
they do the job. Zathura also supports synctex.

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


___
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] running tikz

2021-10-01 Thread Henri Menke via ntg-context
On Thu, 2021-09-30 at 14:52 -0400, Aditya Mahajan via ntg-context
wrote:
> On Thu, 30 Sep 2021, Henri Menke via ntg-context wrote:
> 
> > On Thu, 2021-09-30 at 11:57 +0200, Alain Delmotte via ntg-context
> > wrote:
> > > Hi!
> > > 
> > > I would like to use tikz to benefit of the package "pgf-soroban"
> > > I
> > > did write for LaTeX (after adapting it and before, later, to
> > > translate it to metapost).
> > > 
> > > I did try the sample program from the tikz manual, but I get an
> > > error
> > > saying that "t-pgf.tex" is not found; but it is in the tree of
> > > ConTeXt-lmtx.
> > > 
> > > How to make all the files in the distribution known to the
> > > compiler?
> > 
> > 
> > Note that there is currently no proper support for LMTX in
> > PGF/TikZ.
> > 
> > https://github.com/pgf-tikz/pgf/issues/990
> 
> Interesting... it seems that only a few features don't work. I
> regularly use pgfplots, and haven't noticed any compatibility issues
> in my examples.
> 
> What will be needed to add a LMTX "driver" for TikZ? Porting pgfsys-
> luatex.def to pgfsys-luametatex.def? Or is something else also
> needed?

Yes, there would have to be a pgfsys-luametatex.def and some detection
code to switch the driver appropriately but that latter part is easy.
I'm not too sure what is needed for the former though for LMTX.

When I last looked at it about a year ago it was completely unusable
with the LuaTeX driver because position tracking primitives were
removed (\pdflastxpos, \pdflastypos) and box keywords had changed
(\hbox dir TRT). Some catcode trickery in pgfplots also had stopped
working (https://github.com/pgf-tikz/pgfplots/pull/353).

As Hans mentioned in another message, the PDF resource management has
changed (if I understand it correctly), so things like shadings and
patterns would have to be adjusted.

Cheers, Henri

> Aditya
> ___
> 
> 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] running tikz

2021-09-30 Thread Henri Menke via ntg-context
On Thu, 2021-09-30 at 11:57 +0200, Alain Delmotte via ntg-context
wrote:
> Hi!
> 
> I would like to use tikz to benefit of the package "pgf-soroban" I
> did write for LaTeX (after adapting it and before, later, to
> translate it to metapost).
> 
> I did try the sample program from the tikz manual, but I get an error
> saying that "t-pgf.tex" is not found; but it is in the tree of
> ConTeXt-lmtx.
> 
> How to make all the files in the distribution known to the compiler?


Note that there is currently no proper support for LMTX in PGF/TikZ.

https://github.com/pgf-tikz/pgf/issues/990

Cheers, Henri

> 
> Thanks,
> 
> Alain
> 
> %% ConTeXt file
> 
> \usemodule[tikz]
> \starttext
> We are working on
> \starttikzpicture
> \draw (-1.5,0) -- (1.5,0);
> \draw (0,-1.5) -- (0,1.5);
> \stoptikzpicture.
> \stoptext
> _
> __
> 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] Curiosity about math.random in LuaTeX

2021-08-23 Thread Henri Menke via ntg-context
On Mon, 2021-08-23 at 17:24 +0200, Hans van der Meer via ntg-context
wrote:
> I guess the underlying library calls are from Lua5.4? Then it is
> perhaps useful to know that between 5.3 and 5.4 there is mentioned a
> new implementation for math.random. Perhaps it changes the sequence of
> random values generated? Someone who knows?

https://tex.stackexchange.com/questions/468466/tikz-graphdrawing-differences-between-luatex-versions

Cheers, Henri

> 
> dr. Hans van der Meer
> 
> 
> > On 23 Aug 2021, at 17:13, Hans Hagen via ntg-context <
> > ntg-context@ntg.nl> wrote:
> > 
> > On 8/23/2021 4:46 PM, Thierry Horsin via ntg-context wrote:
> > > Hi everybody.
> > > I wonder how does math.random() work in context. I found that this
> > > subject was discussed more than ten years ago by Otared and Taco
> > > and Thomas. It is clear to me how to obtain new results upon
> > > typesetting the same file by changing the value of math.randomseed
> > > (with os.time()).
> > > If you don't change the seed, you get the same result upon each
> > > typesetting, and a seed is given in the .tuc file.
> > > For example I have this:
> > > ["randomseed"]=0x1.0741c18b8a4ep-6
> > > How do I use (and is it possible to) this value to have the same
> > > result of math.random() upon typesetting another file (with a
> > > different name) ?
> > > I could provide a same fixed seed in both files, but for some
> > > reasons I would like to re-use some previous results of
> > > math.random() for which no seed was initially given in another .tex
> > > file.
> > You have to go low level ...
> > 
> > % \ctxlua{utilities.randomizer.setseed(0x1.0741c18b8a4ep-6)}
> > % \ctxlua{utilities.randomizer.setseed(0x1.6822232009d5p-5)}
> > 
> > \setrandomseed{123}
> > 
> > \starttext
> >    test \randomnumber{1}{100}
> >    test \randomnumber{1}{100}
> >    test \randomnumber{1}{100}
> > \stoptext
> > 
> > btw, the 0x representation is lua's low level binary representation
> > of a double.
> > 
> > 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
> > _
> > __
> 
> ___
> 
> 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] Curiosity about math.random in LuaTeX

2021-08-23 Thread Henri Menke via ntg-context
On Mon, 2021-08-23 at 16:46 +0200, Thierry Horsin via ntg-context
wrote:
> Hi everybody.
> 
> I wonder how does math.random() work in context. I found that this
> subject was discussed more than ten years ago by Otared and Taco and
> Thomas. It is clear to me how to obtain new results upon typesetting
> the same file by changing the value of math.randomseed (with
> os.time()).
> 
> If you don't change the seed, you get the same result upon each
> typesetting, and a seed is given in the .tuc file.
> 
> For example I have this:
> ["randomseed"]=0x1.0741c18b8a4ep-6
> 
> How do I use (and is it possible to) this value to have the same
> result of math.random() upon typesetting another file (with a
> different name) ?
> 
> I could provide a same fixed seed in both files, but for some reasons
> I would like to re-use some previous results of math.random() for
> which no seed was initially given in another .tex file.

You can immediately forget about that, because in the past Lua has
switched the random number generator (RNG) between releases and also
uses a different RNG depending on the operating system. In general it
is a really bad idea to depend on the exact sequence of random numbers.

As an alternative you can just pregenerate a list of random numbers and
copy that to other documents.

Cheers, Henri

> 
> Thank you
> Thierry
> _
> __
> 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
___