ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Stephen Gaito <stephen@perceptisys.co.uk>
To: ntg-context@ntg.nl
Subject: Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2
Date: Mon, 30 Nov 2020 09:51:33 +0000	[thread overview]
Message-ID: <20201130095134.5149207e@nn01> (raw)

Hello,

I am slowly working on a Mathematical problem requiring underlying
computation.

As Mathematicians (myself included) are rather "conservative", I need
to discuss each "chunk" of code with the full set of Mathematical
notation.

A couple of years ago I started using ConTeXt-MKIV as a
Mathematically-Literate-Programming tool by using its excellent Lua
interface to capture the code and dump it to disk for external
compilation.

I am now revisiting my original design and want to redo my tools using
ConTeXt-LMTX.

I would *like* to be able to "stop" the ConTeXt typesetting at various
points for differing purposes:

1. After all macro expansions (and hence after *my* calls into Lua)
   but before line/paragraph/page layout begins.

2. After line/paragraph/page layout but before PDF generation.

3. After all PDF generated (ie. a "normal" "full" ConTeXt run).

Stopping after all macro expansions would allow my code generation
builds to proceed without the un-needed page setting or PDF generation.

Stopping after the line/paragraph/page layout would allow multiple
"faster(?)" ConTeXt runs while the "*.tuc" file converges to a complete
set of page numbers and cross references (etc). Then, once the "*.tuc"
file has converged, a full ConTeXt run with PDF output could be
done.

I am very aware that *internally* ConTeXt is probably structured as a
tight pipeline with each of the "traditional" TeX stages "Mouth",
"Stomach", "page setting", PDF generation.... tightly "chained"...
This means that there is no "one" place in the code where all macro
expansions have completed but before the page setting "starts", or
similarly, after the page setting has finished but before the PDF
generation "starts".

----
QUESTION: Is it possible to use the new LuaMetaTeX callbacks (found in
chapter 10 of the "LuaMetaTEX Reference Manual") to "suppress" any
further computation at various points in the ConTeXt pipeline?
----

For example, could I use one of the "*_linebreak_filter"s (or the
"append_to_vlist_filter") to "return" an empty value and hence reduce
further computation downstream in the pipeline?

Could I use the "pre_output_filter" to "return" an empty value and
hence "stop" PDF generation?

(I realize that these callbacks *are* a currently fast moving target. I
am happy to follow their changes, equally I would be testing their
usefulness and/or impact)

----
ALTERNATIVE QUESTION: Would it be possible to provide official
ConTeXt-LMTX "modes" which suppress further computation at these points?
----

This alternative, while some more work for the writing of
ConTeXt-LMTX, would ensure less direct external dependence on the
LuaMetaTeX callbacks, but would almost certainly be welcomed by the
ConTeXt community.

----
QUESTION: Are the "stages" I have identified major, computationally
expensive, "steps" in the overall ConTeXt "computation"?
----

Many thanks for an excellent tool!

Regards,

Stephen Gaito
___________________________________________________________________________________
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
___________________________________________________________________________________

             reply	other threads:[~2020-11-30  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  9:51 Stephen Gaito [this message]
2020-11-30 18:59 ` Hans Hagen
2020-12-02  9:40   ` Stephen Gaito
2020-12-02 13:04     ` Hans Hagen
2020-12-03 10:35       ` Stephen Gaito
2020-12-03 11:15         ` Taco Hoekwater
2020-12-03 12:15           ` Hans Hagen
2020-12-03 17:08             ` Stephen Gaito
2020-12-03 16:53           ` Stephen Gaito

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=20201130095134.5149207e@nn01 \
    --to=stephen@perceptisys.co.uk \
    --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).