[NTG-context] filter module / externalizing TikZ graphics

Henning Hraban Ramm texml at fiee.net
Sat Mar 6 09:12:46 CET 2021


Finally coming back to this.

> Am 31.01.2021 um 07:39 schrieb Aditya Mahajan <adityam at umich.edu>:
> 
>> 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.

That’s good, so if I set "prefix=,", I get "FILTER-COMPONENT.*", e.g. "lilypond-mysong-1.pdf" (LilyPond adds the number for each system). In the rare cases where component names collide or I need more than one filter environment per component, I can fix that manually.

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

Not needed IMO.

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

Works for me.

Thank you very much!

For the TikZ setup I’ll copy some of your code and sacrifice most of the configurability.
Will report back...

Hraban


More information about the ntg-context mailing list