[NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-25 Thread Joey McCollum via ntg-context
I wasn't aware of a general-purpose "doifstartswith" macro in ConTeXt (the
\doifnextcharelse macro only works one character at a time, and the
\doifinstring macros may capture substrings that are not prefixes), and I'd
like to develop one for something I'm working on. I've been trying to do
this in Lua, as that seemed like the most natural approach. Normally,
something like this would work fine as a foundation:

```
  function isprefix(prefix, str)
if string.sub(str, 1, string.len(prefix)) == prefix then
  return true
end
return false
  end
```

Unfortunately, if I want to check for prefixes that include two-byte
characters like § and ¶, then the positions and string lengths that I
specify no longer correspond to the actual byte offsets and lengths that
Lua uses. I'm aware of the utf8 plugin that was intended to address this
issue, but the following code also isn't working:

```
  function sbl.isprefix(prefix, str)
-- lua is devious and measures string length in bytes, not chars,
-- so we can't just use string.sub and string.len as we normally would.
local i = utf8.offset(str, 1)
local j = utf8.offset(str, utf8.len(prefix) + 1) - 1
if string.sub(str, i, j) == prefix then
  return true
end
return false
  end
```

The only other detail that may be relevant is that I'm passing a macro as
the "str" input. But this should be expanded when the Lua code is
manipulating it, right?

I'm sure there's something obvious that I'm doing wrong, but I've been
trying to get this to work for at least a couple hours now, and I don't
know what else to try. If there is a simple fix to my Lua code or an
existing ConTeXt macro that will get the job done, I'd appreciate it!

Joey
___
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] Neovim and ConTeXt

2021-11-25 Thread Clint Grady via ntg-context
> But, Vim and NeoVim have diverged enough that they should be considered
> totally different (and incompatible) programs. The new version of the
> ConTeXt plugin (which is not shipped yet) is written in Vim9 script,
> which NeoVim does not implement. My time is limited, so I can't support
> both platforms, and I have decided to stick with Vim. If anyone wants to
> try the new plugin, feel free to contact me via email.

I'd be very happy to try the new version of the plugin. I'm also happy to work 
on porting it to NeoVim. 

Clint

On Thu, 25 Nov 2021, at 15:46, Nicola via ntg-context wrote:
> On 2021-11-24, Aditya Mahajan via ntg-context  wrote:
> > I don't know what is the current state of context syntax highlighting
> > support in vim/neovim (I use a highly modifies syntax file). It will
> > be nice to have support of \startMP(code|page) and \startluacode to do
> > syntax highlighting for metapost and lua.
> 
> I maintain the ConTeXt's plugin for Vim. It has async compilation
> support, and context-sensitive (pun not intended) syntax highlighting.
> All is explained in the wiki. I would expect syntax highlighting and
> mappings to be functional in NeoVim, too (async jobs are incompatible
> with NeoVim, however).
> 
> But, Vim and NeoVim have diverged enough that they should be considered
> totally different (and incompatible) programs. The new version of the
> ConTeXt plugin (which is not shipped yet) is written in Vim9 script,
> which NeoVim does not implement. My time is limited, so I can't support
> both platforms, and I have decided to stick with Vim. If anyone wants to
> try the new plugin, feel free to contact me via email.
> 
> > Metafun has added some new keywords and it will be nice to support
> > those. I believe that context ships with a file that outputs all these
> > keywords but I don't remember the name.
> 
> Yes, that was added at my request (thanks Hans!). The command is:
> 
> mtxrun --script mtx-interface --vim
> 
> The next version of my plugin uses those. The version currently shipping
> with Vim was curated by hand, with the help of custom scripts to
> automate keyword extraction. It should be ok, although at this point not
> really up to date with the most recently added keywords.
> 
> > It will be cool to have a more integrated support, like showing table
> > of contents in the sidebar,
> 
> For that, I use the TagBar plugin, with custom Ctags configuration.
> Config is in the wiki!
> 
> > modifying the jump keys so that so that ]] etc work correctly (with
> > the context syntax)
> 
> The ConTeXt plugin in Vim does that. Again, take a look at the wiki.
> 
> Cheers,
> Nicola
> 
> 
> ___
> 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] Neovim and ConTeXt

2021-11-25 Thread Aditya Mahajan via ntg-context
On Thu, 25 Nov 2021, Nicola via ntg-context wrote:

> Again, take a look at the wiki.

Noted! Time to update my decade old setup (but I have moved completed to the 
neovim camp). 

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
___


Re: [NTG-context] Neovim and ConTeXt

2021-11-25 Thread Nicola via ntg-context
On 2021-11-24, Aditya Mahajan via ntg-context  wrote:
> I don't know what is the current state of context syntax highlighting
> support in vim/neovim (I use a highly modifies syntax file). It will
> be nice to have support of \startMP(code|page) and \startluacode to do
> syntax highlighting for metapost and lua.

I maintain the ConTeXt's plugin for Vim. It has async compilation
support, and context-sensitive (pun not intended) syntax highlighting.
All is explained in the wiki. I would expect syntax highlighting and
mappings to be functional in NeoVim, too (async jobs are incompatible
with NeoVim, however).

But, Vim and NeoVim have diverged enough that they should be considered
totally different (and incompatible) programs. The new version of the
ConTeXt plugin (which is not shipped yet) is written in Vim9 script,
which NeoVim does not implement. My time is limited, so I can't support
both platforms, and I have decided to stick with Vim. If anyone wants to
try the new plugin, feel free to contact me via email.

> Metafun has added some new keywords and it will be nice to support
> those. I believe that context ships with a file that outputs all these
> keywords but I don't remember the name.

Yes, that was added at my request (thanks Hans!). The command is:

mtxrun --script mtx-interface --vim

The next version of my plugin uses those. The version currently shipping
with Vim was curated by hand, with the help of custom scripts to
automate keyword extraction. It should be ok, although at this point not
really up to date with the most recently added keywords.

> It will be cool to have a more integrated support, like showing table
> of contents in the sidebar,

For that, I use the TagBar plugin, with custom Ctags configuration.
Config is in the wiki!

> modifying the jump keys so that so that ]] etc work correctly (with
> the context syntax)

The ConTeXt plugin in Vim does that. Again, take a look at the wiki.

Cheers,
Nicola


___
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] Backmatter preventing section numbers from appearing

2021-11-25 Thread Hans Hagen via ntg-context

On 11/25/2021 10:50 AM, A A via ntg-context wrote:

Dear All,

I've noticed that the mere presence of backmatter prevents my sections 
from being numbered. Consider the following:


/\starttext
\startsection[
   title={Create Serverless Applications},
]
blablabla
\stopsection

%\startbackmatter % comment out
%\stopbackmatter % comment out
\stoptext/
/
/
Uncommenting lines 8 and 9 causes the section numbers to disappear.

Is this normal behavior? Why does the presence of backmatter affect my 
sections like this?
technically there can be many so called sectionblocks in any order and 
as one is chosen and no previous one has been set, all preceding sec 
tions will end up in that first block (kind of fix the structure) .. 
this is needed to get things like bookmarks right


so ... when you use sectionblocks used them consistently i.e. use 
bodymatter wrapping for the preceding sections



-
  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] update lmtx

2021-11-25 Thread Hans Hagen via ntg-context

On 11/25/2021 12:22 PM, Alain Delmotte via ntg-context wrote:

Hi,

In the new upload for Windows 10/64 there is a new file "modules.bat".

When I did launch it it went through all my harddisk and most of the 
time there was a line saying:


"File has vanished..." those were about files outside the context-lmtx 
folder. (See the two attached images)


I crashed the action.
afaik there is no modules.bat file and looking at your screen shots i 
see all kind of files that are not in lmtx so something fishy is 
happening on your machine


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] update lmtx

2021-11-25 Thread Alain Delmotte via ntg-context

  
  
Hi,
In the new upload for Windows 10/64
there is a new file "modules.bat".
When I did launch it it went through
all my harddisk and most of the time there was a line saying:
"File has vanished..." those were
about files outside the context-lmtx folder. (See the two
attached images)
  
I crashed the action.
How can I have the modules installed
in "C:\Users\Alain\context-lmtx\tex" and have the module use
working?
Thanks,
Alain
  
Le 22/11/2021 à 22:37, Hans Hagen via
  ntg-context a écrit :

Hi,
  
  
  We're still working on the math so updated lfg files buit not many
  other things apart from a few fixes.
  
  
  In the process I ran into another area where ms eems to take the
  lead:
  
  
https://devblogs.microsoft.com/math-in-office/unicode-math-braille-sequences/
  
  
  and although it aims at msword I gave that a go for context so we
  now have a "braille-basic" module (style) that we (can) use (and
  run as demo) for playing with math spacing because we basically
  have a monospace font. If there is any interest in braille as
  alternative output we can extend that. I'm pretty sure that we
  need to adapt some (general spacing related) presets to this
  situation.
  
  
  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
___


[NTG-context] Backmatter preventing section numbers from appearing

2021-11-25 Thread A A via ntg-context
Dear All,

I've noticed that the mere presence of backmatter prevents my sections from
being numbered. Consider the following:










*\starttext\startsection[  title={Create Serverless
Applications},]blablabla\stopsection%\startbackmatter % comment
out%\stopbackmatter % comment out\stoptext*

Uncommenting lines 8 and 9 causes the section numbers to disappear.

Is this normal behavior? Why does the presence of backmatter affect my
sections like this?

Regards,

Amine
___
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] Automatic counting groupsuffix for subfigures

2021-11-25 Thread Hans Hagen via ntg-context

On 11/24/2021 10:19 AM, Marco Patzer via ntg-context wrote:

Hi!

I'd like to use subfigure numbering for floats. This works:

\useMPlibrary [dum]
\starttext

\startplacefigure [location=none]
   \startfloatcombination [nx=2]
 \startplacefigure [title=Left, reference=ref:left, group=one, 
groupsuffix=a]
   \externalfigure
 \stopplacefigure
 \startplacefigure [title=Right, reference=ref:right, group=one, 
groupsuffix=b]
   \externalfigure
 \stopplacefigure
   \stopfloatcombination
\stopplacefigure

See \in{image}[ref:right] (right) and \in{image}[ref:left] (left).
\stoptext

The output is correct, but the usage is verbose. I'd like to replace
the manual groupsuffix numbering with something automatic. ConTeXt
uses automatic numbering in many places so it seems strange to
number the subfigures manually.

I have tried using counters and labels, but something is always
messed up and I couldn't get it to work.

How to achieve automatic subfigure numbering without specifying the
groupsuffix manually?
sort of tricky due to multipass and other synchronizations although in 
the end some 20 lines of code can do it ... i'll send you and wolfgang a 
test file with a more native feature


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] adjusting vertical space

2021-11-25 Thread jbf via ntg-context
That was the clue I needed - in particular the use of minus values, 
which I had entirely overlooked. And since \vskip works, so, therefore, 
does simple \blank with a minus value (and better style!), and for that 
matter also \hskip to make micro horizontal adjustments. In the end, so 
simple and another lesson learned - look to the simple rather than the 
more complicated solutions first.


Thank you for the patient mentoring.

Julian

On 25/11/21 7:22 pm, Henning Hraban Ramm via ntg-context wrote:

Am 25.11.21 um 00:06 schrieb jbf via ntg-context:
The following MWE produces a passable result for a half-title page, 
but I need to reduce the vertical space between 'A JOURNEY' and 'from 
the' so that the 'h' of the 'the' is just touching the baseline of 
the 'R' in JOURNEY. At the moment there is some distance between them.


I thought I could do this with \setupinterlinespace[] (not 
represented in the MWE because it did not work) but no matter what 
dimensions I put in there, it makes no difference. Is there another 
way I can make infinitesimal adjustments to distance between the two 
lines in question?


You can try \offset[y=-3pt]{your text} or \vskip-3pt

Not good style, but could work.

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] adjusting vertical space

2021-11-25 Thread Thomas A. Schmitz via ntg-context


On 11/25/21 00:06, jbf via ntg-context wrote:

The following MWE


You do know what MWE stands for, right?

Thomas
___
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] adjusting vertical space

2021-11-25 Thread Henning Hraban Ramm via ntg-context

Am 25.11.21 um 00:06 schrieb jbf via ntg-context:
The following MWE produces a passable result for a half-title page, but 
I need to reduce the vertical space between 'A JOURNEY' and 'from the' 
so that the 'h' of the 'the' is just touching the baseline of the 'R' in 
JOURNEY. At the moment there is some distance between them.


I thought I could do this with \setupinterlinespace[] (not represented 
in the MWE because it did not work) but no matter what dimensions I put 
in there, it makes no difference. Is there another way I can make 
infinitesimal adjustments to distance between the two lines in question?


You can try \offset[y=-3pt]{your text} or \vskip-3pt

Not good style, but could work.

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
___