Questions tagged [callback]
The callback tag has no summary.
23 questions
4
votes
2
answers
176
views
Unexpected behavior in luatexbase.add_to_callback
Using TeXlive 2025/Linux, up-to-date:
I expect that when I use luatexbase.add_to_callback then whatever is already in the callback should remain in effect, with my own code added. But apparently that ...
3
votes
1
answer
113
views
LuaLaTeX, nodes disappear between insert_after and insert_before
I tried to replace " with french quotes and add unbreakable spaces ("mot" to «~mot~»). Unfortunately I do not understand why the nodes between the two spaces disappear with the ...
3
votes
1
answer
91
views
different behaving of ligaturing callback with LaTeX
I am trying to reproduce the TeX following example (Paul Isambert, TUGboat,https://tug.org/TUGboat/tb32-1/tb100isambert.pdf):
\directlua{
local GLYF = node.id("glyph")
function show_nodes (...
1
vote
1
answer
156
views
How to measure the length of the last line? (LuaLaTeX)
I would like to make a command which, like some environments for equations, has a vertical space at the start of it which depends on whether the length of the line in the previous paragraph exceeds a ...
2
votes
1
answer
116
views
Callback replacement of active character
Using LuaLaTeX, TeXlive 2024, Linux.
EDIT: As David wrote, in the accepted answer, this does not require Lua callback. But I will leave the question, because other users may try to do something ...
3
votes
2
answers
323
views
Using lua callback to substitute some Arabic characters inserted within tex command
I have this example which replaces certain characters with specific ones, the substitution works fine on the entire input stream but fails on text inserted through a tex command.
Is there a way to ...
1
vote
0
answers
141
views
How to insert LaTeX commands through LuaLaTeX callbacks?
I would like to encourage LaTeX to break a line or page at the end of a sentence, after one of the following punctuation marks: "." ; "!" and "?".
I would like to put a ...
2
votes
1
answer
93
views
Why is `tex.sprint` deferred when handling `process_input_buffer`?
%!TEX program=lualatex
\documentclass{article}
\begin{document}
\def\specialRead{\directlua{
luatexbase.add_to_callback('process_input_buffer', function (line)
if line:find('^\\...
3
votes
1
answer
211
views
ConTeXt: What is the equivalent of process_input_buffer callback?
How can be LuaTeX callbacks used in ConTeXt? (with LuaTeX backend)
My main concern is the usage of process_input_buffer callback available in LuaTeX and LuaLaTeX. I am using it to altering the ...
0
votes
0
answers
29
views
LuaLateX callback for linebrea. use this within editor to represent line like in pdf [duplicate]
LuaLateX is able to run custom code and attach it to callback, in particular it
could discover line break, receiving a list of hlist that compose a line of text.
I'm not an expert at all, but I was ...
0
votes
1
answer
94
views
luatex nodelib color_stack does not apply to entire math equation
When I use post_linebreak_filter to change the color of hlists, some equations are only partially colored! Here's the image, and complete code of the example. As you can see below, the horizontal ...
1
vote
1
answer
378
views
luatex node library: iterate over whatsit save_pos to get the position of linebreaks
Marcel's answer resolved the original question. I have added followup questions from his answer under my original question. Followup questions begin with a similar block quote as this stating "...
1
vote
0
answers
267
views
Writing to custom ouput file with lualatex: Hook to start of the writing process and substitute not-fully expandable macros
I am working on writing document with informations, that are at the end of each part summarized in summary. To prevent writing them twice, I am using datatool to create "buffers" in runtime, from ...
10
votes
1
answer
216
views
marking end of words in luatex - problem with math
I'm trying to mark the end of "words" (including punctuation) with luatex callbacks. (At the end I want to inject space chars at this positions, but the example uses rules for the visualization).
...
1
vote
0
answers
174
views
Insert LaTeX code at line break (follow up)
This is a follow-up question to David Carlisle's answer here (Insert LaTeX code at line break).
In addition to glyph nodes, is there a way to insert (almost) arbitrary LaTeX commands with the help of ...