On 7/29/2025 8:58 AM, Max Chernoff via ntg-context wrote:
Unfortunately, I haven’t found a documentation on how to make your own
custom formats, hence this question.
This is a terrible idea, and you definitely should not recommend any of
your users to do this, but if you're just looking for a hack to speed up
your CI/testing, it is possible. The trick is to override one of
ConTeXt's core files (which is why this is a terrible idea).
"libs-ini.mkxl" is a good choice for this since it's loaded near the end
and isn't used by most documents.
So, make a file called "$TEXMFHOME/tex/context/third/libs-ini.mkxl" with
the following contents:
\directlua{function pdf.getcreationdate() end} % expl3 bug
\usemodule[expl3-generic]
and then you can run
$
TEXMFHOME='{/PATH/TO/TEXLIVE/texmf-dist/tex/latex-dev/,/PATH/TO/TEXMFHOME/}'
context --make
You need to put "latex-dev" into the search path since only the
prerelease expl3 versions currently work with ConTeXt. Again, I don't
recommend this since it is very likely that a future ConTeXt update will
break this, and building expl3 into the format might break core parts of
ConTeXt, but it's certainly possible.
a horror story indeed and that's why we also warn users on the console:
warning > latex expl stuff code loaded, beware of side effects
warning > latex unicode data code loaded, it makes no sense at all
warning > latex backend code code loaded, this can badly interfere
as you love hacking to the level of dangerous, here is an example of
where all this stuff is getting weird
\startluacode
local t = tex.hashtokens()
local l = { }
for i=1,#t do
if string.find(t[i],"mmm") then
l[#l+1] = t[i]
end
end
io.savedata("hash.txt",table.concat(l,"\n"))
\stopluacode
i know there is this "\romannumeral" fetish among some latex code
writers (as i remember talks at tex meetings in the past) but this is
where it really backfires; just a serialized number would be ok i guess:
here it bloats string space, slows down csname lookups due to
detokenization and such etc .. probably never used anyway but still ...
and the whole unicode loading stuff that actually is a reason for load
time is also sub optimal (from what i can see but i don't want to waste
time on that as i can't really read expl3); fwiw, i once was in a mail
exchange wrt loading that huge tounicode mapping thing in latex (side
track of identifiying potential glyph names etc) and seconds load time
could be brough back to nearly nothing by just coding a bit better
but let's not enter a coding discussion here
No one would ever write a ConTeXt-native module using expl3, but if
you're using it for a LaTeX package anyways, then the ConTeXt support
comes for "free" (from the developers side; you'll still pay for it in a
much slower runtime).
but that time penalty is then known anc accepted by the user, as logn as
we don't get blamed for it (but as you mentioned, one should be aware of
side effects, unicode, backend, color, whatever)
It's a generic programming layer for TeX, much like pgfkeys/pgfmath (the
non-graphics parts of TikZ). It was originally designed for LaTeX, but
its authors have put quite a bit of effort into making sure that it's
usable in all formats, including ConTeXt.
ok, but then why load way more than a the basic layer (which probably
already has enough potential issues, take register management and such
but that can be dealt with i guess)
Hans
(we already have some protection kicking in but as you now start
educating low level hacking/overload i need to protect even that i guess)
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________