What callback to use,to catch all nodes in any document and how to print something in any part of document in...
Tell me please,what callback or callbacks better to use,to catch all nodes, which are contained in some document. Also help me please, does it really print something,for example, in the second line of the document or any other line, because tex.print prints something in the document immediately, but I want to print something in any specified place in the document?
Thanks everybody for the help.
luatex
|
show 6 more comments
Tell me please,what callback or callbacks better to use,to catch all nodes, which are contained in some document. Also help me please, does it really print something,for example, in the second line of the document or any other line, because tex.print prints something in the document immediately, but I want to print something in any specified place in the document?
Thanks everybody for the help.
luatex
5
your question is very unclear and asks about several unrelated things. You can for example use thepost_linebreak_filtercallback which will give you the nodes of each paragraph after it has been broken into lines, before they are added to the vertical list. Buttex.printacts at a completely different level returning characters from a lua string that are then tokenized by tex as if they came from an input file., tex does not track "output lines" in the document (it isn't clear what that really means) so it is hard to answer the part about "second line of a document"
– David Carlisle
Mar 26 at 14:08
@David Carlisle About post_line_break filter i tryed it and it seems,what not all nodes of document shows for me. I want to get all nodes,that lualatex find in my document. About printing i mean,for example,when i use callback process_input_buffer and analize some string of document,i want also analize previous lines and to add something not in this line,but,for example,exectly after line begin{document} or exectly before end{document}. Is it possible to do it? Thanks everybody for the help.
– Aleksandr Kozlovskiy
Mar 26 at 16:43
1
@AleksandrKozlovskiy Getting all nodes using callbacks is not that easy, especially since there are primitives likehpackwhich are built to circumvent callbacks. Also you have to decide of nodes introduced by the output routine (header/footer/page number/etc) should be handled too. If you need them, you can use the everyshi package to calldirectluadirectly before shipout, then just analyze the box. There are no callbacks involved then.
– Marcel Krüger
Mar 26 at 17:55
@AleksandrKozlovskiy there is never a time when "all nodes in the document" exist, nodes are created as needed but destroyed as each page is shipped out to the pdf back end, so you need to trap nodes as they are created in a suitable callback (or inspect the shipout box), the one i mentioned catches line breaking but would not catch vertical material that is directly added to the vertical list. you can of course detect in the input_buffer callback if the line contains the textbegin{document}but that is unrelated to node processing so it is hard to see how to answer about both
– David Carlisle
Mar 26 at 19:51
Yes,it different questions,but i have this two questions,so i desided ask this questions in one topic. But how i can print something,for example,after begin{document},if line,which i see,is not begin{document} or it's impossible in lualatex?
– Aleksandr Kozlovskiy
Mar 26 at 20:11
|
show 6 more comments
Tell me please,what callback or callbacks better to use,to catch all nodes, which are contained in some document. Also help me please, does it really print something,for example, in the second line of the document or any other line, because tex.print prints something in the document immediately, but I want to print something in any specified place in the document?
Thanks everybody for the help.
luatex
Tell me please,what callback or callbacks better to use,to catch all nodes, which are contained in some document. Also help me please, does it really print something,for example, in the second line of the document or any other line, because tex.print prints something in the document immediately, but I want to print something in any specified place in the document?
Thanks everybody for the help.
luatex
luatex
edited Mar 26 at 14:12
David Carlisle
497k4111441891
497k4111441891
asked Mar 26 at 13:56
Aleksandr KozlovskiyAleksandr Kozlovskiy
463
463
5
your question is very unclear and asks about several unrelated things. You can for example use thepost_linebreak_filtercallback which will give you the nodes of each paragraph after it has been broken into lines, before they are added to the vertical list. Buttex.printacts at a completely different level returning characters from a lua string that are then tokenized by tex as if they came from an input file., tex does not track "output lines" in the document (it isn't clear what that really means) so it is hard to answer the part about "second line of a document"
– David Carlisle
Mar 26 at 14:08
@David Carlisle About post_line_break filter i tryed it and it seems,what not all nodes of document shows for me. I want to get all nodes,that lualatex find in my document. About printing i mean,for example,when i use callback process_input_buffer and analize some string of document,i want also analize previous lines and to add something not in this line,but,for example,exectly after line begin{document} or exectly before end{document}. Is it possible to do it? Thanks everybody for the help.
– Aleksandr Kozlovskiy
Mar 26 at 16:43
1
@AleksandrKozlovskiy Getting all nodes using callbacks is not that easy, especially since there are primitives likehpackwhich are built to circumvent callbacks. Also you have to decide of nodes introduced by the output routine (header/footer/page number/etc) should be handled too. If you need them, you can use the everyshi package to calldirectluadirectly before shipout, then just analyze the box. There are no callbacks involved then.
– Marcel Krüger
Mar 26 at 17:55
@AleksandrKozlovskiy there is never a time when "all nodes in the document" exist, nodes are created as needed but destroyed as each page is shipped out to the pdf back end, so you need to trap nodes as they are created in a suitable callback (or inspect the shipout box), the one i mentioned catches line breaking but would not catch vertical material that is directly added to the vertical list. you can of course detect in the input_buffer callback if the line contains the textbegin{document}but that is unrelated to node processing so it is hard to see how to answer about both
– David Carlisle
Mar 26 at 19:51
Yes,it different questions,but i have this two questions,so i desided ask this questions in one topic. But how i can print something,for example,after begin{document},if line,which i see,is not begin{document} or it's impossible in lualatex?
– Aleksandr Kozlovskiy
Mar 26 at 20:11
|
show 6 more comments
5
your question is very unclear and asks about several unrelated things. You can for example use thepost_linebreak_filtercallback which will give you the nodes of each paragraph after it has been broken into lines, before they are added to the vertical list. Buttex.printacts at a completely different level returning characters from a lua string that are then tokenized by tex as if they came from an input file., tex does not track "output lines" in the document (it isn't clear what that really means) so it is hard to answer the part about "second line of a document"
– David Carlisle
Mar 26 at 14:08
@David Carlisle About post_line_break filter i tryed it and it seems,what not all nodes of document shows for me. I want to get all nodes,that lualatex find in my document. About printing i mean,for example,when i use callback process_input_buffer and analize some string of document,i want also analize previous lines and to add something not in this line,but,for example,exectly after line begin{document} or exectly before end{document}. Is it possible to do it? Thanks everybody for the help.
– Aleksandr Kozlovskiy
Mar 26 at 16:43
1
@AleksandrKozlovskiy Getting all nodes using callbacks is not that easy, especially since there are primitives likehpackwhich are built to circumvent callbacks. Also you have to decide of nodes introduced by the output routine (header/footer/page number/etc) should be handled too. If you need them, you can use the everyshi package to calldirectluadirectly before shipout, then just analyze the box. There are no callbacks involved then.
– Marcel Krüger
Mar 26 at 17:55
@AleksandrKozlovskiy there is never a time when "all nodes in the document" exist, nodes are created as needed but destroyed as each page is shipped out to the pdf back end, so you need to trap nodes as they are created in a suitable callback (or inspect the shipout box), the one i mentioned catches line breaking but would not catch vertical material that is directly added to the vertical list. you can of course detect in the input_buffer callback if the line contains the textbegin{document}but that is unrelated to node processing so it is hard to see how to answer about both
– David Carlisle
Mar 26 at 19:51
Yes,it different questions,but i have this two questions,so i desided ask this questions in one topic. But how i can print something,for example,after begin{document},if line,which i see,is not begin{document} or it's impossible in lualatex?
– Aleksandr Kozlovskiy
Mar 26 at 20:11
5
5
your question is very unclear and asks about several unrelated things. You can for example use the
post_linebreak_filter callback which will give you the nodes of each paragraph after it has been broken into lines, before they are added to the vertical list. But tex.print acts at a completely different level returning characters from a lua string that are then tokenized by tex as if they came from an input file., tex does not track "output lines" in the document (it isn't clear what that really means) so it is hard to answer the part about "second line of a document"– David Carlisle
Mar 26 at 14:08
your question is very unclear and asks about several unrelated things. You can for example use the
post_linebreak_filter callback which will give you the nodes of each paragraph after it has been broken into lines, before they are added to the vertical list. But tex.print acts at a completely different level returning characters from a lua string that are then tokenized by tex as if they came from an input file., tex does not track "output lines" in the document (it isn't clear what that really means) so it is hard to answer the part about "second line of a document"– David Carlisle
Mar 26 at 14:08
@David Carlisle About post_line_break filter i tryed it and it seems,what not all nodes of document shows for me. I want to get all nodes,that lualatex find in my document. About printing i mean,for example,when i use callback process_input_buffer and analize some string of document,i want also analize previous lines and to add something not in this line,but,for example,exectly after line begin{document} or exectly before end{document}. Is it possible to do it? Thanks everybody for the help.
– Aleksandr Kozlovskiy
Mar 26 at 16:43
@David Carlisle About post_line_break filter i tryed it and it seems,what not all nodes of document shows for me. I want to get all nodes,that lualatex find in my document. About printing i mean,for example,when i use callback process_input_buffer and analize some string of document,i want also analize previous lines and to add something not in this line,but,for example,exectly after line begin{document} or exectly before end{document}. Is it possible to do it? Thanks everybody for the help.
– Aleksandr Kozlovskiy
Mar 26 at 16:43
1
1
@AleksandrKozlovskiy Getting all nodes using callbacks is not that easy, especially since there are primitives like
hpack which are built to circumvent callbacks. Also you have to decide of nodes introduced by the output routine (header/footer/page number/etc) should be handled too. If you need them, you can use the everyshi package to call directlua directly before shipout, then just analyze the box. There are no callbacks involved then.– Marcel Krüger
Mar 26 at 17:55
@AleksandrKozlovskiy Getting all nodes using callbacks is not that easy, especially since there are primitives like
hpack which are built to circumvent callbacks. Also you have to decide of nodes introduced by the output routine (header/footer/page number/etc) should be handled too. If you need them, you can use the everyshi package to call directlua directly before shipout, then just analyze the box. There are no callbacks involved then.– Marcel Krüger
Mar 26 at 17:55
@AleksandrKozlovskiy there is never a time when "all nodes in the document" exist, nodes are created as needed but destroyed as each page is shipped out to the pdf back end, so you need to trap nodes as they are created in a suitable callback (or inspect the shipout box), the one i mentioned catches line breaking but would not catch vertical material that is directly added to the vertical list. you can of course detect in the input_buffer callback if the line contains the text
begin{document} but that is unrelated to node processing so it is hard to see how to answer about both– David Carlisle
Mar 26 at 19:51
@AleksandrKozlovskiy there is never a time when "all nodes in the document" exist, nodes are created as needed but destroyed as each page is shipped out to the pdf back end, so you need to trap nodes as they are created in a suitable callback (or inspect the shipout box), the one i mentioned catches line breaking but would not catch vertical material that is directly added to the vertical list. you can of course detect in the input_buffer callback if the line contains the text
begin{document} but that is unrelated to node processing so it is hard to see how to answer about both– David Carlisle
Mar 26 at 19:51
Yes,it different questions,but i have this two questions,so i desided ask this questions in one topic. But how i can print something,for example,after begin{document},if line,which i see,is not begin{document} or it's impossible in lualatex?
– Aleksandr Kozlovskiy
Mar 26 at 20:11
Yes,it different questions,but i have this two questions,so i desided ask this questions in one topic. But how i can print something,for example,after begin{document},if line,which i see,is not begin{document} or it's impossible in lualatex?
– Aleksandr Kozlovskiy
Mar 26 at 20:11
|
show 6 more comments
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481528%2fwhat-callback-to-use-to-catch-all-nodes-in-any-document-and-how-to-print-somethi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481528%2fwhat-callback-to-use-to-catch-all-nodes-in-any-document-and-how-to-print-somethi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
5
your question is very unclear and asks about several unrelated things. You can for example use the
post_linebreak_filtercallback which will give you the nodes of each paragraph after it has been broken into lines, before they are added to the vertical list. Buttex.printacts at a completely different level returning characters from a lua string that are then tokenized by tex as if they came from an input file., tex does not track "output lines" in the document (it isn't clear what that really means) so it is hard to answer the part about "second line of a document"– David Carlisle
Mar 26 at 14:08
@David Carlisle About post_line_break filter i tryed it and it seems,what not all nodes of document shows for me. I want to get all nodes,that lualatex find in my document. About printing i mean,for example,when i use callback process_input_buffer and analize some string of document,i want also analize previous lines and to add something not in this line,but,for example,exectly after line begin{document} or exectly before end{document}. Is it possible to do it? Thanks everybody for the help.
– Aleksandr Kozlovskiy
Mar 26 at 16:43
1
@AleksandrKozlovskiy Getting all nodes using callbacks is not that easy, especially since there are primitives like
hpackwhich are built to circumvent callbacks. Also you have to decide of nodes introduced by the output routine (header/footer/page number/etc) should be handled too. If you need them, you can use the everyshi package to calldirectluadirectly before shipout, then just analyze the box. There are no callbacks involved then.– Marcel Krüger
Mar 26 at 17:55
@AleksandrKozlovskiy there is never a time when "all nodes in the document" exist, nodes are created as needed but destroyed as each page is shipped out to the pdf back end, so you need to trap nodes as they are created in a suitable callback (or inspect the shipout box), the one i mentioned catches line breaking but would not catch vertical material that is directly added to the vertical list. you can of course detect in the input_buffer callback if the line contains the text
begin{document}but that is unrelated to node processing so it is hard to see how to answer about both– David Carlisle
Mar 26 at 19:51
Yes,it different questions,but i have this two questions,so i desided ask this questions in one topic. But how i can print something,for example,after begin{document},if line,which i see,is not begin{document} or it's impossible in lualatex?
– Aleksandr Kozlovskiy
Mar 26 at 20:11