ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Florent Michel <florent.m42@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: Calling C code from ConTeXt LMTX
Date: Mon, 16 Sep 2024 13:58:17 +0100	[thread overview]
Message-ID: <CALOhoeKRsPg7Hyg36mXj0YjmwZQZxViCx4HLrxZGhPbr_1LMUQ@mail.gmail.com> (raw)
In-Reply-To: <C6E57381-EA47-473D-9138-8C67C71E09F8@scorecrow.com>


[-- Attachment #1.1: Type: text/plain, Size: 3960 bytes --]

Thanks again Bruce! I had not thought about the possibility of parsing
comments in the tex file from an external tool, but that sounds like a very
good option. I like the fact that it would allow the tex file to contain
all the information needed to keep track of what is represented without
having to duplicate the parameter values. And since my specific workflow is
indeed already convoluted it will not really add extra complexity.

Thanks also Henning for mentioning the filter module! I'll have a closer
look into how I could use it - and it will certainly come useful, either
for this project or a future one!

Best regards,
Florent

Le lun. 16 sept. 2024 à 13:08, Bruce Horrocks <ntg@scorecrow.com> a écrit :

> On 16 Sep 2024, at 12:15, Henning Hraban Ramm <texml@fiee.net> wrote:
> >
> > Am 16.09.24 um 12:59 schrieb Bruce Horrocks:
> >>> On 15 Sep 2024, at 22:11, Florent Michel <florent.m42@gmail.com>
> wrote:
> >>>
> >>> Thanks Bruce for your very helpful reply!
> >>>
> >>> The reason for my question was indeed consistency, e.g. ensuring
> figure captions stay up to date with what the figures show when changing
> parameters. Thinking more about it, the second solution you mention seems
> to be a better option, though - I can simply define the parameters in an
> external file and read it from both the PDF solver and ConTeXt to ensure
> consistency. Thanks for mentioning it!
> >>>
> >>> Thank you also for mentioning \executesystemcommand, which I was not
> aware of!
> >> Another option might be to use a marker such as
> >> % DE_figure_here param1 param2 param3
> >> in your ConTeXt source and then use 'awk' or another Unix text
> pre-processor to scan through for these, run the appropriate DE
> calculation, plot the graph and generate the appropriate \placefigure
> command to go in its place.
> >> Bonus marks if it can automatically generate the caption based on the
> parameters! But if not, the marker can always follow the \placefigure macro
> e.g.
> >> \placefigure
> >>   {This is a DE showing something and something else}
> >>   % DE_figure_here param1 param2 param3
> >> so the awk code only needs to insert the image file name.
> >> Note I’ve deliberately omitted the braces from the bit to be
> substituted so that you need to generate them in the awk. That way, if you
> forget to process, you’ll get an error not a missing image.
> >
> > That sounds needlessly convoluted to me.
> > I’d use Aditya’s filter module to call external programs, it also does
> caching, i.e. if the parameters don’t change, it won’t waste processing
> time.
> >
> > https://github.com/adityam/filter
>
> I think Florent already has a situation that can be described as
> convoluted. Whether this is more so only he can say.
>
> I didn’t suggest the filter module to start with because it filters a
> buffer through an external command which isn’t Florent’s use-case (which is
> just the ability to call an external command). However I see, buried deeply
> in the docs, under the heading "Special use case:  \write18 with caching”
> there is the ability to call a single command which would work.
>
> Someone with better knowledge of the macro would need to explain how to
> adapt the ’size’ key to Florent’s usage to enable the caching.
>
> Regards,
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 5123 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2024-09-16 13:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-14 20:46 [NTG-context] " Florent Michel
2024-09-15 20:29 ` [NTG-context] " Bruce Horrocks
2024-09-15 21:11   ` Florent Michel
2024-09-16 10:59     ` Bruce Horrocks
2024-09-16 11:15       ` Henning Hraban Ramm
2024-09-16 12:06         ` Bruce Horrocks
2024-09-16 12:58           ` Florent Michel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALOhoeKRsPg7Hyg36mXj0YjmwZQZxViCx4HLrxZGhPbr_1LMUQ@mail.gmail.com \
    --to=florent.m42@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).