Re: [NTG-context] Text editors

2023-03-26 Thread Nicola via ntg-context
On 2023-03-26, Alexandre Christe via ntg-context  wrote:
> Dear ConTeXt users,
>
> I'm wondering what kind of typesetting system / syntax highlighting /
> completion you're using.
> [...]
> Open to anything from vim/neovim to emacs or more exotic. Maybe it would be
> nice to show the config. (And yes I've seen the Wiki page
> https://wiki.contextgarden.net/Text_Editors but I've the feeling some
> content is outdated.)

Vim offers good support for ConTeXt and MetaPost out of the box (I
maintain those filetypes). The Vim page in ConTeXt Garden is up
to date, afaict, but of course it is always better to check Vim's help
file for the most up-to-date information (`:help ft-context`).

Syntax highlighting is based on files generated by mtxrun: the help file
explains how to regenerating them if necessary, so you may stay in sync
with your ConTeXt installation.

Completion is kind of an orthogonal matter: there are quite a lot of
plugins for Vim if the built-in methods do not satisfy you. Again, the
wiki page has some suggestions (those may be a bit outdated, as new
completion plugins pop up all the time). Fwiw, I use MUcomplete.

Hope this helps!
Nicola

___
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] (any) neovim users?

2022-10-14 Thread Nicola via ntg-context
On 2022-10-14, Alan Braslau via ntg-context  wrote:
> On Fri, 14 Oct 2022 16:48:42 - (UTC)
> Nicola via ntg-context  wrote:
>
>> On 2022-10-14, Alan Braslau via ntg-context 
>> wrote:
>> > A recent upgrade of the editor neovim leads to the following error
>> > when using % identification at the head of .tex source
>> > files.
>>
>> The ConTeXt plugin (as well as MetaPost and MetaFont ones) has
>> recently been rewritten in Vim 9 script (the new scripting language
>> embedded in Vim), which NeoVim does not support, afaik. See this
>> thread: https://github.com/vim/vim/issues/10968.
>>
>> One thing you can do is: grab the old runtime files and put them in
>> you own ~/.vim directory (following a similar layout). You may get
>> those from the `runtime` folder of the Vim project:
>> https://github.com/vim/vim, or from NeoVim repo. Just checkout
>> a revision with the old scripts (searching for "update runtime" in the
>> commit logs should help you filter the relevant commits).
>>
>> Nicola
>
> Thank you,
>
> I wonder why a lua error is reported?

Sorry, I should have said that I am only *assuming* that what I wrote
may be the reason for the error. In fact, I have now tried to open
a file starting with %, and I get no error. This with NeoVim
v0.7.2.

> I also worry that %@context support has now diverged (for whatever
> reason) and that Context highlighting is now limited to the one "vim"
> variant of the vi editor. Using old runtime files in one's personal
> .vim directory locks one into unmaintained (by the Context community)
> syntax. I wish that a better solution were available.

I am the current maintainer of the ConTeXt/MetaPost/METAFONT plugins.
I do not use NeoVim, and maintaining a plugin compatible with both
systems would be too much of a headache (I know because I have tried
with other plugins). I think that the ConTeXt plugin was not fully
functional in NeoVim even before switch to Vim 9 script (async
typesetting was based on Vim API and, last time I checked, NeoVim had an
incompatible API).

Switching to Vim 9 script has many advantages, as Bram has explained in
the thread I have linked to. So, I believe that it is only natural that
Vim's runtime will gradually move towards Vim 9 script.

Yours is a valid concern, but maintaining (Neo)Vim plugins is
a community effort. I took over the development of the ConTeXt plugin
because I wanted to improve the support for ConTeXt in Vim, and at the
time the plugin had no active maintainer. In the same way, an
unsatisfied user might take over the development of a ConTeXt plugin for
NeoVim, or maybe even for both systems. Anyone can submit a patch, and
I would welcome a co-maintainer, or even someone who would like to take
over. I alone simply do not have enough capacity to wet my feet in two
rivers.

Indeed, if you or someone reading this would like to steer the direction
of future development of those plugins, let me know!

Nicola

___
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] (any) neovim users?

2022-10-14 Thread Nicola via ntg-context
On 2022-10-14, Alan Braslau via ntg-context  wrote:
> A recent upgrade of the editor neovim leads to the following error
> when using % identification at the head of .tex source files.

The ConTeXt plugin (as well as MetaPost and MetaFont ones) has recently
been rewritten in Vim 9 script (the new scripting language embedded in
Vim), which NeoVim does not support, afaik. See this thread:
https://github.com/vim/vim/issues/10968.

One thing you can do is: grab the old runtime files and put them in you
own ~/.vim directory (following a similar layout). You may get those
from the `runtime` folder of the Vim project:
https://github.com/vim/vim, or from NeoVim repo. Just checkout
a revision with the old scripts (searching for "update runtime" in the
commit logs should help you filter the relevant commits).

Nicola

___
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] MetaFun keywords extracted by mtxrun --script interface

2022-08-10 Thread Nicola via ntg-context
I am updating Vim syntax coloring for Metapost/MetaFun, which is now
based on the files that are automatically generated with

mtxrun --script interface --vim

To test the results, I am opening ConTeXt's own MetaPost files in the
editor and check how they look. It seems that the output of the above
command is missing several "keywords". For instance: beginglyph,
endglyph, anglestriped, numberstriped, roundedsquarexy, starring,
dashing, pathpoint, primitive, immutable, etc. Is it because MetaFun
keywords are picked up manually?

Nicola

___
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] how to setup path of ConTeXtLMTX for MacVim?

2021-12-15 Thread Nicola via ntg-context
On 2021-12-14, Jeong Dal via ntg-context  wrote:
> Although you have explained about the way out of my problem,
> I am still in the problem.

I am maintaining the ConTeXt plugin for Vim, and I also use MacVim: feel
free to contact me off list to help you iron out your issues (email in
the source code of the plugin).

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] how to setup path of ConTeXtLMTX for MacVim?

2021-12-14 Thread Nicola via ntg-context
On 2021-12-13, Jeong Dal via ntg-context  wrote:
> Dear John, Nicola,
>
> I created a file context.vim under the folder ~/.vim/after/ftplugin/ which 
> contains
>
> map > :w:!ConTeXt
> let g:context_mtxrun = 'PATH=$HOME/ConTeXtLM/tex/texmf-osx-64/bin:$PATH 
> mtxrun'
> let g:tex_flavor = "context"
>
> The result is
> 1. using “:ConTeXt”   issued an error message:  “E492: not an editor command: 
> ConTeXt

:ConTeXt is a buffer-local command, which means that it is available
only when the active buffer has filetype `context`. Make sure that this
is the case before trying to typeset.

> 2. using “make” issued an error message: "No targets specified and no 
> makefile found. …"

Again, I believe that you are typing those commands with an active
buffer whose filetype is not `context`.

> Pressing C-h, compiling started and succesfully ended. However, it use
> /usr/local/texlive/… not LMTX tex folder.

As already pointed out, ! invokes a shell command. Remove the
exclamation mark.

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] how to setup path of ConTeXtLMTX for MacVim?

2021-12-12 Thread Nicola via ntg-context
On 2021-12-11, Jeong Dal via ntg-context  wrote:
> Hi,
>
> Recently, I have a problem to use vscode, so I tried MacVim for ConTeXt.
> It worked fine. But it uses context in TeXLive instead of using it in 
> ConTeXtLMTX.
> I’d like to use LMTX which is installed in ~/ConTeXtLM/tex/...
>
> How to redirect the path for ConTeXt in MacVim?

This is explained at https://wiki.contextgarden.net/Vim. In a nutshell:

let g:context_mtxrun = 'PATH=$HOME/ConTeXtLM/tex/texmf-osx-64/bin:$PATH 
mtxrun'

You may put this line in your .vimrc or in
~/.vim/after/ftplugin/context.vim (creating the intermediate directories
and file if they do not exist).

Hope this helps,
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] Neovim and ConTeXt

2021-11-29 Thread Nicola via ntg-context
On 2021-11-26, Clint Grady via ntg-context  wrote:
> I'd be very happy to try the new version of the plugin. I'm also happy
> to work on porting it to NeoVim.

If my email is not visible through the mailing list (yours is not to
me), you may find it in the source code of the ConTeXt plugin in Vim
($VIMRUNTIME/ftplugin/context.vim).

Drop me a line and I will happily send you the pre-release version.

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] 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] Use of lettrine module in LMTX

2021-07-25 Thread Nicola
On 2021-07-23, Arthur Rosendahl  wrote:
> On Fri, Jul 23, 2021 at 03:10:59PM +0200, Gerben Wierda wrote:
>> I just made a remark on ConTeXtgarden not mentioning this.

I am guilty and apologize for the bad advice. But I'd like to point out
that not *all* the modules are out of date, so you may still want to
retain the directory. For instance, the one I rely upon is the vim
module for typesetting code, and that one is compatible with LMTX. There
may be others.

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] Use of lettrine module in LMTX

2021-07-21 Thread Nicola
On 2021-07-21, Gerben Wierda  wrote:
>> On 19 Jul 2021, at 09:56, Nicola  wrote:
>>
>> On 2021-07-18, Gerben Wierda  wrote:
>>> PS. switching \kap and \bf has an interesting result, the first
>>> character of the words is not in bold. This did not happen with
>>> lettrine in mkii
>>
>> I do not have an answer to your question, but I'd like to point out that
>> you can keep using lettrine with ConTeXt LMTX, if you wish. You just
>> need to add the modules manually, currently:
>>
>>https://wiki.contextgarden.net/Modules#ConTeXt_LMTX
>
> I’ve tried this. Installed the modules and then I get with

I was sure that I had used lettrine with MKIV in a document of mine, but
after your reply I double checked that and, in fact, I was using
lettrine only with MKII. On the plus side, I have recovered my settings
for MKIV (which work with LMTX as well).

I think that the `distance` parameter of \setupinitials does what you
want. Besides, if your font provides real small capitals, you may use
\definefirstline.

This is how I set up things in one of my documents:


\definefontfeature[default][default][protrusion=quality,expansion=quality,onum=no,lnum=yes]

% \definefirstline below requires a font that implements small capitals as
% a feature (Latin Modern does not). I have used this:
% \definefontfamily[mainfont][serif][Sorts Mill Goudy] [
%   tf=name:Sorts Mill Goudy Regular,
%   it=name:Sorts Mill Goudy Italic,
% ]
% If you don't have the font above, try this:
\setupbodyfont[heros]

\setupbodyfont[mainfont,11pt]

\definemeasure[CAindent][12pt]
\setupindenting[yes,\measure{CAindent}]

% Every chapter body text starts with a drop cap:
\defineinitial[normal][
  n=3,
  m=1,
  distance=18pt, % <== Add this 
  state=start
]

% Special case: drop cap starting with a quote
\defineinitial[quote][
  n=3,
  m=2,
  distance=13pt,
  hoffset=5pt, % Move drop cap a bit to the left
  method=none
]

% Some initials may need special adjustments, depending on the font
\defineinitial[Q][
  voffset=2\lineheight,
  n=3,
  m=1,
  distance=18pt,
  state=start
]

% Full first line in small caps
\definefirstline[smallcapsfirstline][
  alternative=line,
  style=smallcaps,
]

% First n words in small caps (three in this case)
\definefirstline[smallcapsfirstlinethree][
  alternative=word,
  n=3,
  style=smallcaps,
]

\starttext
\setfirstline[smallcapsfirstlinethree]
\setinitial[normal] Suppose we have a system for the approval of
loans. \input knuth
\blank[2*big]

\setfirstline[smallcapsfirstline]
\setinitial[quote] “Suppose we have a system for the approval of
loans.” \input knuth
\blank[2*big]

\setfirstline[smallcapsfirstline]
\setinitial[Q] Quo usque tandem abutere, Catilina, patientia nostra? quam diu
etiam furor iste tuus nos1 eludet? quem ad finem sese effrenata iactabit
audacia?

\stoptext


I hope this will give you some ideas!

References:

https://wiki.contextgarden.net/Command/setupinitial
https://wiki.contextgarden.net/Command/definefirstline
https://www.fontsquirrel.com/fonts/Sorts-Mill-Goudy

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] drop cap (initial) and indentation

2021-07-19 Thread Nicola
On 2021-07-18, Gerben Wierda  wrote:
> PS. switching \kap and \bf has an interesting result, the first
> character of the words is not in bold. This did not happen with
> lettrine in mkii

I do not have an answer to your question, but I'd like to point out that
you can keep using lettrine with ConTeXt LMTX, if you wish. You just
need to add the modules manually, currently:

https://wiki.contextgarden.net/Modules#ConTeXt_LMTX

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] [OT] TeXShop v4.66 adds support for new ConTeXt's syncing method

2021-07-08 Thread Nicola
On 2021-07-08, Nicola  wrote:
> I have brought TeXShop's page in the wiki up to date (I haven't touched
> what are currently §1.4 and §1.5)

Typo, sorry: I meant §1.5 and §1.6.

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
___


[NTG-context] [OT] TeXShop v4.66 adds support for new ConTeXt's syncing method

2021-07-08 Thread Nicola
For those who are interested, the latest TeXShop release provides
support for ConTeXt's own syncing method (by invoking mtxrun --script
synctex). This supersedes the old syncing method based on Laurens'
SyncTeX, which should not be used any more.

I have brought TeXShop's page in the wiki up to date (I haven't touched
what are currently §1.4 and §1.5), with instructions to get
synchronisation to work:

https://wiki.contextgarden.net/TeXShop

Make sure to read it carefully!

I have tested the feature for some time now, and I'd say that it works
pretty well (with some caveats, which I have annotated in the wiki).

I take the opportunity to thank Hans for being so responsive with the
changes in mtxrun necessary to provide this feature, and for patiently
bear with my sometimes unclear requests or feedback.

Kudos also to Richard Koch (TeXShop's author) for his relentless support
of the macOS TeX community and, in this case, of the ConTeXt community!

Happy ConTeXt'ing!
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
___


[NTG-context] Fatal error: return code: 256 with documents in ConTeXt's distribution

2021-06-18 Thread Nicola
I am trying to typeset some documents under

tex/texmf-context/doc/context/sources

with mixed results. I am using ConTeXt from TeX Live 2021, and the latest
LMTX (just rsync'ed). Results vary:

1. Successful in both cases:

$ /Library/TeX/texbin/mtxrun --script context --autogenerate 
mag--mkiv.tex
[...]
system  | total runtime: 5.074 seconds

$ ~/context-osx-64/tex/texmf-osx-64/bin/mtxrun --script context 
--autogenerate mag--mkiv.tex
[...
$ system  | total runtime: 3.323 seconds of 3.389 seconds

2. Fatal error with TeX Live vs apparently stuck with beta:

$ /Library/TeX/texbin/mtxrun --script context --autogenerate 
mag-1104-mkiv.tex
[...]
mtx-context | fatal error: return code: 256

$ ~/context-osx-64/tex/texmf-osx-64/bin/mtxrun --script context 
--autogenerate mag-1104-mkiv.tex
[...]
pages   > flushing realpage 7, userpage 6, subpage 7
pages   > flushing realpage 8, userpage 7, subpage 8
pages   > flushing realpage 9, userpage 8, subpage 9
[Gets stuck at this point, with luametatex using 100% CPU]

3. Fatal error in both cases:

$ /Library/TeX/texbin/mtxrun --script context --autogenerate 
mag-1102-mkiv.tex
[...]
mtx-context | fatal error: return code: 256

$ ~/context-osx-64/tex/texmf-osx-64/bin/mtxrun --script context 
--autogenerate mag-1102-mkiv.tex
[...]
mtx-context | fatal error: return code: 256

4.  Fatal error in TeX Live, successful with beta:

$ /Library/TeX/texbin/mtxrun --script context --autogenerate metafun.tex
[...]
mtx-context | fatal error: return code: 256

$ ~/context-osx-64/tex/texmf-osx-64/bin/mtxrun --script context 
--autogenerate metafun.tex
[...]
system  | total runtime: 10.509 seconds of 10.569 seconds

And so on.

The above tests were done in two different terminal windows, with $PATH
set accordingly. I have reported the full path to the executable for
clarity.

This is with Intel macOS. Is anyone able to reproduce these results? Or
should I search for something wrong with my setup?

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] How to write readable source files?

2021-05-30 Thread Nicola
On 2021-05-29, Hans Hagen  wrote:
> so what does vim expect? isn't there some kind of common format for lexers?

The output I need is very simple:

syn keyword Group1   ...
syn keyword Group2   ...
...

where Group1, Group2, ... define arbitrary groups of keywords. For
instance, for MetaFun I currently have `mpDef` (MetaPost def macro),
`mpVardef` (MetaPost vardef), `mpPrimaryDef`, `mpSecondaryDef`,
`mpTertiaryDef`, `mpCommand`, `mpConstant`, `mpVariable`, `mpType`,
`mpNewInternal`, and a few others. An excerpt from the current syntax
file looks like this:

...
" mp-base.mpiv
syn keyword mpNumExp   graypart
syn keyword mpType graycolor greycolor
syn keyword mpConstant cyan magenta yellow
" mp-butt.mpiv
syn keyword mpDef  predefinedbutton some_button
syn keyword mpConstant context_butt
" mp-char.mpiv
syn keyword mpDef  flow_begin_chart flow_begin_sub_chart
syn keyword mpDef  flow_chart_draw_comment flow_chart_draw_exit
...
syn keyword mpVardef   flow_xy_on_grid flow_xy_right flow_xy_top
syn keyword mpVardef   flow_y_on_grid
syn keyword mpVariable flow_arrowtip flow_chart_background_color
syn keyword mpVariable flow_chart_offset flow_comment_offset
syn keyword mpVariable flow_connection_arrow_size
...

This fine-grained classification allows for great flexibility when
defining syntax highlighting, because each group can have different
properties (and the user can customize that), although by default
several groups are highlighted in the same way (e.g., all macros have
the same highlighting by default).

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] How to write readable source files?

2021-05-29 Thread Nicola
On 2021-05-29, Hans Hagen  wrote:
> On 5/29/2021 5:03 PM, Nicola wrote:
>>> these lists are generated by mtx-interface so we can add more if needed
>>
>> Could you please elaborate on the (automatic?) data flow from ConTeXt's
>> source files to data files for each application? Is it:
>>
>> source code -> XML -> .lua -> mtx-interface -> data?
>>
>> In particular, it is not clear to me how i-*.xml files are related to
>> mtx-interface, as the latter does not use them directly, AFAICS.
>
> for sure it does

Ok, my cursory look was then… too cursory. I'll dig better.

>> Anyway, mtx-interface seems exactly what I am looking for, and I would
>> like to use it to generate ConTeXt keywords for Vim. Can I patch that
>> script?
>
> basically we only need
>
> function flushers.vim(collected)
> end

Ok.

>> For MetaFun keywords I don't know yet: do those XML files contain enough
>> information about the content of all mp-* source files? E.g., the fact
>> that `hlingrid` is a def? Looking at the Scite files, I see only
>> internals and commands, and they seem to cover only the "main" MetaFun
>> names.
>
> it is still on the agenda to make xml files for metafun but there is no
> timeline for that

So, is it correct that the XML files are automatically generated from
the source code, and kept in sync with it? If so, how is that done? Or
are they manually curated? I'd be willing to contribute to make progress
on the MetaFun part.

> just look at the files in the scite path ... much info is available, for
> context it comes from the xml files, for the tex engine and meta* it
> comes from mult* lua files

Ok, I'll look there.

> adding more detail (not sure if distinguishing between def and vardef
> makes sense ... we more use the 'primitive', 'lowlevel', 'interface'
> kind of grouping

Whatever you think is more appropriate... Provided that it can be parsed
automatically.

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] Synctex broken in LMTX ?

2021-05-29 Thread Nicola
On 2021-05-16, Hans Hagen  wrote:
> now, here is something to think about:
>
> >mtxrun --script synctex --list
> mtx-synctex | invalid synctex log file %a

I've got a positive feedback, and an agenda, from Richard Koch for
supporting ConTeXt's syncing mechanism (including the PDF->TeX
direction, which hopefully will land soon in beta, if it hasn't
already).

Just one clarification: does this work only for ConTeXt, or is it based
on LuaTeX regardless of what is being typeset?

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] How to write readable source files?

2021-05-29 Thread Nicola
On 2021-04-25, Hans Hagen  wrote:
>> If there is a way to automatically get a list of all ConTeXt commands
>> and options (and, ideally, MetaFun defs, types, and other keywords), I'd
>> be happy to improve omni-completion for ConTeXt in Vim.
> All is in xml files (i-*.xml) in the distribution maintained by
> Wolfgang. We ship with this for editors:
>
> >dir t:\texmf\context\data
>
> 04/21/2021  11:40 AM  scite
> 04/21/2021  11:40 AM  textadept
> 04/21/2021  11:40 AM  texworks
> 04/21/2021  11:40 AM  vscode
>
> these lists are generated by mtx-interface so we can add more if needed

Could you please elaborate on the (automatic?) data flow from ConTeXt's
source files to data files for each application? Is it:

source code -> XML -> .lua -> mtx-interface -> data?

In particular, it is not clear to me how i-*.xml files are related to
mtx-interface, as the latter does not use them directly, AFAICS.

Anyway, mtx-interface seems exactly what I am looking for, and I would
like to use it to generate ConTeXt keywords for Vim. Can I patch that
script?

For MetaFun keywords I don't know yet: do those XML files contain enough
information about the content of all mp-* source files? E.g., the fact
that `hlingrid` is a def? Looking at the Scite files, I see only
internals and commands, and they seem to cover only the "main" MetaFun
names.

I have used a custom script in the past for fine-grained keyword
extraction from MetaFun's source code. By fine-grained, I mean that the
output contains information about the kind of keyword (def, primary def,
vardef, constant, variable, etc.) I could update it to Lua and mp-*.mpxl
if that interests you—unless that has already been done, of course.

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] BibTeX inproceedings entries not rendered correctly in APA style

2021-05-28 Thread Nicola
On 2021-05-28, Alan Braslau  wrote:
> On Fri, 28 May 2021 13:02:10 -0400 (EDT)
> Aditya Mahajan  wrote:
>
>> > If you have not defined a publisher, how should ANY format place the
>> > undefined publisher's name?
>>
>> Simply leave it blank?
>
> If there is no publisher, then @unpublished is a better category. APA
> explicitly, and for good reason, accounts for self-publishing,
> indicating that the Author was the publisher.

Ah ok, that explains the output I was obtaining. So, I am using the
wrong bibliographic style for my purposes. In practice, at least in
Computer Science, publishers (and also editors) are often omitted in
references (it's more a "don't care", rather than a "don't know" thing,
though).

> If a publisher does not exist, was it published?
>
> If the publisher is unknown, then why not state that:
> publisher="unknown publisher", or whatever?

Strictly speaking, your reasoning makes perfect sense, and I am all for
enforcing constraints if a given bibliographic style requires them. But
then, there might be alternatives for when one does not need to adhere
to those styles. Does ConTeXt (LMTX) currently provide anything else
besides apa and aps?

I have read the BibTeX manual looong time ago, but I remember that there
were mandatory and optional fields for each reference type. My memory
may fail me, but I think that Editor and Publisher were not mandatory
fields for inproceedings and article (I think Publisher is mandatory for
book). Is there a bibliographic style in ConTeXt that follows those
rules?

Bibliography management is very sophisticated in ConTeXt (much more than
LaTeX) and I have not grasped all of its details yet. It seems to me
that it has also evolved quite a bit in recent years. So, the "ConTeXt
way" of doing bibliographies still eludes me to some extent.

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] t-vim module: no highlighting for custom filetypes

2021-05-28 Thread Nicola
>> >> Thanks. I have updated to version 2021.05.23 and run `mtxrun
>> >> --generate`. Syntax highlighting is fine, but with LMTX I'm still
>> >> getting an en-dash. Below, a MWE.
>> >
>> > Can you test if the file tests/vim/21-en-dash.tex works fine at your end:
>> >
>> > https://github.com/adityam/filter/blob/dev/tests/vim/21-en-dash.tex
>>
>> No, I get an en-dash with that, too. Log included below.
>
> For now, please use align=flushleft, either globally:
>
> \setupsyntaxhighlighting[align=flushleft]
>
> or as part of defining the typing environment:
>
> \definevimtyping[...][, align=flushleft, ...]

I can confirm that this workaround works for me.

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] t-vim module: no highlighting for custom filetypes

2021-05-27 Thread Nicola
On 2021-05-27, Aditya Mahajan  wrote:
> On Thu, 27 May 2021, Nicola wrote:
>
>> On 2021-05-24, Aditya Mahajan  wrote:
>> > On Fri, 21 May 2021, Nicola wrote:
>> >
>> >> I have only a minor annoyance: I have just noticed that -- is typeset as
>> >> an en-dash in LMTX (but not in MKIV, as documented). Could you look into
>> >> that?
>> >
>> > Fixed in the new release.
>>
>> Thanks. I have updated to version 2021.05.23 and run `mtxrun
>> --generate`. Syntax highlighting is fine, but with LMTX I'm still
>> getting an en-dash. Below, a MWE.
>
> Can you test if the file tests/vim/21-en-dash.tex works fine at your end:
>
> https://github.com/adityam/filter/blob/dev/tests/vim/21-en-dash.tex

No, I get an en-dash with that, too. Log included below.

Nicola

fonts   > beware: no fonts are loaded yet, using 'lm mono' in box
system  >
system  > ConTeXt  ver: 2021.05.27 14:15 LMTX  fmt: 2021.5.27  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'/Users/me/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'/Users/me/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname 'en-dash', input './en-dash', result 'en-dash'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 1, order 2, name './en-dash.tex'
modules > 'vim' is loaded
open source > level 2, order 3, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/vim/t-vim.tex'
loading > Vim syntax highlighting (ver: 2021.05.23)
modules > 'filter' is loaded
open source > level 3, order 4, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv'
loading > Filter (ver: 2020.06.29)
modules > 'module-catcodes' is loaded
open source > level 4, order 5, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv'
loading > Module Catcodes (ver: 2018.04.16)
close source> level 4, order 5, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv'
close source> level 3, order 5, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv'
modules > 'syntax-highlight' is loaded
open source > level 3, order 6, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/vim/t-syntax-highlight.mkxl'
loading > Code syntax highlighting (ver: 2021.05.24)
modules > 'syntax-groups' is loaded
open source > level 4, order 7, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/vim/t-syntax-groups.mkiv'
loading > Syntax highlighting groups (ver: 2021.05.23)
modules > 'module-catcodes' is already loaded
close source> level 4, order 7, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/vim/t-syntax-groups.mkiv'
modules > 'filter' is already loaded
close source> level 3, order 7, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/vim/t-syntax-highlight.mkxl'
suggestion  > use \withcedilla instead of \c
close source> level 2, order 7, name 
'/Users/me/Applications/context-osx-64/tex/texmf-modules/tex/context/third/vim/t-vim.tex'
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern-designsize rm 12pt' is loaded
open source > level 2, order 8, name 'en-dash-temp-LUA-0.vimout'
close source> level 2, order 8, name 'en-dash-temp-LUA-0.vimout'
backend > xmp > using file 
'/Users/me/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pages   > flushing realpage 1, userpage 1, subpage 1
close source> level 1, order 8, name './en-dash.tex'
system  > start used files
system  > text: en-dash
system  > stop used files
system  > start used files
system  >1: filename=char-prv.lua filetype=tex format=tex 
foundname=/Users/me/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/char-prv.lua
 
fullname=/Users/me/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/char-prv.lua
 usedmethod=database
system  >2: filename=lmmono10-regular filetype=otf format=otf 
foundname=/Users/me/Applications/context-osx-64/tex/texmf/fonts/opentype/public

Re: [NTG-context] BibTeX inproceedings entries not rendered correctly in APA style

2021-05-27 Thread Nicola
On 2021-05-25, Alan Braslau  wrote:
> On Mon, 24 May 2021 23:10:34 -0400
> Rik Kabel  wrote:
>
>>
>> On 5/24/2021 22:12, Alan Braslau wrote:
>> > On Mon, 24 May 2021 17:53:49 -0400
>> > Rik Kabel  wrote:
>> >
>> >> This is intended. Or rather, it is a side-effect of the intended
>> >> behavior.
>> >>
>> >> If you add an editor ("editor={Baz, Bar}") you will get something
>> >> like:
>> >>
>> >>  Foo, B. (1983). Title of the paper. In B. Baz (Ed.),
>> >> /Booktitle/. Author.
>> >>
>> >> And if you then add a publisher ("publisher={Paymefirst}") you will
>> >> get:
>> >>
>> >>  Foo, B. (1983). Title of the paper. In B. Bar (Ed.),
>> >> Booktitle. Paymefirst.
>> >>
>> >> The APA presumes that you have both an editor and a publisher for
>> >> pieces contained in other works. It calls for the use of the author
>> >> as publisher if no publisher is present. It is silent about what to
>> >> do if you have no editor.
>> > It looks like a missing editor field should be caught. What should
>> > the rule be?
>> >
>> > Actually, @inproceedings should not be used without an editor -
>> > makes no sense. If the author of the paper happens to be the
>> > editor, then the .bib data file should define this with an editor=
>> > field.
>> >
>> > We can change the behavior if a clear case can be made as to what
>> > fallback would make sense. Keep in mind the dictum: "garbage
>> > in/garbage out"...
>> >
>> > Alan
>>
>> For the case of works within works (inproceedings, inbook,
>> incollection, perhaps conference) I would think that the simplest
>> solution is to simply drop it, so that in the example above one would
>> simply get:
>>
>> Foo, B. (1983). Title of the paper. In /Booktitle/. Paymefirst.
>>
>> Although I do think that, at least for inproceedings, lack of an
>> editor should at least be flagged. A simple compilation of works may
>> have no named editor, of I see no reason to require it for inbook or
>> incollection. Cheap publishers regularly put out such collections of
>> out-of-copyright works.
>>
>> The implicit assumption that a work with no documented publisher is a
>> self-published work is not especially to my liking -- publishers may
>> have good reason to not identify themselves (think of the publishers
>> of the works of Spinoza and, in part, Voltaire) -- but I understand
>> that the APA thinks it important. Of course, if you cannot document
>> the publisher for an entry, you can explicitly list it as unknown or
>> /sine nomine/, as appropriate, to avoid the infelicity of having the
>> author's name just stuck in there.
>
> I sent a simple fix to Hans that handles the missing editor, silently.
> Someone who would want "Anonymous" or "unknown", or anything else can
> always put editor="Anonymous", etc. in their .bib database.

Thank you all for the precious comments.

The current LMTX appears to have almost fixed my issue, except that
inproceedings entries without a publisher have the text "Author"
instead of the publisher's name.

I must say that I have no requirement to use the APA style specifically;
I do it only because it uses the format (Name, Year) for the citation.
I guess that I could use another style (aps seems fine) and just
customize the citation format. I have tried with

\usebtxdataset[main.bib]
\setupbtx[default:cite][alternative=authoryear]
\usebtxdefinitions[aps]

but it seems that the setup command has no effect: the citations still
use numbers.

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] t-vim module: no highlighting for custom filetypes

2021-05-27 Thread Nicola
On 2021-05-24, Aditya Mahajan  wrote:
> On Fri, 21 May 2021, Nicola wrote:
>
>> I have only a minor annoyance: I have just noticed that -- is typeset as
>> an en-dash in LMTX (but not in MKIV, as documented). Could you look into
>> that?
>
> Fixed in the new release.

Thanks. I have updated to version 2021.05.23 and run `mtxrun
--generate`. Syntax highlighting is fine, but with LMTX I'm still
getting an en-dash. Below, a MWE.

Nicola

%
\usemodule[vim]

\startvimrc[name=pseudocode]
syntax keyword Statement while
syntax keyword Constant true
syntax region Comment start="--" end="\n" keepend
\stopvimrc

\definevimtyping[pseudocode][
  directory=code/, % NOTE: it MUST exist
  extras=pseudocode,
]

\starttext
  \startpseudocode
  while true -- Comment
  \stoppseudocode
\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
___


[NTG-context] BibTeX inproceedings entries not rendered correctly in APA style

2021-05-24 Thread Nicola
I don't know if this is restricted to inproceedings entries, but
consider the following test.bib:

@inproceedings{Foo:1983,
  author = {Foo, Bar},
  booktitle = {Booktitle},
  pages = {34--39},
  title = {Title of the paper},
  year = {1983}
}

When this is typeset:

\usebtxdataset[test.bib]
\usebtxdefinitions[apa]
\starttext
  \cite[Foo:1983]
  \placelistofpublications
\stoptext

the result is:

(Foo, 1983)
Foo, B. (1983). Title of the paper. In Title of the paper., Booktitle. Author.

I would expect:

(Foo, 1983)
Foo, B. (1983). Title of the paper. In Booktitle, p. 34–39.

or something similar.

I can reproduce it with ConTeXt from TeX Live 2021 and the current LMTX.
Is it a bug?

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] Define new symbol by stitching two symbols together

2021-05-24 Thread Nicola
On 2021-05-24, Aditya Mahajan  wrote:
> On Sun, 23 May 2021, Hans Hagen wrote:
>
>> On 5/22/2021 8:23 PM, Nicola wrote:
>> > I would like to define new symbols by stitching together existing
>> > glyphs. This is what I have come up so far:
>> >
>> >  \define[1]\Transition{-\!\![#1]\!\!\rightarrow}
>> >  \starttext
>> >  \m{L\Transition{A}R}
>> >  \stoptext
>> >
>> > This should render as -[ ]->, ideally with no space between the dash or
>> > the arrow and the brackets, i.e., -[ should appear like a single glyph;
>> > ditto for ]-->. With the definition above, however, the space is
>> > variable, and in some circumstances the gliphs overlap.
>> >
>> > How can I improve the above definition?
>> don't use these funny \! skips ... use some font related metric:
>>
>>  \define[1]\Transition{-\kern-1ex[#1]\kern-1.1ex\rightarrow}
>
> This is how we used to define arrows in the old days ...
>
> \define[1]\Transition{\relbar\joinrel\mathrel{[}#1\mathrel{]}\joinrel\rightarrow}
> \define[1]\BigTransition{\relbar\joinrel\relbar\joinrel\mathrel{[}#1\mathrel{]}\joinrel\relbar\joinrel\rightarrow}
>
> \starttext
> \m{L\Transition{A}R}
>
> \m{L\BigTransition{A}R}
> \stoptext

Thanks Hans, Aditya,

combining your ideas (\joinrel plus \kern) seems to work best for my use
case.

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
___


[NTG-context] Define new symbol by stitching two symbols together

2021-05-22 Thread Nicola
I would like to define new symbols by stitching together existing
glyphs. This is what I have come up so far:

\define[1]\Transition{-\!\![#1]\!\!\rightarrow}
\starttext
\m{L\Transition{A}R}
\stoptext

This should render as -[ ]->, ideally with no space between the dash or
the arrow and the brackets, i.e., -[ should appear like a single glyph;
ditto for ]-->. With the definition above, however, the space is
variable, and in some circumstances the gliphs overlap.

How can I improve the above definition?

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] t-vim module: no highlighting for custom filetypes

2021-05-21 Thread Nicola
On 2021-05-21, Aditya Mahajan  wrote:

> nvim was 8-10% faster than vim in my tests:
>
> https://adityam.github.io/context-blog/post/vim-vs-neovim/

Interesting, thanks for sharing.

> I actually want t-vim (or rather t-filter) to support more
> editors/syntax highlighters. At some stage I had added rudimentary
> support for other syntax highlighters most of them required
> scaffolding to wrap around the latex output:
>
> https://adityam.github.io/context-blog/post/clean-tex-output/

I think I have said that already, but it is worth repeating: t-vim is
a genius idea! Vim is universally available and it supports almost any
imaginable syntax. t-vim makes creating code-oriented documents
absolutely painless (ConTeXt helps, of course). And it makes me scream
when I have to do that in LaTeX. So, kudos for that. Personally, I do
not think that supporting other highlighters would add much value to
what is already there. But if it is possible to make the module more
general without overcomplicating it, it might be a good idea.

I have only a minor annoyance: I have just noticed that -- is typeset as
an en-dash in LMTX (but not in MKIV, as documented). Could you look into
that?

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] t-vim module: no highlighting for custom filetypes

2021-05-21 Thread Nicola
On 2021-05-21, Nicola  wrote:
> For some reason, the vim module has stopped highlighting code associated
> to custom filetypes (it still works for built-in filetypes).

I think I have found the culprit. In t-vim.tex, lines 63-88, Vim is
called with --clean. That option appears *after* -u, effectively
overriding it. Moving --clean as the first option (or, better, removing
it) solves my issue.

Some remarks. The module has this comment:

   --clean % dont load scada [sic] file (nvim)

If the purpose of the option is to avoid loading a shada file, `-i NONE`
(which is already there) should be enough.

In Vim, --clean is not strictly necessary, because it is effectively
a shorthard for `-N -i NONE --noplugin`. In Neovim, the meaning might be
slightly different. Which brings me to the next paragraph.

My recommendation would be not to care about Neovim. It is *not*
a drop-in replacement for Vim and not meant to be compatible with Vim
(it has already diverged from Vim in significant ways). Supporting both
is likely going to become more and more difficult as time goes by.

Anyway, if you do want to support both, I'd suggest at least to
segregate the two commands, even if currently they may be (almost)
identical.

Hope this helps!
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
___


[NTG-context] t-vim module: no highlighting for custom filetypes

2021-05-21 Thread Nicola
For some reason, the vim module has stopped highlighting code associated
to custom filetypes (it still works for built-in filetypes).

For instance, typeset this:

\usemodule[vim]

\startvimrc[name=foo]
  set nocompatible
  set runtimepath+=~/foo/
\stopvimrc

\definevimtyping[foo][
  style={\switchtobodyfont[16pt,tt]},
  directory=code/,
  syntax=foo,
  alternative=pscolor,
  vimrc=foo,
]

\starttext
\startfoo
  let while endwhile
\stopfoo
\stoptext


The ~/foo/ directory contains ftdetect/foo.vim:

au BufRead,BufNewFile *.foo setfiletype foo

and syntax/foo.vim:

if exists("b:current_syntax")
  finish
endif

syn case match
syn iskeyword @,48-57,192-255,_

syn keyword fooKeyword let while endwhile

hi def link fooKeyword Keyword

let b:current_syntax = "foo"

If I change `syntax=foo` to, say, `syntax=vim` in \definevimtyping
then the code is highlighted.  So, I suspect that I am not configuring
the runtimepath correctly. Any idea how to fix this?

I am using the latest LMTX to which I have added modules as explained
here:

https://wiki.contextgarden.net/Modules#ConTeXt_LMTX

t-vim VERSION reads 2021.03.01.

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] Synctex broken in LMTX ?

2021-05-21 Thread Nicola
On 2021-05-21, Hans Hagen  wrote:
> On 5/21/2021 10:50 AM, Nicola wrote:
>> On 2021-05-20, Hans Hagen  wrote:
>>
>>>> One thing he asked is what I was asking you: it
>>>> would be useful if there were a way to sync in the other direction as
>>>> well.
>>> You mean sort of trying to deduce from the synctex file where to go in
>>> the pdf?
>>
>> Yes. You provide a .tex file and a line number, and maybe also an
>> optional column number, and mtxrun outputs a .pdf file, a page number
>> and a coordinate pair or bounding box (I don't know what the best output
>> is).
>
> define 'tex file' ... is that the master file? in that case we're
> talking about the 'foo.synctex file' because how does a tex file knows
> what pdf is related?

Good point. I don't know how/if searching from source to PDF works in
TeXShop when the source is split into several files.

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] Synctex broken in LMTX ?

2021-05-21 Thread Nicola
On 2021-05-20, Hans Hagen  wrote:

>> One thing he asked is what I was asking you: it
>> would be useful if there were a way to sync in the other direction as
>> well.
> You mean sort of trying to deduce from the synctex file where to go in
> the pdf?

Yes. You provide a .tex file and a line number, and maybe also an
optional column number, and mtxrun outputs a .pdf file, a page number
and a coordinate pair or bounding box (I don't know what the best output
is).

> When the 'call external program' approach is used I can have an
> alternative (lua) output that is easier and might do that (less work).
> Lets first go one direction.

Dick prefers to tackle both directions at once: maybe you can coordinate
with each other.

> I only have a very old macbook and an old imac i once got so no real
> equipment to test anythign modern.

I'd be happy to help, and I am sure other users are interested, too.

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] Synctex broken in LMTX ?

2021-05-20 Thread Nicola
On 2021-05-16, Hans Hagen  wrote:
> On 5/16/2021 5:30 PM, Nicola wrote:
>
>> Anyway, I am positive that he is willing to support ConTeXt in the best
>> possible way...
>
> Sure. I met him a few times. Definitely an asset for the tex community.
>
>>> see? the info is just there, so you can try to convince the texshop
>>> creator to support this:
>>>
>>> -- call an external program with these arrguments (the texhop editor
>>> knows the positions as it has the viewer built in)
>>> -- go to reported file and line
>>
>> ...which could be as well this.
> Feel free to ask him,

I've got a positive feedback, and the summer as an estimated time to
start working on it. One thing he asked is what I was asking you: it
would be useful if there were a way to sync in the other direction as
well.

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] Synctex broken in LMTX ?

2021-05-17 Thread Nicola
On 2021-05-16, Hans Hagen  wrote:
> On 5/16/2021 5:30 PM, Nicola wrote:
>
>>> see? the info is just there, so you can try to convince the texshop
>>> creator to support this:
>>>
>>> -- call an external program with these arrguments (the texhop editor
>>> knows the positions as it has the viewer built in)
>>> -- go to reported file and line
>>
>> ...which could be as well this.
> Feel free to ask him,

I will. Two things:

1. can you also go the other way with mtxrun (determine position in the
   PDF from a line in the source file)?

2. It seems that --editor has no effect:

$ mtxrun --script synctex --edit --line=6 --editor=/usr/local/bin/vim 
WriteUp.tex
sh: SciTE: command not found

$ mtxrun --script synctex --goto --page=2 --x=150 --y=200 --editor=gvim 
WriteUp.synctex
sh: SciTE: command not found

Am I doing anything wrong?

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] Synctex broken in LMTX ?

2021-05-16 Thread Nicola
On 2021-05-16, Hans Hagen  wrote:
> On 5/16/2021 2:52 PM, Otared Kavian wrote:
>> Hi Hans,
>>
>> I have been noticing for some time that \setupsynctex does not work
>> properly, at least in TeXShop on MacOS. A « filename.synctex » file
>> is created but on most occasions it does not contain many lines, and
>> one cannot go from the PDF file to the right location in the source
>> file. Has something changed in the way synctex used to work ?
>>
>> Below I am sending you a test file with its PDF and .synctex files,
>> for you to see for yourself. Sorry for the disturbance…
> irr texshoip has soem setting for it (you need to check with Dick)
> which relates to a change in synctex

It works just fine. Add this line at the top of your document:

 % !TEX useOldSyncParser

I also have:

\setupsynctex[state=start,method=min]

I am not sure whether method=min is necessary.

Anyway, search for useOldSyncParser in Help > Changes for the details.

> now, in my opinion, the biggest drawback of synctex is that one needs to
> compile it into the editor/viewer. Far better would have been to let the
> viewer call out to an external program (configurable) that reports back
> the file and line ... more flexible, better upward compatibility, no
> need to have the synctex code on board, hardly any code and no fuzzy
> heuristics to fight

+1. I use TeXShop only as a previewer (I edit documents in Vim), but,
unfortunately, syncing with an external editor works only for LaTeX.

> but I gave up communicating that because i cannot reason with the guy
> (different wavelengths .. years ago already)

Richard Koch, however, has been incredible, IMO, in supporting the macOS
community (already before Mac OS X 10.0!) with TeXShop. In particular,
he went to great lengths to make syncing work in TeXShop for both
ConTeXt and LaTeX. The current problem is only with external editors,
and it is because the directive above is not read by TeXShop when using
an external editor.

Anyway, I am positive that he is willing to support ConTeXt in the best
possible way...

> see? the info is just there, so you can try to convince the texshop
> creator to support this:
>
>-- call an external program with these arrguments (the texhop editor
> knows the positions as it has the viewer built in)
>-- go to reported file and line

...which could be as well this.

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] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-16 Thread Nicola
On 2021-05-07, Nicola  wrote:
> On 2021-05-06, Bruce Horrocks  wrote:
>>> Sorry, my explanation of what I am trying to achieve was a bit too
>>> terse.
>
>> Thank-you for the explanation - that's much clearer.
>>
>> I've experimented a bit with Docker and I've managed to get
>> a stand-alone LMTX install to work under a 32-bit Alpine Linux that
>> has had the glibc library added. This should - fingers crossed - work
>> in iSH.
>
> That's great news! I'll try it asap and report back. Thanks for looking
> into it.

Thanks again, your instructions work perfectly in Docker. Unfortunately,
for some reason iSH raises an error when trying to import that Docker
image: iSH is finnicky about filesystems, apparently—this is noted in
their wiki:

https://github.com/ish-app/ish/wiki/Install-&-Activate-Alternate-Filesystems

Besides, I have found some inconsistencies between texmf.cnf and
texmfcnf.lua in the TeX Live distribution that can be installed through
apk: for instance, one file used ~/.texlive2019 and the other
~/.texlive2020. There may be other issues, but I am not expert enough.

For now, I have given up. I have some hope with another iOS/iPadOS app,
a-Shell (https://github.com/holzschu/a-shell), which is what I currently
use to typeset LaTeX documents. It allows you to install TeX Live, but
for some reason it comes without ConTeXt (it has LuaTeX, though). There
is an open request for adding ConTeXt
(https://github.com/holzschu/a-shell/issues/208).

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] KeenWrite 2.0

2021-05-11 Thread Nicola
On 2021-05-10, Thangalin  wrote:
> Happy to announce that invoking ConTeXt from KeenWrite is now possible.

Cool. To make it easier to install in macOS, I have quickly cooked a
couple of Homebrew formulas (see below). Use like this:

cd 
brew install ./zulufx16.rb
brew install ./keenwrite.rb
keenwrite

Nicola


# Save as zulufx16.rb

cask "zulufx16" do
  version "16.0.1,16.30.15-ca"

  if Hardware::CPU.intel?
sha256 
"cbb3b96d80a0675893f21dc51ba3f532049c501bd7dc4c8d1ee930e63032c745"

url 
"https://cdn.azul.com/zulu/bin/zulu#{version.after_comma}-fx-jdk#{version.before_comma}-macosx_x64.tar.gz;,
  referer: "https://www.azul.com/downloads/zulu/zulu-mac/;
  else
sha256 
"6b66194ee69ac0abc28a6fb00cad37fc29a8b5085776cfbaeebf4a600b03a16e"

url 
"https://cdn.azul.com/zulu/bin/zulu#{version.after_comma}-fx-jdk#{version.before_comma}-macosx_aarch64.tar.gz;,
  referer: "https://www.azul.com/downloads/zulu/zulu-mac/;
  end

  name "ZuluFX 16"
  desc "Azul Zulu Java 16 Standard Edition Development Kit"
  homepage "https://www.azul.com/downloads/zulu/zulu-mac/;

  depends_on macos: ">= :yosemite"

  artifact "zulu16.30.15-ca-fx-jdk16.0.1-macosx_x64/zulu-16.jdk", target: 
"/Library/Java/JavaVirtualMachines/zulu-16.jdk"

  zap delete: "/Library/Java/JavaVirtualMachines/zulu-16.jdk"
end





# Save as keenwrite.rb

class Zulufx16Requirement < Requirement
  fatal true
  satisfy(build_env: false) { 
Dir.exist?("/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home") }
  def message
<<~EOS
  Execute `brew install --cask zulufx16` before installing Keenwrite.
EOS
  end
end

class Keenwrite < Formula
  desc "Java-based desktop text editor with live preview, string 
interpolation, and formulas"
  homepage "https://github.com/DaveJarvis/keenwrite;
  url 
"https://github.com/DaveJarvis/keenwrite/releases/download/2.0.0/keenwrite.jar;
  version "2.0.0"
  sha256 "259743af0728502e89abac043973ef5c213573183ba71ba93accb2a330f0e7a8"
  head "https://github.com/DaveJarvis/keenwrite.git;

  def install
java_home = 
"/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home"
ENV["JAVA_HOME"] = java_home
libexec.install "keenwrite.jar"
(bin/"keenwrite").write <<~EOS
  #!/bin/bash
  export JAVA_HOME="#{java_home}"
  exec "${JAVA_HOME}/bin/java" --illegal-access=permit -jar 
"/usr/local/Cellar/keenwrite/#{version}/libexec/keenwrite.jar" "$@"
EOS
  end

  test do
false
  end
end



___
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] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-07 Thread Nicola
On 2021-05-06, Bruce Horrocks  wrote:
>> Sorry, my explanation of what I am trying to achieve was a bit too
>> terse.

> Thank-you for the explanation - that's much clearer.
>
> I've experimented a bit with Docker and I've managed to get
> a stand-alone LMTX install to work under a 32-bit Alpine Linux that
> has had the glibc library added. This should - fingers crossed - work
> in iSH.

That's great news! I'll try it asap and report back. Thanks for looking
into it.

Anyway, for Hans and Mojca: I confirm that I was not able to run ConTeXt
from the texlive package (TeX Live 2020) of Alpine Linux 3.12 (x86_64).
I get the error in my original post to this thread, which I could not
solve with the suggested fixes. If other can reproduce it, maybe it's
worth reporting upstream to Alpine developers.

I can install ConTeXt LMTX just fine in Alpine x86_64, however!

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] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-03 Thread Nicola
On 2021-05-02, Bruce Horrocks  wrote:
> The iSH documentation that I briefly looked at used a 'side-load'
> technique i.e. relied on what's called a 'jailbroken' iPad.

I don't know which documentation you have looked at: I can load file
systems just fine on a not jailbroken device:

https://github.com/ish-app/ish/wiki/Install-&-Activate-Alternate-Filesystems

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] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-03 Thread Nicola
On 2021-05-02, Bruce Horrocks  wrote:
>
>
>> On 1 May 2021, at 21:35, Nicola  wrote:
>>
>> On 2021-05-01, Bruce Horrocks  wrote:
>>>> On 30 Apr 2021, at 19:53, Nicola  wrote:
>>>>
>>>> I'd like to run ConTeXt on Alpine Linux (ultimately, to run it on an
>>>> iPad with the iSH app). I am currently testing it with Docker. This is
>>>> what I have done:
>>>>
>>>>  docker pull econcz/x86-alpine-glibc:ish-import
>>>
>>> Why is your first line not
>>>
>>>  $ docker pull alpine
>>
>> I was following the documentation of iSH, which is where I want to use
>> the container eventually. But I may probably use the alpine image as
>> well, which is more up to date and allows me to install TeX Live 2020.
>>
>>> I would start with that then test each new step at the interactive
>>> shell before adding to the compose file and moving onto the next step.
>>
>> Unfortunately, even with the image above I get the same errors.
>
> Sorry for the late reply - I missed this in the thread.
>
> You're not going to be able to get the Docker container to run on the
> iPad if that's what you were ultimately hoping.

Sorry, my explanation of what I am trying to achieve was a bit too
terse.

There is a little wonderful app on the App Store, called iSH
(https://github.com/ish-app/ish), which essentially allows you to run
a 32-bit x86 Alpine Linux distribution on the iPad. One feature of the
app is that it can import and mount several "file systems". One way to
create such a file system is to export a Docker container.

So, what one can do is create a Docker container in some other device (I
use my laptop), configure it as desired, then export it into a .tar
archive, copy it into the iPad, and import it into iSH. This is better
than installing/building packages directly inside the app, because (a)
compiling on the iPad is extremely slow, and (b) some packages may raise
errors if one tries to install them inside the app (TeX Live being one
of them: this link explains the issue and the Docker workaround:
https://github.com/ish-app/ish/issues/1123).

iSH emulates x86_32 and uses Musl. AFAICS, ConTeXt LMTX currently only
provides a 64-bit download for Linux Musl. So, the next best alternative
is to use ConTeXt from TeX Live.

So, this is where I am at: I am trying to make ConTeXt work inside an
x86 Alpine Linux Musl container, using the official Alpine package.

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] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-01 Thread Nicola
On 2021-05-01, Mojca Miklavec  wrote:
> On Fri, 30 Apr 2021 at 20:53, Nicola wrote:
>> Then, I run `mtxrun --generate`, which exits instantly with the output
>> reported below. However, that is apparently not enough. I still get:
>>
>> $ context Hello-world.tex
>> mtxrun  | unknown script 'context.lua' or 'mtx-context.lua'
>
> This sounds like a missing or misconfigured texmfcnf.lua (which should
> be next to texmf.cnf).
> This would need to be handled by the distribution (Alpine Linux devs).
>
> Can you try to locate both files and share the contents? (There may
> also be multiple copies of them.)

I report below the content of the two files, as they are in TeX Live
2020 (I have switched to `docker pull alpine`, as suggested in another
post, in which I can install Tex Live 2020).

Nicola


~ # find / -name texmfcnf.lua
/usr/share/texmf-dist/web2c/texmfcnf.lua
~ # cat /usr/share/texmf-dist/web2c/texmfcnf.lua
-- public domain

-- ConTeXt needs a properly expanded TEXMFLOCAL, so here is a
-- bit of lua code to make that happen

local texmflocal = resolvers.prefixes.selfautoparent();
texmflocal = string.gsub(texmflocal, "20%d%d$", "texmf-local");

return {

type= "configuration",
version = "1.1.0",
date= "2012-05-24",
time= "12:12:12",
comment = "ConTeXt MkIV configuration file",
author  = "Hans Hagen, PRAGMA-ADE, Hasselt NL",

content = {

-- Originally there was support for engines and progname but I don't 
expect
-- other engines to use this file, so first engines were removed. After 
that
-- if made sense also to get rid of progname. At some point specific 
formats
-- will be supported but then as a subtable with fallbacks, which 
sounds more
-- natural. Also, at some point the paths will become tables. For the 
moment
-- I don't care too much about it as extending is easy.

variables = {

-- The following variable is predefined (but can be overloaded) and 
in
-- most cases you can leve this one untouched. The built-in 
definition
-- permits relocation of the tree.
--
-- TEXMFCNF = 
"{selfautodir:,selfautoparent:}{,{/share,}/texmf{-local,}/web2c}"
--
-- more readable than "selfautoparent:{/texmf{-local,}{,/web2c},}}" 
is:
--
-- TEXMFCNF = {
-- "selfautoparent:/texmf-local",
-- "selfautoparent:/texmf-local/web2c",
-- "selfautoparent:/texmf-dist",
-- "selfautoparent:/texmf/web2c",
-- "selfautoparent:",
-- }

-- only used for FONTCONFIG_PATH & TEXMFCACHE in TeX Live

TEXMFSYSVAR = "selfautoparent:texmf-var",
TEXMFVAR= "home:.texlive2020/texmf-var",

-- We have only one cache path but there can be more. The first 
writable one
-- will be chosen but there can be more readable paths.

TEXMFCACHE  = "$TEXMFSYSVAR;$TEXMFVAR",
TEXMFCONFIG = "home:.texlive2020/texmf-config",

-- I don't like this texmf under home and texmf-home would make more
-- sense. One never knows what installers put under texmf anywhere 
and
-- sorting out problems will be a pain. But on the other hand ... 
home
-- mess is normally under the users own responsibility.
--
-- By using prefixes we don't get expanded paths in the cache 
__path__
-- entry. This makes the tex root relocatable.

TEXMFOS = "selfautodir:",
TEXMFDIST   = "selfautoparent:texmf-dist",

TEXMFLOCAL  = texmflocal,
TEXMFSYSCONFIG  = "selfautoparent:texmf-config",
TEXMFFONTS  = "selfautoparent:texmf-fonts",
TEXMFPROJECT= "selfautoparent:texmf-project",

TEXMFHOME   = "home:texmf",
 -- TEXMFHOME   = os.name == "macosx" and "home:Library/texmf" or 
"home:texmf",

-- We need texmfos for a few rare files but as I have a few more 
bin trees
-- a hack is needed. Maybe other users also have texmf-platform-new 
trees.

TEXMF   = 
"{$TEXMFCONFIG,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFDIST}",

TEXFONTMAPS = 
".;$TEXMF/fonts/data//;$TEXMF/fonts/map/{pdftex,dvips}//",
ENCFONTS= 
".;$TEXMF/fonts/data//;

Re: [NTG-context] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-01 Thread Nicola
On 2021-05-01, Bruce Horrocks  wrote:
>> On 30 Apr 2021, at 19:53, Nicola  wrote:
>>
>> I'd like to run ConTeXt on Alpine Linux (ultimately, to run it on an
>> iPad with the iSH app). I am currently testing it with Docker. This is
>> what I have done:
>>
>>docker pull econcz/x86-alpine-glibc:ish-import
>
> Why is your first line not
>
>$ docker pull alpine

I was following the documentation of iSH, which is where I want to use
the container eventually. But I may probably use the alpine image as
well, which is more up to date and allows me to install TeX Live 2020.

> I would start with that then test each new step at the interactive
> shell before adding to the compose file and moving onto the next step.

Unfortunately, even with the image above I get the same errors.

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] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-05-01 Thread Nicola
On 2021-05-01, Pablo Rodriguez  wrote:
> On 4/30/21 8:53 PM, Nicola wrote:
>> I'd like to run ConTeXt on Alpine Linux (ultimately, to run it on an
>> iPad with the iSH app). I am currently testing it with Docker. This is
>> what I have done:
>> [...]
>> Anyone running ConTeXt on Alpine? Any idea what is wrong?
>
> Hi Nicola,
>
> I don’t run Alpine or Docker, but this might help you.
>
>   mtxrun --script cache --erase &&  mtxrun --generate

Unfortunately, mtxrun --script cache results in the same error I have
already posted.

> BTW, TeX Live 2021 is already available (https://www.tug.org/texlive/).

I am using the release I can get from the package manager. It seems that
Tex Live 2021 has not landed in Alpine's official repos yet.

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
___


[NTG-context] Issue running ConTeXt from TeX Live 2019 on Alpine Linux 3.12

2021-04-30 Thread Nicola
I'd like to run ConTeXt on Alpine Linux (ultimately, to run it on an
iPad with the iSH app). I am currently testing it with Docker. This is
what I have done:

docker pull econcz/x86-alpine-glibc:ish-import
docker run -it econcz/x86-alpine-glibc:ish-import /bin/sh
cp /etc/apk/repositories /tmp/repositories
cat /etc/os-release
ALPINE_VERSION=3.12  # Set accordingly to previous command
echo "http://nl.alpinelinux.org/alpine/v${ALPINE_VERSION}/main/; | tee 
/etc/apk/repositories
echo "http://nl.alpinelinux.org/alpine/v${ALPINE_VERSION}/community/; | tee 
-a /etc/apk/repositories
apk update

This installs and configures repos for Alpine Linux 3.12. Then,
I install TeX Live as follows:

apk add texlive-full texlive-xetex texlive-luatex texlive-dev
apk add ghostscript ghostscript-fonts ghostscript-dev
apk add graphicsmagick graphicsmagick-dev

Then, I run `mtxrun --generate`, which exits instantly with the output
reported below. However, that is apparently not enough. I still get:

$ context Hello-world.tex
mtxrun  | unknown script 'context.lua' or 'mtx-context.lua'

$ context --version
mtxrun  | unknown script 'context.lua' or 'mtx-context.lua'

$ mtxrun --version
mtxrun  | ConTeXt TDS Runner Tool 1.32
mtxrun  | source path

$ mtxrun --script context
mtxrun  | unknown script 'context.lua' or 'mtx-context.lua'

$ luatools --generate
mtxrun  | unknown script 'base.lua' or 'mtx-base.lua'

$ find / -name context.lua
/usr/share/texmf-dist/scripts/context/lua/context.lua

$ find / -name mtx-context.lua
/usr/share/texmf-dist/scripts/context/lua/mtx-context.lua

$ find / -name base.lua
[Nothing found]

$ find / -name mtx-base.lua
/usr/share/texmf-dist/scripts/context/lua/mtx-base.lua

Anyone running ConTeXt on Alpine? Any idea what is wrong?

Nicola

>mtxrun --generate
resolvers   | resolving | variable 'SELFAUTOLOC' set to '/usr/bin'
resolvers   | resolving | variable 'SELFAUTODIR' set to '/usr'
resolvers   | resolving | variable 'SELFAUTOPARENT' set to '.'
resolvers   | resolving | variable 'TEXMFCNF' set to ''
resolvers   | resolving | variable 'TEXMF' set to ''
resolvers   | resolving | variable 'TEXOS' set to 'usr'
resolvers   | resolving |
resolvers   | resolving | using configuration specification 
'home:texmf/web2c;{selfautoloc:,selfautoloc:/share/texmf-local/web2c,selfautoloc:/share/texmf-dist/web2c,selfautoloc:/share/texmf/web2c,selfautoloc:/texmf-local/web2c,selfautoloc:/texmf-dist/web2c,selfautoloc:/texmf/web2c,selfautodir:,selfautodir:/share/texmf-local/web2c,selfautodir:/share/texmf-dist/web2c,selfautodir:/share/texmf/web2c,selfautodir:/texmf-local/web2c,selfautodir:/texmf-dist/web2c,selfautodir:/texmf/web2c,$SELFAUTOGRANDPARENT/texmf-local/web2c,selfautoparent:,selfautoparent:/share/texmf-local/web2c,selfautoparent:/share/texmf-dist/web2c,selfautoparent:/share/texmf/web2c,selfautoparent:/texmf-local/web2c,selfautoparent:/texmf-dist/web2c,selfautoparent:/texmf/web2c}'
resolvers   | resolving |
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/root/texmf/web2c' from specification 'home:texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on weird path 
'/usr/bin' from specification 'selfautoloc:'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/bin/share/texmf-local/web2c' from specification 
'selfautoloc:/share/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/bin/share/texmf-dist/web2c' from specification 
'selfautoloc:/share/texmf-dist/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/bin/share/texmf/web2c' from specification 'selfautoloc:/share/texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/bin/texmf-local/web2c' from specification 'selfautoloc:/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/bin/texmf-dist/web2c' from specification 'selfautoloc:/texmf-dist/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/bin/texmf/web2c' from specification 'selfautoloc:/texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on weird path 
'/usr' from specification 'selfautodir:'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/share/texmf-local/web2c' from specification 
'selfautodir:/share/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/share/texmf-dist/web2c' from specification 
'selfautodir:/share/texmf-dist/web2c'
resolvers   | resolving | found regular configuration file 
'/usr/share/texmf-dist/web2c/texmfcnf.lua'
resolvers   | resolv

Re: [NTG-context] How to write readable source files?

2021-04-25 Thread Nicola
On 2021-04-25, juh  wrote:
> I am married to Emacs but have an affair with Vim. ;-)

Eventually, you will abandon the dark side of the Force ;-)

> I real IDE-like support for ConTeXt would be nice: setup-en.pdf is
> always open when I write environments as I cannot remember all commands
> and options. If my editor would give me a list of possible commands when
> I just type some letters and then give possible options when I edit
> inside a command – that would be great.

If there is a way to automatically get a list of all ConTeXt commands
and options (and, ideally, MetaFun defs, types, and other keywords), I'd
be happy to improve omni-completion for ConTeXt in Vim.

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] How to write readable source files?

2021-04-24 Thread Nicola
On 2021-04-24, juh  wrote:
> Am Sat, Apr 24, 2021 at 01:55:28PM +0200 schrieb Henning Hraban Ramm:
>> I guess many of us adhere to Hans’ style, as shown in the sources.
>>
>> i.e. e.g.
>> \setupsomething
>>   [name]
>>   [key=value,
>>otherkey=value]
>>
>> while I prefer:
>>
>> \setupsomething[name][
>>   key=value,
>>   otherkey=value,
>> ]
>
> I, too, stick to these styles more or less.
>
> But after many iterations my code gets scrambled so that I would be happy to
> reformat it via some tool. The usual functions in Vim and Emacs never results 
> in
> a style like this.

I maintain the ConTeXt plugin for Vim. Currently, there are no
indentation rules (except for embedded MetaPost code), and that is
intentional: as the examples above show, there is no commonly accepted
indentation style, so forcing one on the user is not a good idea.

That said, if you have a list of desiderata, I may consider adding an
option to enable them. You may open an issue here for further
discussion:

https://github.com/lifepillar/vim-context-metapost

If you need to reflow paragraphs, the plugin provides the tp text
object. So, for instance, you may type gqtp to reformat the current
paragraph (with hard breaks) using the current textwidth.

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] Help on tweaking alignment, page numbers and ToC

2020-08-13 Thread Nicola
On 2020-08-13, Pablo Rodriguez  wrote:
> On 8/13/20 6:06 PM, Nicola wrote:
>> [...]
>> Thanks. That works with my MWE, but in my document I actually have
>> a chapter, and chapters start on the right page, even if I add page=no
>> to \setuppagenumbering:
>> [...]
>> I have no idea how to allow chapters to start at arbitrary pages when
>> alternative=doublesided.
>
> Use \page[yes, blank] instead of \page[yes, blank, right].
>
> I hope this helps,

Thank you both. I had tried `yes` already, but I had mixed it with other
interfering settings, which got me confused. Now that I have cleand up
my code, everything is as expected.

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] Help on tweaking alignment, page numbers and ToC

2020-08-13 Thread Nicola
On 2020-08-13, Pablo Rodriguez  wrote:
> On 8/13/20 5:17 PM, Nicola wrote:
>> Hi,
>> I still have an issue with blank pages...
>>
>>>> 2. Vertically center the ToC (wrt to the text area).
>>>
>>> Use a makeup for the TOC (if and only if it takes a single page).
>>
>> Yes, the ToC takes a single page. The makeup seems to insert a blank
>> page afterwards. MWE:
>
> Hi Nicola,
>
> all makeups do that by default.
>
> "doublesided=no" is what you need.

Thanks. That works with my MWE, but in my document I actually have
a chapter, and chapters start on the right page, even if I add page=no
to \setuppagenumbering:

\setuppagenumbering[alternative=doublesided,page=no]
\definemakeup[ToC][align=middle,pagestate=start,doublesided=no]
\starttext
\startfrontmatter
  \startmakeup[ToC]
\placecontent
  \stopmakeup
  \chapter{Preface}
\stopfrontmatter
\startbodymatter
  \dorecurse{10}{\chapter{Foo}}
\stopbodymatter
\stoptext

I have no idea how to allow chapters to start at arbitrary pages when
alternative=doublesided.

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] Help on tweaking alignment, page numbers and ToC

2020-08-13 Thread Nicola
Hi,
I still have an issue with blank pages...

>> 2. Vertically center the ToC (wrt to the text area).
>
> Use a makeup for the TOC (if and only if it takes a single page).

Yes, the ToC takes a single page. The makeup seems to insert a blank
page afterwards. MWE:

\setuppagenumbering[alternative=doublesided]
\definemakeup[ToC][align=middle,pagestate=start]
\starttext
\startfrontmatter
  \startmakeup[ToC]
\placecontent
  \stopmakeup
  \input{knuth}
\stopfrontmatter
\startbodymatter
  \dorecurse{10}{\chapter{Foo}}
\stopbodymatter
\stoptext

How do I suppress the blank page after the ToC?

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
___


[NTG-context] \setfirstline is applied to whole paragraph

2020-08-12 Thread Nicola
When I typeset the example at

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

(reported below for your convenience), \setfirstline is applied to the
whole first paragraph, which is laid out on a single line (hence, it is
cropped at the edge of the page). Besides, the second \setfirstline is
not applied at all, i.e., there are no small caps. If I comment out the
first \setfirstline, then the second one does produce small caps, but
again, a whole paragraph is set in small caps, not just the first line.

$ context --version
mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: 
/Users/nicola/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2020.08.11 15:59
mtx-context | main context file: 
/Users/nicola/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/context.mkxl
mtx-context | current version: 2020.08.11 15:59

Nicola


\setupbodyfont [heros] %% important: smallcaps capable font!

\definefirstline [italicfirstline] [
  alternative=line,
  style=italic,
]

\definefirstline [smallcapsfirstline] [
  alternative=line,
  color=darkred,
  style=smallcaps,
]

\starttext

  % \setfirstline[italicfirstline]\input knuth \par
  \setfirstline[smallcapsfirstline] \input knuth \par

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


Re: [NTG-context] Help on tweaking alignment, page numbers and ToC

2020-08-12 Thread Nicola
On 2020-08-12, Wolfgang Schuster  wrote:
> Nicola schrieb am 11.08.2020 um 22:21:
>> On 2020-08-11, Pablo Rodriguez  wrote:
>>> On 8/11/20 9:24 PM, Nicola wrote:
>>>> Thank Pablo, Wolfgang,
>>>> I have learned more by reading your replies than by myself in the rest
>>>> of the afternoon.
>>>
>>> Hi Nicola,
>>>
>>> if you found replies useful, please update the wiki (this may help others).
>>>
>>>> Just one more thing:
>>>> [...]
>>>> I'd prefer all the titles to be aligned:
>>>>
>>>>   Preface
>>>> I XYZ
>>>>...
>>>> VIII XYZ
>>>>...
>>>>
>>>> I have tried to do my homework by playing with \setuphead, but I am
>>>> afraid I need your help on this.
>>>
>>> Sorry, but too tired to type a sample.
>>>
>>> How about setting distance for \setuplist[chapter] in the sectionblock
>>> frontpart with the desired width?
>>
>> That does not seem to change the layout, unfortunately. I have tried
>> with `margin` and `aligntitle` as well:
>>
>> \setuplist[chapter][distance=1cm,aligntitle=yes]
>> \startsectionblockenvironment[frontpart]
>> \setuplist[chapter][aligntitle=yes,margin=2cm,distance=2cm]
>> \stopsectionblockenvironment
>>
>> I'll take a fresh look tomorrow.
>
> When you a unnumbered section with the list alternatives a-c your're out
> of luck with the regular \setuplist options because it always use a
> width of 0pt for regular section number. The aligntitle works only for
> numbered entries to align them when you disable the number entry in the TOC.
>
> To show the section entry and align all entries on the same line you can
> use the following method:
>
>1. Set the width and distance for the section number to 0pt.
>
>2. Set the margin key to a value large enough to fit all numbers
>
>3. Apply a command to the numbercommand key where you shift the
> number to the left in the margin area you set in the previous step

Thanks, nice trick!

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] Page number 0 in Table of Contents with makeup

2020-08-11 Thread Nicola
On 2020-08-11, Pablo Rodriguez  wrote:
> On 8/11/20 10:11 PM, Nicola wrote:
>> Consider this example:
>>
>> \definemakeup[toc][align=middle]
>> \setuppagenumbering[alternative=doublesided]
>> \starttext
>>   \startfrontmatter
>> \startmakeup[toc]
>>   \placecontent
>> \stopmakeup
>> %\setuppagenumber[number=1]
>> \startchapter[title={A}]\stopchapter
>> \startchapter[title={B}]\stopchapter
>>   \stopfrontmatter
>> \stoptext
>>
>> The first entry in the ToC has page number 0. I can fix it by
>> uncommenting the commented line or by removing the makeup. Is this
>> expected behaviour? If so, why?
>
> Hi Nicola,
>
> makeups have pagestate set to stop by default.
>
> \definemakeup[toc][align=middle, pagestate=start] solves your issue.
>
> I hope it helps,

Yes, it does!

Thanks,
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] Help on tweaking alignment, page numbers and ToC

2020-08-11 Thread Nicola
On 2020-08-11, Pablo Rodriguez  wrote:
> On 8/11/20 9:24 PM, Nicola wrote:
>> Thank Pablo, Wolfgang,
>> I have learned more by reading your replies than by myself in the rest
>> of the afternoon.
>
> Hi Nicola,
>
> if you found replies useful, please update the wiki (this may help others).
>
>> Just one more thing:
>> [...]
>> I'd prefer all the titles to be aligned:
>>
>>  Preface
>>I XYZ
>>   ...
>> VIII XYZ
>>   ...
>>
>> I have tried to do my homework by playing with \setuphead, but I am
>> afraid I need your help on this.
>
> Sorry, but too tired to type a sample.
>
> How about setting distance for \setuplist[chapter] in the sectionblock
> frontpart with the desired width?

That does not seem to change the layout, unfortunately. I have tried
with `margin` and `aligntitle` as well:

\setuplist[chapter][distance=1cm,aligntitle=yes]
\startsectionblockenvironment[frontpart]
\setuplist[chapter][aligntitle=yes,margin=2cm,distance=2cm]
\stopsectionblockenvironment

I'll take a fresh look tomorrow.

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
___


[NTG-context] Page number 0 in Table of Contents with makeup

2020-08-11 Thread Nicola
Consider this example:

\definemakeup[toc][align=middle]
\setuppagenumbering[alternative=doublesided]
\starttext
  \startfrontmatter
\startmakeup[toc]
  \placecontent
\stopmakeup
%\setuppagenumber[number=1]
\startchapter[title={A}]\stopchapter
\startchapter[title={B}]\stopchapter
  \stopfrontmatter
\stoptext

The first entry in the ToC has page number 0. I can fix it by
uncommenting the commented line or by removing the makeup. Is this
expected behaviour? If so, why?

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] Help on tweaking alignment, page numbers and ToC

2020-08-11 Thread Nicola
Thank Pablo, Wolfgang,
I have learned more by reading your replies than by myself in the rest
of the afternoon. Just one more thing:

>>> 1. Increase the space between Roman numbers and titles in the ToC.
>>
>> distance with dimension is the key in \setuplist.
>
> Correct but it's also important to set "width" to a value which is large
> enough to fit the number.

Chapters in the front matter have no number, so the Preface gets aligned
with the numbers of the other chapters:

Preface
   I XYZ
  ...
VIII XYZ
  ...

I'd prefer all the titles to be aligned:

 Preface
   I XYZ
  ...
VIII XYZ
  ...

I have tried to do my homework by playing with \setuphead, but I am
afraid I need your help on this.

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
___


[NTG-context] Help on tweaking alignment, page numbers and ToC

2020-08-11 Thread Nicola
Hi,
first of all, let me say *thank you* for the vast improvements on
ConTeXt Garden! Browsing the documentation and finding stuff is so
much easier and pleasant than it used to be (also the site seems
faster).

Thanks to the docs, dropcaps and protrusion have no secrets for me,
but I am still struggling with some basic tasks (see the document
below):

0. Push text to the bottom of the text area (see copyright).
1. Increase the space between Roman numbers and titles in the ToC.
2. Vertically center the ToC (wrt to the text area).
3. Suppress page numbers and headers in all blank pages.
4. Suppress headers in the front matter.
5. Style and position page numbers differently in the front and body
   matter (e.g., centered only in the front matter).

As my full document uses environments, I would like most setups to
be in the environment, if possible. E.g., is it possible to replace

\setuphead[chapter][after={}]

(see below) with an environment setup that applies only to the ToC?

Nicola

%%%
\definepapersize[lsda][width=128.4mm,height=198.3mm]
\setuppapersize[lsda]

\setuplayout[
  backspace=22.9mm,
  width=90.3mm,
  topspace=8.9mm,
  height=181.1mm,
  header=4mm,
  headerdistance=6.4mm,
  footerdistance=6.4mm,
  footer=4mm,
  leftmargin=15.2mm,
  leftmargindistance=0mm,
  rightmargindistance=0mm,
  rightmargin=15.2mm,
]

\setuplabeltext[it][chapter=]
\setuphead[chapter][
  header=empty,
  alternative=middle,
  conversion=Romannumerals,
  numbercommand=\groupedcommand{\blank[20mm]}{\blank[10mm]},
  after={\blank[3cm]},
]
\setupheadtext[content=]

\setupheadertexts[]
\setupheadertexts[\setups{text a}][][][\setups{text b}]
\startsetups[text a]
  \rlap{whatever}
  \hfill
  \getmarking[chapter]
  \hfill
  \llap{whatever}
\stopsetups

\startsetups[text b]
  \rlap{}
  \hfill
  Some text goes here
  \hfill
  \llap{}
\stopsetups

\setuppagenumbering[
  alternative=doublesided,
  location={text,footer,right},
  style=\tfx
]
\definestructureconversionset[frontpart:pagenumber][][romannumerals]
\definestructureconversionset[bodypart:pagenumber] [][numbers]

\starttext
\startfrontmatter
\page[even]
\startalignment[bottom,flushright]
Copyright © 2020 Author
\stopalignment
\start
\setuphead[chapter][after={}]
\completecontent
\stop
\page[odd]
\startchapter[title={Preface}]\input{knuth}\stopchapter
\stopfrontmatter
\startbodymatter
\setuppagenumber[number=1]
\dorecurse{10}{\startchapter[title={XYZ}]\input{tufte}\stopchapter}
\stopbodymatter
\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
___


Re: [NTG-context] A simpler way to install LMTX in macOS Catalina

2020-05-30 Thread Nicola
On 2020-05-30, Arthur Reutenauer  wrote:
>   Nicola,
>
> On Sat, May 30, 2020 at 11:09:28AM -0000, Nicola wrote:
>> 1. Download macOS's version of LMTX from 
>> https://wiki.contextgarden.net/Installation
>> 2. Unpack
>> 3. cd context-osx-64
>> 4. xattr -d com.apple.quarantine bin/mtxrun
>> 5. sh ./install.sh
>
>   It’s nice to report that to the list, could you also add a note on the
> wiki page itself?  That’s where people are most likely to look for this
> kind of information.

I have update https://wiki.contextgarden.net/Installation accordingly.

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
___


[NTG-context] A simpler way to install LMTX in macOS Catalina

2020-05-30 Thread Nicola
Today I wanted to try LMTX and I have found these instructions in the wiki:

https://wiki.contextgarden.net/Installing_ConTeXt_LMTX_on_MacOS

Rather than disabling SIP, I have proceeded as follows:

1. Download macOS's version of LMTX from 
https://wiki.contextgarden.net/Installation
2. Unpack
3. cd context-osx-64
4. xattr -d com.apple.quarantine bin/mtxrun
5. sh ./install.sh

Point 4 is important to avoid the dialog "mtxrun cannot be opened
because the developer cannot be verified." Of course, it would be
better if the binary were signed...

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] Custom color schemes in t-vim

2020-05-17 Thread Nicola
On 2020-05-17, Nicola  wrote:
> On 2020-05-17, Aditya Mahajan  wrote:

>> Uploaded a new version with a fix.

I have tried the latest beta and, indeed, it now seems to work as
expected.

Thanks!
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] Custom color schemes in t-vim

2020-05-17 Thread Nicola
On 2020-05-17, Aditya Mahajan  wrote:
>> Since I already map the minor groups to preferred groups in `t-vim`, I think
>> that a good compromise is to enable the minor groups by default. I can do
>> that by adding statements similar to those above in `2context.vim`. This will
>> not have any visual impact on any existing code, but will allow those who
>> want to tweak the highlighting of minor groups to define their own syntax
>> highlighting.
>
> Uploaded a new version with a fix.

Thanks for looking into it. I will download and test that soon.

A couple of remarks:

1. In one of my old documents, I had this command inside the colorscheme
   block:

\setups{vim-minor-groups}

   Was that to achieve the same purpose?

2. The wiki has no mention of \startcolorscheme... \stopcolorscheme or
   \setups. An example of two would be very welcome!

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] Custom color schemes in t-vim

2020-05-16 Thread Nicola
On 2020-05-16, Aditya Mahajan  wrote:
> On Sat, 16 May 2020, Aditya Mahajan wrote:

> Moreover, if you comment line line 126 of `2context.vim`
>
>  "let s:id  = synIDtrans (s:id)
>
> [If you make a local copy of 2context.vim, then you need to run the
> file with `--mode=dev-vim` to ensure that the local copy is used]
>
> Then the ruby example generates the following file:
>
> \SYNBOL{}\SYN[rubyComment]{# Ruby program listing}\SYNEOL{}
> \SYNBOL{}\SYN[rubyDefine]{def}\SYN[rubyMethodBlock]{ 
> }\SYN[rubyMethodName]{foobar}\SYNEOL{}
> \SYNBOL{}\SYN[rubyMethodBlock]{  
> print(}\SYN[rubyStringDelimiter]{"}\SYN[rubyString]{Hello 
> World}\SYN[rubyStringDelimiter]{"}\SYN[rubyMethodBlock]{)}\SYNEOL{}
> \SYNBOL{}\SYN[rubyDefine]{end}\SYNEOL{}
>
> So, if you are willing to define wrappers for all ruby syntax blocks,
> then I can provide a configuration option so that `2context` does not
> apply that line.

That might provide a finer control over the highlighting, but the main
issue here seems to be that the generated file has Identifier instead of
Function, Special instead of Delimiter and Constant instead of String.
Looking at 2context.vim, AFAICS s:id_name seems computed correctly.
Maybe, the script does not set the appropriate filetype?

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] Custom color schemes in t-vim

2020-05-16 Thread Nicola
On 2020-05-14, Aditya Mahajan  wrote:
> On Thu, 14 May 2020, Nicola wrote:
>
>> Quick question: Is \startcolorscheme... \stopcolorscheme (still)
>> supported by t-vim?

> It is supposed to work. If it doesn't, then it is a bug. Could you
> provide a complete MWE.

Please find a MWE at the bottom of this post.

The expected behaviour is that the keyword `function` in the JavaScript
snippet and `foobar` in the Ruby snippet should be colored and in
italics, as comments are. The respective Vim highlight groups are
`javaScriptFunction` and `rubyMethodName`, which both resolve to
`Function`.

The actual behaviour is that comments are highlighted correctly, but
I do not get any syntax highlighting for functions.

Thanks for t-vim, btw: I can't express in words how nice an idea it is!

Nicola


\setupcolors[state=start]

\definecolor[colorone][r=0.251, g=0.349, b=0.322]
\definecolor[colortwo][r=0.612, g=0.608, b=0.478]
\definecolor[colorthree]  [r=1.0,   g=0.827, b=0.576]
\definecolor[colorfour]   [r=1.0,   g=0.592, b=0.310]
\definecolor[colorfive]   [r=0.960, g=0.310, b=0.161]
\definecolor[nearlywhite] [r=0.988, g=0.988, b=0.988]

\setupinteraction[state=start]
\setupcolors[textcolor=colorone]
\setupbackgrounds[page][background=color,backgroundcolor=nearlywhite]

\usemodule[vim]
\unprotect
\startcolorscheme[oceansunset]
  \definesyntaxgroup[Comment][\c!color={colorfive},\c!style=italic]
  \definesyntaxgroup[Function][\c!color={colorfive},\c!style=italic]
  % \definesyntaxgroup[rubyMethodName][\c!color={colorfive},\c!style=italic]
  % \definesyntaxgroup[javaScriptFunction][\c!color={colorfive},\c!style=italic]
\stopcolorscheme
\protect

\definevimtyping[JAVASCRIPT][
  syntax=javascript,
  alternative=oceansunset,
  escape=on
]

\definevimtyping[RUBY][
  syntax=ruby,
  alternative=oceansunset,
  escape=on
]

\starttext
\startJAVASCRIPT
// JavaScript program listing
function foobar() {
  print("Hello World");
}
\stopJAVASCRIPT

\startRUBY
# Ruby program listing
def foobar
  print("Hello World")
end
\stopRUBY
\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
___


[NTG-context] Custom color schemes in t-vim

2020-05-14 Thread Nicola
Quick question: Is \startcolorscheme... \stopcolorscheme (still)
supported by t-vim?

In a template I wrote long time ago to typeset code, I have:

\usemodule[vim]
\unprotect
\startcolorscheme[oceansunset]
  \definesyntaxgroup[Comment][\c!color={colortwo},\c!style=italic]
  % etc.
\stopcolorscheme
\protect

which I use as described in the wiki:

\definevimtyping
 [...]
 [...
  alternative=oceansunset,
  ...]

But that does not seem to have any effect (if I change the colors, the
syntax highlighting does not change). I can use pscolor and
blackandwhite, though. I see that \startcolorscheme is not documented,
so maybe there is another mechanism?

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] Setting up macvim in mac os catalina to work with LMTX

2020-04-23 Thread Nicola
On 2020-04-22, Jan-Erik Hägglöf  wrote:
> Output from :messages
>
>   
>   
> [ConTeXt] Typesetting...  
> Fel upptäcktes vid bearbetning av function 
> context#typeset[6]..39_typeset[2
> ]..context#callback[1]..39_callback:
> rad   17:
> E40: Kan inte öppna felfil /Users/janneman/Documents/CTX/GNUPLOT/test3.log

FYI, that error means that test3.log was not found - I guess, as that's
not a language I understand :-) - which likely means that your command
somehow failed without producing a log file (e.g., because the command
name was misspelled).

You seem to have fixed your issue, but, should you bump into further
issues, first make sure that your ConTeXt installation works properly
from the command line. Also, keep in mind that your shell environment
may be different from the environment in which ConTeXt is executed
inside Vim, so you may need to explicitly set some environment variables
(e.g., inside g:context_mtxrun) to make things sail smoothly.

Global variables (whose names start with `g:`) may be set in your vimrc,
which is typically located at $HOME/.vim/vimrc (note that the filename
does *not* start with a dot, only the directory's name does).

Good ConTeXt typesetting in Vim!
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] Setting up macvim in mac os catalina to work with LMTX

2020-04-22 Thread Nicola
On 2020-04-21, Jan-Erik Hägglöf  wrote:
> Hi !
>
> I am curious about testing macvim and it seems doing fine in edit
> mode. But how do i set up the typesetting engine?
>
> As far as I understand, there is, the command :ConteXt with guidance
> from the wiki https://wiki.contextgarden.net/Vim
> <https://wiki.contextgarden.net/Vim>
>
> But I do not understand how to customize it to be directed to the path
> to my engine
>
> I’ve installed the LMTX in /Users/janneman/context-osx-64/

I haven't tried LMTX yet, but you may configure the path to the ConTeXt
executable you want to use by setting `g:context_mtxrun`, e.g.:

:let g:context_mtxrun='/path/to/context/mtxrun'

Then, executing :ConTeXt will run the configured command. You may also
define shell enviroment variables, if needed. For instance, I have
configured Vim to use my installation of ConTeXt Beta as follows:

   :let 
g:context_mtxrun='PATH=$HOME/path/to/context-beta/tex/texmf-osx-64/bin:$PATH 
mtxrun'

> The installation works fine in TeXshop but still an error shows up in
> macvim and the message dissappears very quick so there is not much
> time to read the cause of error.

You may show a log of Vim messages by typing :messages.
If you post the error message, I may better diagnose your issue.

> I have created the subdirectory .vim/ftplugin/ and put the context.vim file 
> there
> also the corresponding in .vim/compiler/context.vim
>
> which is copied from the program located in
> /usr/local/Cellar/macvim/8.2-163/MacVim.app/Contents/Resources/vim/runtime

That's unnecessary. MacVim's runtime path is searched by default.
I recommend that you remove the files that you have copied into ~/.vim.
ConTeXt in Vim works out of the box.

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] ConTeXt support for Atom or other text editors

2020-01-21 Thread Nicola
On 2020-01-21, Sébastien Wilmet  wrote:

> I'm actually looking for a text editor on Linux that supports those
> three features:
> - syntax highlighting
> - command completion
> - spell-checking
>
> Does it exist?

Well, Vim has pretty solid support for ConTeXt (disclaimer: I am
maintaining the ConTeXt plugin distributed with Vim), including the
features you mention and much more:

https://wiki.contextgarden.net/Vim

But if you have never used Vim, it has a steeper learning curve that
a typical text editor.

On a side note: a difficulty with maintaining syntax highlighting for
ConTeXt is that I had to write my own script to extract ConTeXt-specific
and MetaFun-specific keywords from source code. Is there any way to do
it with ConTeXt?

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] Ebooks with ConTeXt?

2019-12-10 Thread Nicola
On 2019-12-10, Hans Hagen  wrote:
> On 12/9/2019 10:13 PM, Nicola wrote:
>> What is the current status of epub support in ConTeXt?
>> 
>> I have never followed ConTeXt's development on the XML front too
>> closely, but recently I have been asked to help format a text-only
>> manuscript for publishing on platforms such as Kindle or Apple Books
>> Store. Can ConTeXt be used (or perhaps even recommended) for that? Or
>> would I have better luck with the proprietary tools (Kindle Create,
>> iBooks Author)?
> context has an xml export (a few variants) and one can start from that 
> ... in the end it all boils down to some css (depends on the book i 
> guess) and tagged content (one can use the divs and spans output or 
> transform the xml to whatever wanted) ... for more complex setups i 
> think there are no generic solutions (unless all books should look 
> alike)

Ok, I imagined that things were like that, but I wasn't sure. Thanks for
confirming my impression.

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] Ebooks with ConTeXt?

2019-12-10 Thread Nicola
On 2019-12-10, Henning Hraban Ramm  wrote:
>
>> Am 2019-12-10 um 16:53 schrieb Denis Maier :
>>> 
>>> Perhaps this is a silly question (excuse my ignorance about the
>>> topic): what if you want to add some stylistic touches to your
>>> ebooks, such as initials? Or Non-breaking spaces? How about adding,
>>> say, a text box with a different background and a smaller font?
>>> 
>>> Or fine control page numbering, headers, footnotes, ligatures, or
>>> the spacing between paragraphs, or center a separator as above? Do
>>> you need to modify the generated CSS for that, or would ConTeXt (or
>>> Pandoc) allow you to take care of (some of) those things?
>>> 
>>> Nicola
>> 
>> For Pandoc: Some things can be tweaked with pandoc, but for anything
>> that is a bit more advanced you'll probably need a custom CSS. For
>> special content you can use spans and divs. In your custom CSS you
>> can define how those elements should be rendered. Sounds pretty
>> similar to what Hans wrote in his response. Probably the main
>> questions are if you prefer to work with pandoc markdown or with
>> ConTeXt sources, and if you need additional output formats.

The current need is only for epub. In any case, I'd like to have
a single source of truth for the content. I have experimented a bit with
Pandoc and, in fact, it can generate an .epub file that can be imported
by iBooks Author and converted with kindlegen. As for the style, it
seems that modifying the CSS gives the most control and can't be avoided
for advanced tweaks, even if I'd use ConTeXt.

As for ConTeXt, I have tried the latest beta with:

context mybook.tex
mtxrun --script epub --make mybook

This, among the rest, creates an .epub file, which unfortunately the
above mentioned tools do not like (maybe, that output is still
experimental?). I'll try to follow the more complex steps at
https://wiki.contextgarden.net/Epub_Sample.

> The problem is that custom CSS must be tuned for every single ePub
> reader (app or device), it’s like the browser wars. Most readers
> interprete only a strange subset of CSS2, it’s completely unreliable
> in my (limited) experience.

That's... sad.

> Have a look at https://wiki.contextgarden.net/ePub WRT ePub ot of
> ConTeXt, also at the old docs; unfortunately I never finished writing
> these pages, but I must review my ePub workflow soon-ish.

Thanks, I'll give it a shot!

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] Ebooks with ConTeXt?

2019-12-09 Thread Nicola
On 2019-12-10, Jan U. Hasecke  wrote:
> Am 09.12.19 um 22:13 schrieb Nicola:
>> What is the current status of epub support in ConTeXt?
>> 
>> I have never followed ConTeXt's development on the XML front too
>> closely, but recently I have been asked to help format a text-only
>> manuscript for publishing on platforms such as Kindle or Apple Books
>> Store. Can ConTeXt be used (or perhaps even recommended) for that? Or
>> would I have better luck with the proprietary tools (Kindle Create,
>> iBooks Author)?
>
> Sorry, no info concerning ConTeXT.
>
> You don't have to use proprietary tools. An easy way to create ebooks
> from Markdown files (or other sources) is Pandoc. https://pandoc.org/
>
> I produce all of my ebooks in this way. In most cases they validate
> without errors. If there are some errors though I use Calibre to fix
> them manually.

Thanks, I didn't think of Pandoc, I'll give it a try. In the past,
I have tried to create some simple content (slides) with Markdown, but
my conclusion was that if you know TeX, it doesn't make sense to use
Markdown :)

Perhaps this is a silly question (excuse my ignorance about the topic):
what if you want to add some stylistic touches to your ebooks, such as
initials? Or Non-breaking spaces? How about adding, say, a text box with
a different background and a smaller font?

   ***

Or fine control page numbering, headers, footnotes, ligatures, or the
spacing between paragraphs, or center a separator as above? Do you need
to modify the generated CSS for that, or would ConTeXt (or Pandoc)
allow you to take care of (some of) those things?

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
___


[NTG-context] Ebooks with ConTeXt?

2019-12-09 Thread Nicola
What is the current status of epub support in ConTeXt?

I have never followed ConTeXt's development on the XML front too
closely, but recently I have been asked to help format a text-only
manuscript for publishing on platforms such as Kindle or Apple Books
Store. Can ConTeXt be used (or perhaps even recommended) for that? Or
would I have better luck with the proprietary tools (Kindle Create,
iBooks Author)?

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
___


[NTG-context] Fwd: SyncTeX and Skim/TeXShop

2019-04-11 Thread Nicola Vitacolonna
Sorry, forgot to forward to the mailing list:

> Begin forwarded message:
> 
> From: Nicola Vitacolonna 
> Subject: Re: [NTG-context] SyncTeX and Skim/TeXShop
> Date: 10 April 2019 at 17:50:26 CEST
> To: Hans Hagen 
> 
> Hans, OK,
> thanks for the feedback. I was able to get TeXShop to work as explained by 
> OK—that’s already a progress. I prefer to use Vim, so I’ll see whether I can 
> cook something myself using AppleScript and Skim and parsing the 
> ConTeXt-generated .synctex file. Is the synctex format currently used by 
> ConTeXt described anywhere?
> 
> Thanks again,
> 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
___


[NTG-context] SyncTeX and Skim/TeXShop

2019-04-10 Thread Nicola Vitacolonna
Hi,
is anyone using ConTeXt with Skim, or TeXShop, on macOS?

SyncTeX used to work fine with ConTeXt in both apps. Now, it seems that ConTeXt 
has started to generate a .synctex file rather than a .synctex.gz, and the 
format seems to have changed (?). As I haven’t followed recent (or perhaps not 
so recent) developments in this area, do you have any suggestions to make 
SyncTeX work again?

I am using Skim, but any PDF viewer would be fine if Skim cannot be used for 
the purpose any longer.

Thanks in advance,
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] Saving Metafun Graphic for use outside ConTeXt

2018-04-05 Thread Nicola

On 05/04/2018 18:24, Alan Braslau wrote:

On Thu, 5 Apr 2018 15:28:34 +0100
Keith McKay <mckaymeis...@gmail.com> wrote:


I use a mac-mini and it seems that mupdf, of which mutools is part
off, does not have a macOS version, or I would have to build from
source. However it looks like I can use Inkscape with a wee bit
thought to do pretty much the same.


mupdf is available on MacPorts...


...also in Homebrew (mupdf formula, or mupdf-tools if you don't need
the viewer).

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] Wrong redirection in contextgarden.net

2017-05-06 Thread Nicola

On 29/04/2017 21:29, Mojca Miklavec wrote:


In case I forget, please remind me about this after the 4th May.


Ping. As requested ;)
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] Wrong redirection in contextgarden.net

2017-04-29 Thread Nicola

On 29/04/2017 18:05, Mojca Miklavec wrote:

On 29 April 2017 at 09:47, Nicola wrote:

For a while now, when I connect to contextgarden.net, I get redirected
to wiki.contextgarden.net// (note the double slash). Is it just me, or
something to be fixed in the web site?


The server uses
RedirectMatch permanent ^(.*)$ http://wiki.contextgarden.net/$1

I'm looking for a better suggestion.


Wouldn't just

  Redirect permanent / http://wiki.contextgarden.net/

do? (It may be recursive if the virtual host is the same.)

If not, how about:

RedirectMatch permanent ^/(.*)$ http://wiki.contextgarden.net/$1

As a last resource, mod_rewrite should work:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^contextgarden\.net$ [NC]
RewriteRule ^(.*)$ http://wiki.contextgarden.net/$1 [R=301,L]

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
___

[NTG-context] Wrong redirection in contextgarden.net

2017-04-29 Thread Nicola

For a while now, when I connect to contextgarden.net, I get redirected
to wiki.contextgarden.net// (note the double slash). Is it just me, or
something to be fixed in the web site?

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
___

[NTG-context] Linking local resource

2017-04-25 Thread Nicola

I'd like to have links in my PDF to external resources (videos, movies,
or non-embeddable file types) stored locally. Ideally, I'd like to use
relative links, so that I can move the folder containing the PDF and the
resources, and a cross-platform method (I'm on macOS). Is that possible?

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] IPA transcription

2017-03-23 Thread Nicola

On 23/03/2017 18:30, Hans Åberg wrote:



On 23 Mar 2017, at 16:57, Nicola <nvitacolo...@gmail.com> wrote:



Is there a (easy) way to write phonetic
transcriptions using the IPA (International
Phonetic Alphabet) in ConTeXt?  I can't find any
reference to it in the documentation.


I did that some time ago, but I can speak only for macOS. You want to
have:

- fonts supporting phonetic symbols (both in the text editor and for the
 output);
- an IPA keyboard layout;


You might try the text substitutions service: System Preferences >
Keyboard > Text. One chooses replacement text and what it should be
substituted into. See the thread "Input methods" for an automated
approach to generating large substitution sets.


Sure, that's another possibility. A drawback of that approach, as far as
I can see, is that those substitutions are applied globally across the
system.

Btw, Vim has a similar feature, called `iabbrev`: the advantage is that
replacements are editor-specific and the method is cross-platform
(because Vim is). Vim also offers support for inputting “digraphs” and
for defining your own. Even better, for the use case at hand, is that
you may also define your own keymap, e.g.:

https://github.com/bpj/bpj-vim-keymaps/blob/master/keymap/bxs.vim

I guess that other editors (e.g., Emacs) may offer similar
functionality.

Anyway, for me the IPA keyboard layout is what has worked best.

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] IPA transcription

2017-03-23 Thread Nicola

On 23/03/2017 16:57, Nicola wrote:

On 23/03/2017 14:49, Angel M Alganza wrote:

Hello:

Is there a (easy) way to write phonetic
transcriptions using the IPA (International
Phonetic Alphabet) in ConTeXt?  I can't find any
reference to it in the documentation.



Hello:

Is there a (easy) way to write phonetic
transcriptions using the IPA (International
Phonetic Alphabet) in ConTeXt?  I can't find any
reference to it in the documentation.


I did that some time ago, but I can speak only for macOS. You want to
have:

- fonts supporting phonetic symbols (both in the text editor and for the
  output);
- an IPA keyboard layout;
- a good text editor;
- good international support from the OS.

I used Charis SIL (for the fonts) and SF Mono (macOS fixed-width font)
in the text editor. Keyboard layouts can be found here:


Sorry, this is the right link:

http://scripts.sil.org/cms/scripts/page.php?item_id=UniIPAKeyboard

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] IPA transcription

2017-03-23 Thread Nicola

On 23/03/2017 14:49, Angel M Alganza wrote:

Hello:

Is there a (easy) way to write phonetic
transcriptions using the IPA (International
Phonetic Alphabet) in ConTeXt?  I can't find any
reference to it in the documentation.


> Hello:
>
> Is there a (easy) way to write phonetic
> transcriptions using the IPA (International
> Phonetic Alphabet) in ConTeXt?  I can't find any
> reference to it in the documentation.

I did that some time ago, but I can speak only for macOS. You want to
have:

- fonts supporting phonetic symbols (both in the text editor and for the
  output);
- an IPA keyboard layout;
- a good text editor;
- good international support from the OS.

I used Charis SIL (for the fonts) and SF Mono (macOS fixed-width font)
in the text editor. Keyboard layouts can be found here:

http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi_id=ipa-sil_keyboard

The text editor I use is (Mac)Vim, which has very good Unicode support.
Finally, you configure the OS to easily switch between keyboards
layouts. In macOS, you go to System Preferences > Keyboard > Input
Sources and select the desired keyboard layout, including the IPA
layout, then check “Show input in menu bar”. Then you go to Shortcuts >
Input Sources and configure your preferred key combo to switch between
keyboard layouts.

In my workflow, I was keeping the keyboard viewer opened and typing the
phonetic symbols directly, switching back and forth between English and
IPA keyboards. After a while, it becomes quite natural and you don't
even need to look at the keyboard viewer any longer.

On the ConTeXt side, nothing special is required. This is a simple
example (your newsreader may not render the phonetic symbols):

\definefontfamily [mainface] [rm] [Charis SIL]
\setupbodyfont[mainface]
\starttext
naujas, -a & [ˈnɑʊjɑs], [nɑʊˈjɑ] & new & \\
draugas (m) & [ˈdrɑʊɡɑs] & friend & \\
susitikimas (m) & [sʊsʲɪtʲɪˈkʲɪmɑs] & meetinɡ & \\
irgi & [ˈɪrɡʲɪ] & also  & aš irgi esu studentas (I'm a student, too) \\
gyventi & [ɡʲiːˈʋʲɛːntʲɪ] & to live & aš gyvenu Italijoje  (I live in 
Italy) \\

butas (m) & [ˈbʊtɑs] & flat, apartment & \\
motina (f) & [ˈmoːtʲɪnaː] & mother & \\
mergaitė (f) & [mʲɛrˈɡɑɪtʲeː] & girl & \\
ruošti & [ˈrʊoːʃʲtʲɪ] & to prepare & \\
dirbti & [ˈdʲɪrbʊ] & to work & \\
norėti & [noˈrʲeːtʲɪ] & to want & \\
rašyti & [rɑˈʃʲiːtʲɪ] & to write &  \\
skaityti & [skɑɪˈtʲiːtʲɪ] & to read & \\
sportuoti & [sporˈtu:otʲɪ] & to go in for sport & \\
keliauti & [kʲɛˈlʲɑʊtʲɪ] & to travel & \\
pasivaikščioti & [pɑsʲɪˈʋɑɪkʃʲtʃʲotʲɪ] & to go for a walk &\\
universitetas (m) & [unʲɪʋʲɛrʲsʲɪˈtʲɛtɑs] &  university & \\
mėgti & [ˈmʲeːɡtʲɪ] & to like & \\
manyti  & [mɑˈnʲiːtʲɪ] & to think & \\
žinoti & [ʒʲɪˈnoːtʲɪ] & to know & \\
\stoptext


Happy TeXing!
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] Suddenly, my font is not used any longer

2017-02-21 Thread Nicola

On 20/02/2017 18:16, Aditya Mahajan wrote:

On Mon, 20 Feb 2017, Nicola wrote:


Hello everyone,
I am re-typesetting a mkiv document that uses system fonts for text and
math (through \definefontfamily). Suddenly, it renders Latin Roman for
the text. May it be a cache corruption problem? I recall that there's
a command to clear the font cache, but I cannot remember which.


mtxrun --script fonts --reload --force


Thanks, that did the trick!

I realize that I should have read mtxrun's help more carefully:

1. `mtxrun --help` tells me how to list all the scripts;
2. `mtxrun --script` tells me that there is a `fonts` script;
3. `mtxrun --script fonts --help` tells me the fonts script's options.

It's nearly as fast as posting to this list and getting a reply ;)

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
___

[NTG-context] Suddenly, my font is not used any longer

2017-02-20 Thread Nicola

Hello everyone,
I am re-typesetting a mkiv document that uses system fonts for text and
math (through \definefontfamily). Suddenly, it renders Latin Roman for
the text. May it be a cache corruption problem? I recall that there's
a command to clear the font cache, but I cannot remember which.


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] Vertical space around displayed formulas

2017-01-18 Thread Nicola

On 18/01/2017 17:53, Otared Kavian wrote:

Hi Nicola,

In fact, if you are in a hurry and don’t use subtle things
introduced  since May 2016, you can use the stable version of ConTeXt from 
TeXLive
2016 (the bug noticed by Mikael, and you, is absent from that version of 
ConTeXt).


Thanks, that's what I am doing now. Strangely enough, it fixes the
layout for all the slides, *except* the one I have posted before. But
that one I can easily fix.

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] Vertical space around displayed formulas

2017-01-18 Thread Nicola

On 18/01/2017 16:53, Otared Kavian wrote:

Hi Nicola,

Indeed there is a recent bug, reported by Mikael Sundqvist a few days ago, and 
Hans is aware of this.
Hans said in the next release of ConTeXt beta the issue will be fixed.


Sorry, I hadn't noticed the other thread. I'll wait for the next beta then.

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

[NTG-context] Vertical space around displayed formulas

2017-01-18 Thread Nicola

Hello,
has something been changed in the last few months in the vertical
spacing of displayed formulas, frames or other environments?

I am re-typesetting some presentations using the latest beta and the
content of slides (especially those containing formulas) now tends to
flow to the next page, while before it used to fit in one page.

I paste below an example, if that helps. I am using a system font,
so you may not be able to reproduce my problem without it.

Is there something I should change in my documents?

Nicola

%%
\setuppapersize[S6][S6]

\setuplayout[
  width=middle,
  height=middle,
  topspace=2mm,
  header=0mm,
  headerdistance=0mm,
  location=singlesided,
  backspace=5mm,
  margin=0mm,
  edgedistance=0mm,
  margindistance=0mm
]

\setupalign[nothyphenated,flushleft]

% Ocean Sunset (color.adobe.com)
\definecolor[colorone][r=0.251, g=0.349, b=0.322]
\definecolor[colortwo][r=0.612, g=0.608, b=0.478]
\definecolor[colorthree]  [r=1.0,   g=0.827, b=0.576]
\definecolor[colorfour]   [r=1.0,   g=0.592, b=0.310]
\definecolor[colorfive]   [r=0.960, g=0.310, b=0.161] %t=0.8 , a=multiply]
\definecolor[nearlywhite] [s=0.996]

% Fonts
\definefontfamily[slidesfont][serif][Avenir] [
  tf=name:Avenir Light,
  it=name:Avenir Light Oblique,
  bf=name:Avenir Heavy,
  bi=name:Avenir Heavy Oblique
]
\definefontfamily[slidesfont][sans][Avenir] [
  tf=name:Avenir Light,
  it=name:Avenir Light Oblique,
  bf=name:Avenir Heavy,
  bi=name:Avenir Heavy Oblique
]
\definefallbackfamily[slidesfont][mono][Xits][range={"0222A,"02229,"02205}] 
% ∪, ∩, ∅

\definefontfamily[slidesfont][mono][Latin Modern Mono Light][features=none]
\definefallbackfamily[slidesfont][math][Xits][range={"025C7,"27D5}] % 
WHITE DIAMOND, left-join, WHITE RIGHT-POINTING TRIANGLE

\definefontfamily[slidesfont][math][TeX Gyre Pagella Math]

\setupbodyfont[slidesfont]

% Foreground/background color
\setupcolors[textcolor=colorone]
\setupbackgrounds[page][background=color, backgroundcolor=nearlywhite]

% Header
\startreusableMPgraphic{header:background}
  fill OverlayBox
leftenlarged BackSpace
rightenlarged CutSpace
topenlarged TopSpace
withcolor OverlayColor ;
  setbounds currentpicture to OverlayBox
enlarged max(BackSpace,CutSpace) ;
\stopreusableMPgraphic

\defineoverlay[header:background][\reuseMPgraphic{header:background}]

\define[2]\MySlide{\framed[
  frame=off,
  background=header:background,
  backgroundcolor=colorfive,
  width=\textwidth,
  align=flushleft
]{#2}}

\definehead[slide][subject]
\setuphead[slide][
  style=\ssb,
  command=\MySlide,
  color=nearlywhite,
  insidesection=\doifnot{\structureuservariable{align}}{top}\vfill,
  aftersection=\doifnot{\structureuservariable{align}}{top}\vfill,
  page=yes,
]

% Footer
\setuppagenumbering[location=]
\setupfooter[style=small, color=colortwo]
\setupfootertexts[][\userpagenumber/\lastuserpage]

% Lists
\startuseMPgraphic{itemize:main}
  save p; path p;
  p := fullcircle scaled 1.5ExHeight;
  fill p withcolor \MPcolor{colorfive};
\stopuseMPgraphic

\startuseMPgraphic{itemize:nested}
  save p; path p;
  p := ((0,-0.5)--(0,0.5)--(0.866,0)--cycle) scaled 1.5ExHeight;
  fill p withcolor \MPcolor{colorfive};
\stopuseMPgraphic

\definesymbol[itemize:main][\useMPgraphic{itemize:main}]
\definesymbol[itemize:nested][\useMPgraphic{itemize:nested}]

\setupitemize[1][symbol=itemize:main]
\setupitemize[2][symbol=itemize:nested, width=1.5ex]
\setupitemize[2][nowhite]

\setupitemize[
  headstyle=\ssa,
  headcolor=colorfive,
  afterhead={\blank[none]},
  inbetween={\blank[big]},
  leftmargin=1em,
  rightmargin=1em,
]

% Tables
\setuptables[rulethickness=0.06em]

\setupinteraction[state=start,  % make hyperlinks active, etc.
  style=\tf,
  color=colortwo,
  title={What Do You Mean, “Null”?},
  author={Nicola Vitacolonna},
  keyword={null}]

% \usebtxdataset[main.bib]
% \usebtxdefinitions[apa]
\setupcombinations[distance=3cm,location=top]
\defineframedcontent[tablebackground][frame=off,background=color,backgroundcolor=colorthree]
\setuptables[rulethickness=0.06em,frame=tablebackground]

\setupalign[nothyphenated,flushleft]

\defineparagraphs[twocol][n=2]
\setupparagraphs[twocol][1][width=.7\textwidth]


\starttext
\switchtobodyfont[17.3pt]

\startslide[title={Which Nulls?}][align=top]
  All of the above may be abstracted into three categories:

  \startitemize[packed]
\item
Exists, but unknown ({\bf missing value})
\startformula
  \exists x\,\hbox{Yalta}(\hbox{Winston},x,\hbox{Churchill})
\stopformula
\item
Nonexistent, not applicable ({\bf inapplicable null})
\startformula
  \neg\exists x\,\hbox{Yalta}(\hbox{Winston},x,\hbox{Churchill}) \land
  \hbox{Yalta}_{-2}(\hbox{Winston},\hbox{Churchill})
\stopformula
\item
Not known to exist ({\bf no-information null})
\startformula
  \hbox{Yalta}_{-2}(\hbox{Winston},\hbox{Churchill})
\stopformula
  \s

Re: [NTG-context] Vim wiki page updated

2016-11-05 Thread Nicola

On 02/11/2016 23:35, Aditya Mahajan wrote:

On Wed, 2 Nov 2016, Nicola wrote:



I could maybe create a GitHub repository, to make it easier to merge
your work.


That will be nice. Then I can also send you pull requests for specific
things.


Here it is: https://github.com/lifepillar/vim-context-metapost

The updates to the above repository will be periodically forwarded
for inclusion in Vim.

You may use the issue tracker at GitHub to suggest improvements or
report bugs (I have already included a syntax highlighting enhancement
suggested by Wolfgang Schuster). Pull requests are welcome, too!

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] Vim wiki page updated

2016-11-05 Thread Nicola

On 05/11/2016 15:45, Alan Braslau wrote:

Hans, Nicola,

Being a vim user (and not presently taking much advantage of the syntax 
highlighting), and a MP fan, I will take care of this (in coordination with 
Hans, eventually).

Alan


For what is worth, I attach the Ruby script I am using. It outputs the 
keywords in a format that can be used directly in Vim.


Nicola
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

# Copyright (c) 2016 Lifepillar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

VERSION = '1.0.0'

def debug title, *info
  return unless $DEBUG
  puts "\033[1;35m[DEBUG]\033[1;39m #{title}\033[0m"
  info.each do |chunk|
chunk.each_line do |l|
  puts "\033[1;35m[DEBUG]\033[0m #{l.chomp!}"
end
  end
end

def help; <<-HELP
Usage: parse_metafun [ ...]
Options:
-h, --help   Show this help message and exit.
--versionPrint version and exit.
--debug  Enable debugging.

Example:
parse_metafun mp-tool.mp mp-step.mp
  HELP
end

# Parse options
paths = []
n = ARGV.length
i = 0
while i < n
  case ARGV[i]
  when /^--version$/
puts VERSION
exit(0)
  when /^--debug$/
$DEBUG = true
  when /^-h|--help$/
puts help
exit(0)
  else # Assume it is a path
paths << ARGV[i]
  end
  i += 1
end

if paths.empty?
  paths << Dir.entries(".")
end

maxlinelen = 52
defs = {}
saved_vars = {}
known_commands = [
]
known_constants = [
]
known_defs = [
]
known_primary_defs = [
]
known_secondary_defs = [
]
known_tertiary_defs = [
]
known_vardefs = [
]
known_num_exps = [
]
known_types = [
]
false_positives = [
  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', # just to be safe
  'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', # just to be safe
  'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', # just to be safe
]
types = 'boolean|color|cmykcolor|numeric|pair|path|pen|picture|rgbcolor|string|transform'
types += '|' + known_types.join('|')

begin
  paths.each do |p|
name = File.basename(p)
defs[name] = {
  'mpCommand' => [],
  'mpDef' => [],
  'mpVardef' => [],
  'mpPrimaryDef' => [],
  'mpSecondaryDef' => [],
  'mpTertiaryDef' => [],
  'mpNewInternal' => [],
  'mpNumExp' => [],
  'mpType' => [],
  'mpVariable' => [],
  'mpConstant' => [],
  'LET' => []
}
saved_vars[name] = []
File.open(p).each_line do |l|
  next if l =~ /^\s*%/ # skip comments
  /^[^%]*\bdef\s+(\w+)/.match(l) { |m|
if m[1] !~ /^_|_$/
  defs[name]['mpDef'] << m[1]
end
  }
  /^[^%]*\bvardef\s+(\w+)/.match(l) { |m|
if m[1] !~ /^_|_$/
  defs[name]['mpVardef'] << m[1]
end
  }
  /^[^%]*\bprimarydef\s+\w+\s+(\w+)/.match(l) { |m|
if m[1] !~ /^_|_$/
  defs[name]['mpPrimaryDef'] << m[1]
end
  }
  /^[^%]*\bsecondarydef\s+\w+\s+(\w+)/.match(l) { |m|
if m[1] !~ /^_|_$/
  defs[name]['mpSecondaryDef'] << m[1]
end
  }
  /^[^%]*\btertiarydef\s+\w+\s+(\w+)/.match(l) { |m|
if m[1] !~ /^_|_$/
  defs[name]['mpTertiaryDef'] << m[1]
end
  }
  l.scan(/\bnewinternal\b\s+([^;]+);/).each { |m|
m[0].split(/,/).each { |w|
  w.strip!
if w !~ /^_|_$/
defs[name]['mpNewInternal'] << w
  end
}
  }
  /^[^%]*\blet\s+(\w+)/.match(l) { |m|
if m[1] !~ /^_|_$/
  if !false_positives.include?(m[1])
if known_constants.include?(m[1])
  defs[name]['mpConstant'] << m[1]
elsif known_types.include?(m[1])
  defs[name]['mpType'] << m[1]
elsif known_defs.include?(m[1])
  defs[name]['mpDef'] << m[1]
elsif known_vardefs.include?(m[1])
  defs[name]['mpVardef']

Re: [NTG-context] Vim wiki page updated

2016-11-03 Thread Nicola

On 03/11/2016 12:28, Hans Hagen wrote:


if you need a command list .. there are scripts for that (no vim yet,
but for scite we ship simple lists of commands)


Are these scripts available somewhere?


what kind of datafile do you need?


I need the list of all macros, vardefs, internals, and global variables
from all MetaFun files. The format should be Vim's syntax format:

https://github.com/vim/vim/blob/master/runtime/syntax/mp.vim

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] Vim wiki page updated

2016-11-03 Thread Nicola

On 03/11/2016 10:45, Hans Hagen wrote:

On 11/2/2016 11:35 PM, Aditya Mahajan wrote:

On Wed, 2 Nov 2016, Nicola wrote:


The syntax scripts in Vim already cover all of MetaFun. MetaFun
keywords are highlighted by default inside ConTeXt documents; for
MetaPost files ('mp' filetype), you must put

  let g:mp_metafun_macros = 1

into your vimrc.


Ah, great!


if you need a command list .. there are scripts for that (no vim yet,
but for scite we ship simple lists of commands)


Are these scripts available somewhere?

I've rolled out my own, but I will happily use/adapt something "more 
official".



> The indent file is adapted from (I think) latex-suite's indent file
with
> modificiations that suit my taste. I am not sure these should go into
> the default vim indent file, but it may be worthwhile for you to
take a
> quick look.

MetaPost indentation is tough. I have rewritten the indent script in
Vim from scratch, and now it works reasonably well. I will try yours,
but you might try the one currently in Vim, too.


I did not change metapost indenting, but defined some rules for
indenting of context files. I believe that your indent file does not
attempt to indent context files (I may be mistaken because I am just
reading the .vim files, not testing it as I don't have vim8 yet).


Correct, no indentation for ConTeXt. This is something that may be worth 
adding.



I could maybe create a GitHub repository, to make it easier to merge
your work.


That will be nice. Then I can also send you pull requests for specific
things.


Ok, I'll let you know when I've done it. Pull requests will make my life 
much easier :)


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] Vim wiki page updated

2016-11-02 Thread Nicola

On 02/11/2016 19:39, Aditya Mahajan wrote:
> On Tue, 1 Nov 2016, Nicola wrote:
>
>> I have updated the Vim page at ConTeXt Garden:
>>
>> http://wiki.contextgarden.net/Vim
>>
>> It may be considered as the official documentation of the ConTeXt
>> scripts in Vim, as the only other documentation is the source code
>
> Hi Nicola,
>
> I wonder if you have seen my vim runtime files:
> https://github.com/adityam/vim-context

Unfortunately not, I worked only on those already in Vim.

> The main file to look at is the syntax highlighting file. I haven't
> compared
> carefully with your version (haven't installed vim 8 yet), but there 
are a

> few differences. It may be worthwhile to merge the two syntax files.

Ok, I will take a look. I see that your file does not depend on 
plaintex.vim. It might be a good idea to remove that dependency...


> The metapost syntax highlighting file defines a few keywords that are
> used by
> metafun. Could these be merged to your mp syntax highlighting file?

The syntax scripts in Vim already cover all of MetaFun. MetaFun keywords 
are highlighted by default inside ConTeXt documents; for MetaPost files 
('mp' filetype), you must put


  let g:mp_metafun_macros = 1

into your vimrc.

> The indent file is adapted from (I think) latex-suite's indent file with
> modificiations that suit my taste. I am not sure these should go into
> the default vim indent file, but it may be worthwhile for you to take a
> quick look.

MetaPost indentation is tough. I have rewritten the indent script in Vim 
from scratch, and now it works reasonably well. I will try yours, but 
you might try the one currently in Vim, too.


> The ftplugin file mainly contains shortcuts like `a expand to α, etc;
> again,
> adapted from latex-suite (which in-turn borred the idea from auctex). 
These

> depend on a ftplugin file provided by latex-suite. There were also a few
> macros to reflow text, but your code is more robust and has more 
features.


I will look into those, too. Do you know that Vim has built-in support 
for digraphs (:h digraphs)? For example, α can be obtained by typing 
a* in Insert mode.


> The compiler file is old and I haven't tested it in a few years, so 
please

> ignore it.

OK.

I could maybe create a GitHub repository, to make it easier to merge 
your work.


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
___

[NTG-context] Vim wiki page updated

2016-11-01 Thread Nicola

I have updated the Vim page at ConTeXt Garden:

http://wiki.contextgarden.net/Vim

It may be considered as the official documentation of the ConTeXt 
scripts in Vim, as the only other documentation is the source code :)


Happy editing!
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
___

[NTG-context] .mp files in non-standard locations

2016-10-26 Thread Nicola

Hello,
I have some documents that contain:

\startMPinclusions
input "mycode";
\stopMPinclusions

where mycode.mp is somewhere in my project's directory. Is there a way 
to tell ConTeXt how to find it?


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] Text editors

2016-10-25 Thread Nicola

On 25/10/2016 22:11, Henning Hraban Ramm wrote:

> On OSX, jEdit is no fun.
> LilyPondTool for jEdit is deprecated (if it still works at all, it 
didn’t for me years ago).
> For LilyPond there’s nothing better than Frescobaldi (except Emacs, 
vi and ed, of course).


I didn't know that (I haven't used jEdit for a while). Too bad.

>> - TextWrangler (shameless plug: I wrote decent syntax support for 
MetaPost/MetaFun);

>
> I’m still using that, too (but switching). Where can we find your 
support files?


http://users.dimi.uniud.it/~nicola.vitacolonna/software/metapost-textwrangler/

MetaFun syntax is outdated, though…

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] Text editors

2016-10-25 Thread Nicola

> Hi,
>
> You forgot my favorite editor:
>
> cat > file.tex

Mandatory xkcd at this point: https://www.xkcd.com/378/

> More seriously

I mostly use Vim. I don't know of other ConTeXt-aware editors apart from 
those already in the list, but in the other section I would include:


- jEdit (http://www.jedit.org), good for TeX and LilyPond;

- TextWrangler (shameless plug: I wrote decent syntax support for 
MetaPost/MetaFun);


- Atom (https://atom.io): I have not used it much, but it has lots of 
plugins, so chances are that there is some good TeX stuff.


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] Text editors

2016-10-24 Thread Nicola

On 24/10/2016 13:41, Henning Hraban Ramm wrote:


How about including the vim support files in the distribution (like the SciTE 
support files)?


Updated scripts for ConTeXt have just been included in Vim:

https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08

so there is no need to include anything in the ConTeXt distribution.

I plan to update the Vim wiki page on ConTeXt Garden when I have some 
time: I will post here when I have done it.


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] ANN: Updated Vim scripts for ConTeXt

2016-10-20 Thread Nicola

On 21/10/2016 00:22, Sandiford Kevin wrote:

 Hi  Nicola,

Thanks for the vim scripts, I've been looking for something like this
for a while.

Just a minor problem, on windows the :make or :ConTeXt commands fail if
there is a space in the path or file name.

Changing fnameescape() to shellescape() in the definition of l:makeprg
in line 21 of compiler/context.vim seems to fix this


Good catch, thanks! Could you please try the attached version, which 
should fix that and has other changes?


Please note that in the current version, :make does not `cd` any more 
(that was causing other issues), so you have to do it yourself before 
typesetting (using :cd or :lcd). That said, :ConTeXt should be a better 
option under all circumstances.


Nicola



context.tgz
Description: GNU Zip compressed data
___
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] Parsing ConTeXt errors

2016-10-13 Thread Nicola

On 2016-10-13 18:37:38 +, Hans Hagen said:


On 10/12/2016 9:30 AM, Nicola wrote:

On 2016-10-11 22:13:12 +, Hans Hagen said:


On 10/11/2016 9:37 PM, Nicola wrote:

On 2016-10-11 18:52:32 +, Alan Braslau said:


Of course, I *never* make MetaPost errors... ;-)

However, you can search the log file for
metapost> error:


Sure. But there is no line number. Compare with a typical TeX error:


because there are no lines ... the library gets strings


Would it be possible to report at least the location of the enclosing
\...MP... block?


it will always be the line where such a block ends, i adapted the
message a bit

tex error   > mp error on line 51 in file e:/tmp/oeps.tex:

 >> foo
! Isolated expression.

;
<*> ...draw fullcircle scaled (i) ; endfor ; foo ;

I couldn't find an `=' or `:=' after the
expression that is shown above this error message,
so I guess I'll just ignore it and carry on.

(the extra details at the end will be available in the next luatex
binary as it needs an updated mplibrary).


Looks good, looking forward to trying it!

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ANN: Updated Vim scripts for ConTeXt

2016-10-12 Thread Nicola

On 2016-10-12 10:18:10 +, DesdeChaves said:


Thanks a lot.

Autocompletation don't works for me. Perhaps I have a wrong .vimrc 
file. Can you share your .vimrc file or a working .vimrc file.


There is nothing to be configured. The mapping to trigger the 
completion is 

(ctrl-x followed by ctrl-o) and it works inside \startMP...\stopMP... blocks.
Doesn't that work for you?

Maybe you expected the suggestions to pop-up without pressing any key? 
For that, you

need a plugin like NeoComplete or AutoComplPop.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Parsing ConTeXt errors

2016-10-12 Thread Nicola

On 2016-10-11 22:13:12 +, Hans Hagen said:


On 10/11/2016 9:37 PM, Nicola wrote:

On 2016-10-11 18:52:32 +, Alan Braslau said:


Of course, I *never* make MetaPost errors... ;-)

However, you can search the log file for
metapost> error:


Sure. But there is no line number. Compare with a typical TeX error:


because there are no lines ... the library gets strings


Would it be possible to report at least the location of the enclosing
\...MP... block?

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Parsing ConTeXt errors

2016-10-11 Thread Nicola

On 2016-10-11 18:52:32 +, Alan Braslau said:


Of course, I *never* make MetaPost errors... ;-)

However, you can search the log file for
metapost> error:


Sure. But there is no line number. Compare with a typical TeX error:

tex error   > tex error on line 210 in file /path/to/main.tex: ! 
Undefined control sequence


l.210 \sdkjdkjhkdkkjk

In the same line you see:

1) the type of error (tex error);
2) the line number;
3) the file in which the error occurs;
4) the error message.

For MetaPost errors, only 1) and 4) are given with the error; 3) may be 
inferred

(by tracking `open source`/`close source` lines). But I see no trace of 2).

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

  1   2   3   >