Re: [NTG-context] filter module / externalizing TikZ graphics

2021-01-30 Thread Aditya Mahajan
On Sat, 30 Jan 2021, Henning Hraban Ramm wrote:

> >> If I use \starttikz[name=example], I get 
> >> "JOBNAME-temp-tikzThick-example.tmp".
> >> I’d like to get something like "COMPONENTNAME-##-example.tmp" or a path 
> >> like "COMPONENTNAME/example_##.tmp".
> >> Is there a configuration hook in the module to change name generation?
> > 
> > No. I don't quite understand the concern. How do you plan to use a 
> > `name=value` option?
> 
> The current auto-generated file names are uncomfortably long, and I’d like to 
> know which contains what.

The idea was to avoid clash of names. That is why the file name starts with 
\jobname. I also want to avoid clash if you use multiple filters in the same 
file (a common use case for my projects), hence there is filtername. The -temp- 
is there because at some point context used to delete \jobname-temp-.tmp files 
if you passed the --purge option, but I see that it is no longer the case. 
Maybe that can be removed from the default name. The last part are the numbers, 
which are needed when caching results. 

> I’m not yet sure what would make the most sense for this project (at least 
> sorting by chapter/component would), but I have an use case with LilyPond 
> where I could save several LilyPond compile runs if I could influence the 
> naming:
> 
> I got ~500 songs in their own component files, and I use them in different 
> songbooklets with the same layout. E.g. there’s one containing all the songs 
> and several with a subject (e.g. winter & christmas, children, medieval & 
> fantasy, some author...).
> They all use [name=\currentcomponent]. If I could avoid the JOBNAME part of 
> the file name, all booklets would use the same note PDFs. Now, the temp 
> directory contains literally thousands of files.
> Since this is just for fun, the additional space and compile time is just a 
> bit annoying and doesn’t affect others, but I like to streamline my 
> workflows...

This is a relatively simple feature to add. I have pushed a new branch with 
this feature: https://github.com/adityam/filter/tree/prefix

I have added a new `prefix` option: you can use 

\defineexternalfilter[][prefix=whatever]

and then the filter module will write the temp name as `whateverfilter0.ext` 
`whateverfilter1.ext`. The default value of prefix is \jobname-temp- (note 
trailing dash), so there should be no difference in the default output, but now 
you can configure the prefix if you want.

I am also open to making filter name as part of the prefix, so that you can 
have the ability to remove it if you wish. But I am hesitant to do so because 
it can lead to hard to debug errors if there is a clash in the prefix of two 
different filters. 

I haven't tested it beyond simple tests to make sure that nothing breaks. 
You can copy t-filter.mkiv from 
https://raw.githubusercontent.com/adityam/filter/prefix/t-filter.mkiv to your 
working directory and test if works for your situation. 


Aditya

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

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


Re: [NTG-context] Bib support broken in lmtx

2021-01-30 Thread Thomas A. Schmitz


On 1/30/21 10:50 AM, Philipp A. wrote:

Am I caught in a spam filter somewhere?



Compiles fine here with 2021.01.28 18:22

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

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


Re: [NTG-context] Bib support broken in lmtx

2021-01-30 Thread Philipp A.
Am I caught in a spam filter somewhere?

Am So., 3. Jan. 2021 um 13:30 Uhr schrieb Philipp A. :

> So, where do I go with this?
>
> Can nobody reproduce it? Should I submit it to the bug tracker? How can I
> help to get this resolved?
>
> Am Sa., 26. Dez. 2020 um 11:29 Uhr schrieb Philipp A.  >:
>
>> Thank you, but whitespace is ignored in .bib file syntax. To prove that
>> whitespace handling isn’t the bug, just try accessing it:
>>
>> \startluacode
>> local current = publications.datasets.default
>> tex.print('\\starttyping')
>> tex.print(table.serialize(current.luadata))
>> -- to show that the key doesn’t contain weird invisible characters, I’ll
>> type it here:
>> tex.print(table.serialize(current.luadata.angerer2016))
>> tex.print('\\stoptyping')
>> \stopluacode
>>
>> will display:
>>
>> t={
>>   ["angerer2016"]={
>> ["author"]="Angerer...",
>> ["category"]="article",
>> ...
>>   },
>> }
>> t={
>>   ["author"]="Angerer...",
>>   ["category"]="article",
>>   ...
>> }
>>
>> *Another thing*: Uncommenting the \placelistofpublications makes it
>> work, but not in my real document. I didn’t go through the trouble of
>> reproducing when *that* stops working, as I think the root cause can
>> probably be found with my minimal example.
>>
>> Best, Phil
>>
>> Am Fr., 25. Dez. 2020 um 19:24 Uhr schrieb :
>>
>>> Don't know if that's related, but you should probably removethe space
>>> before the key in your bibfile.
>>> 
>>> Von: ntg-context  im Auftrag von Philipp A.
>>> 
>>> Gesendet: Freitag, 25. Dezember 2020 18:36:33
>>> An: ConTeXt Mailing List
>>> Betreff: [NTG-context] Bib support broken in lmtx
>>>
>>> Hi! A pretty minimal document using a bibliography is broken for me:
>>>
>>> test.lmtx:
>>> \enableregime[utf-8]
>>> \mainlanguage[en]
>>>
>>> \usebtxdataset[default][test.bib]
>>> \setupbtx[dataset=default]
>>> \usebtxdefinitions[apa]
>>>
>>> \starttext
>>>
>>> \cite[authoryear][angerer2016]
>>>
>>> %\placelistofpublications[default][method=dataset]
>>>
>>> \stoptext
>>>
>>> test.bib:
>>> @Article{ angerer2016,
>>> author = {Angerer, Philipp and Haghverdi, Laleh and B{\"{u}}ttner, Maren
>>> and Theis, Fabian J and Marr, Carsten and Buettner, Florian},
>>> doi = {10.1093/bioinformatics/btv715},
>>> issn = {14602059},
>>> journal = {Bioinformatics},
>>> language = {en},
>>> number = {8},
>>> pages = {1241--1243},
>>> title = {{Destiny: Diffusion maps for large-scale single-cell data in
>>> R}},
>>> url = {
>>> http://bioinformatics.oxfordjournals.org/lookup/doi/10.1093/bioinformatics/btv715
>>> files/103/Angerer et al. - 2016 - destiny diffusion maps for large-scale
>>> single-cel.pdf},
>>> volume = {32},
>>> year = {2016}
>>> }
>>>
>>> This log occurs:
>>>
>>> ❯ context test.lmtx
>>> resolvers   | formats | executing runner 'run luametatex format':
>>> ~/Library/ConTeXt/tex/texmf-osx-64/bin/luametatex --jobname="test"
>>> --fmt=~/Library/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
>>> --lua=~/Library/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
>>> --c:currentrun=1 --c:fulljobname="./test.lmtx" --c:input="./test.lmtx"
>>> --c:kindofrun=1 --c:maxnofruns=9
>>> --c:texmfbinpath="~/Library/ConTeXt/tex/texmf-osx-64/bin"
>>> system  >
>>> system  > ConTeXt  ver: 2020.12.24 17:30 LMTX  fmt: 2020.12.25
>>> int: english/english
>>> system  >
>>> system  > 'cont-new.mkxl' loaded
>>> open source > level 1, order 1, name
>>> '~/Library/ConTeXt/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
>>> '~/Library/ConTeXt/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
>>> system  > files > jobname 'test', input './test.lmtx', result
>>> 'test'
>>> fonts   > latin modern fonts are not preloaded
>>> languages   > language 'en' is active
>>> open source > level 1, order 2, name './test.lmtx'
>>> publications> adding bib data to set 'default' from source 'test.bib'
>>> open source > level 2, order 3, name
>>> ~/Library/ConTeXt/tex/texmf-context/tex/context/base/mkiv/publ-imp-apa.mkvi'
>>> close source> level 2, order 3, name
>>> '~/Library/ConTeXt/tex/texmf-context/tex/context/base/mkiv/publ-imp-apa.mkvi'
>>> fonts   > preloading latin modern fonts (second stage)
>>> fonts   > 'fallback modern-designsize rm 12pt' is loaded
>>> publications> analyzing previous publication run for 'default'
>>> publications> no entry 'angerer2016' found in dataset 'default'
>>> backend > xmp > using file
>>> '~/Library/ConTeXt/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
>>> pages   > flushing realpage 1, userpage 1, subpage 1
>>> close source> level 1, order 3, name './test.lmtx'
>>>
>>> mkiv lua stats  > used config 

Re: [NTG-context] filter module / externalizing TikZ graphics

2021-01-30 Thread Henning Hraban Ramm

> Am 30.01.2021 um 00:13 schrieb Aditya Mahajan :
> 
> For \processFILTER, t-filter does not even read the file... so it has to do 
> with how the filtercommand is defined. 
> 
>> Since this fails already, I don’t know if \processFILTERfile also uses 
>> bufferbefore/-after (it should).
> 
> It does not. As I said, for processing external files, t-filter does not even 
> read the file and just takes care of caching the result. It is assumed that 
> the filter command can process the external file. 

A pity. I didn’t understand that from the documentation.
That means I need to setup different filters for internal and external graphics 
with the same content.

> I can see if it is possible to active before and after filters while 
> processing external files.

That would solve this problem for me and would make the behavior of filter 
commands more consistent.
OTOH I can understand you don’t want to bloat your module.

> Another option is to write the external files as valid tex file (i.e., with a 
> \startTEXpage .. \stopTEXpage wrapper), and when defining the filtercommand, 
> use something like `context --environment=env filename`, where env is the 
> environment file with all the settings for fonts etc. 

I don’t see this as an option, as we try to avoid code duplication over 
hundreds of graphics snippets.
The \start/stop environment, as well as external files, should just contain the 
TikZ commands. All common setup/teardown code belongs in extra files/buffers.

>> (2) working directory
>> 
>> Since ConTeXt can’t put generated (temporary) files into a directory and 
>> --result also only renames afterwards, the directory key doesn’t help, I had 
>> to add "mv" and "cd" to my filtercommand.
>> I didn’t check yet if caching works.
> 
> Caching should work if \definefilter is configured correctly. 

Thanks.

> From the point of view of t-filter module, this is a bug in the external 
> program and you should contact upstream for a fix :-)

Yes.
There were already several requests about ConTeXt using work/temp directories 
and changing the behavior of "--result".

> Most (all?) other programs are happy to write a file in any directory (modulo 
> write permissions, etc.).

> I do not want to increase the complexity of the module to handle such corner 
> cases. 

I can understand that.
I should probably let filter call an external script, or fork t-filter for my 
needs.


>> If I use \starttikz[name=example], I get 
>> "JOBNAME-temp-tikzThick-example.tmp".
>> I’d like to get something like "COMPONENTNAME-##-example.tmp" or a path like 
>> "COMPONENTNAME/example_##.tmp".
>> Is there a configuration hook in the module to change name generation?
> 
> No. I don't quite understand the concern. How do you plan to use a 
> `name=value` option?

The current auto-generated file names are uncomfortably long, and I’d like to 
know which contains what.

I’m not yet sure what would make the most sense for this project (at least 
sorting by chapter/component would), but I have an use case with LilyPond where 
I could save several LilyPond compile runs if I could influence the naming:

I got ~500 songs in their own component files, and I use them in different 
songbooklets with the same layout. E.g. there’s one containing all the songs 
and several with a subject (e.g. winter & christmas, children, medieval & 
fantasy, some author...).
They all use [name=\currentcomponent]. If I could avoid the JOBNAME part of the 
file name, all booklets would use the same note PDFs. Now, the temp directory 
contains literally thousands of files.
Since this is just for fun, the additional space and compile time is just a bit 
annoying and doesn’t affect others, but I like to streamline my workflows...


>> (4) subprocess parameters
>> 
>> I’d like to forward some parameters from \starttikz to the temp buffer, e.g. 
>> \starttikz[name=example][mystyle=thick]
>> (using the same syntax as \startsection with a second pair of brackets for 
>> custom parameters).
>> And then have
>> \starttikzpicture[\filterusersetupvariable{mystyle}]
>> in the buffer.
>> 
>> My workaround so far is a copy of the filter setup (tikz/tikzThick), since 
>> we have only a few different configurations.
> 
> The code that I had posted already handles this, provided that the options 
> start on the line after \startfilter:

Ah, I didn’t look closely enough. Thank you, that’s an usable workaround.


Best, Hraban

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

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


Re: [NTG-context] font bug in latest from 2021.01.29 19:44?

2021-01-30 Thread Jairo A. del Rio
It is fine again. Thank you a lot, Hans.

Jairo :)

El vie., 29 de ene. de 2021 5:48 p. m., Pablo Rodriguez 
escribió:

> On 1/29/21 11:24 PM, Hans Hagen wrote:
> > On 1/29/2021 9:59 PM, Pablo Rodriguez wrote:
> >
> >> Could anyone confirm this bug?
> > hm, some overload protection side effect ... i'll fix it
>
> Many thanks for the fix, Hans.
>
> Pablo
> --
> http://www.ousia.tk
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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