Error during using callback start_page_number in lualatexHeaders and Footersprocess_input_buffer callback in LuaTeXCompilation error with LuaLaTeXCompilation error with LuaLaTeX (texnansi.enc)Using LuaLaTeX and SQLite3Using pdfx with LuaLaTeX results in errorError using pdfpages and lualatexscrlttr2 & lualatex: Missing number, treated as zeroTroubles switching from pdflatex to lualatexLuaTeX: matrix in equation trows “missing number, treaded as zero” ErrorExamples of luatex callback with lualatex
How to secure an aircraft at a transient parking space?
List elements digit difference sort
PTIJ: Should I kill my computer after installing software?
Error during using callback start_page_number in lualatex
Database Backup for data and log files
Child Theme Path Being Ignored With wp_enqueue_scripts
Shifting between bemols (flats) and diesis (sharps)in the key signature
How to detect if C code (which needs 'extern C') is compiled in C++
Declaring and defining template, and specialising them
Is "history" a male-biased word ("his+story")?
Reversed Sudoku
They call me Inspector Morse
What problems would a superhuman have whose skin is constantly hot?
Marriage green card at end of current visa with 2 Year residency requirement waiver in-process, question
At what distance can a bugbear, holding a reach weapon, with Polearm Mastery, get their Opportunity Attack?
Why does liquid water form when we exhale on a mirror?
Virginia employer terminated employee and wants signing bonus returned
Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?
Was Luke Skywalker the leader of the Rebel forces on Hoth?
Do f-stop and exposure time perfectly cancel?
Coax or bifilar choke
Motivation for Zeta Function of an Algebraic Variety
Examples of a statistic that is not independent of sample's distribution?
Are babies of evil humanoid species inherently evil?
Error during using callback start_page_number in lualatex
Headers and Footersprocess_input_buffer callback in LuaTeXCompilation error with LuaLaTeXCompilation error with LuaLaTeX (texnansi.enc)Using LuaLaTeX and SQLite3Using pdfx with LuaLaTeX results in errorError using pdfpages and lualatexscrlttr2 & lualatex: Missing number, treated as zeroTroubles switching from pdflatex to lualatexLuaTeX: matrix in equation trows “missing number, treaded as zero” ErrorExamples of luatex callback with lualatex
I updated miktex and all packages and now i have an error,when i try use callback start_page_number in my document. The error appeared even in very small document,for example in this document:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguage[babelshorthands=true]russian
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
When i compile it,i get errors:
C:/Users/ksash/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map] (./lua3.aux
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing = inserted for ifnum.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
__bool_p_0:
l.3 select@language russian
Help me please fix this errors (i use russian language,because i want to use it in documents,which contains cyrillic chars). Help me please fix this errors. Thanks everybody for the help.
luatex
add a comment |
I updated miktex and all packages and now i have an error,when i try use callback start_page_number in my document. The error appeared even in very small document,for example in this document:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguage[babelshorthands=true]russian
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
When i compile it,i get errors:
C:/Users/ksash/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map] (./lua3.aux
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing = inserted for ifnum.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
__bool_p_0:
l.3 select@language russian
Help me please fix this errors (i use russian language,because i want to use it in documents,which contains cyrillic chars). Help me please fix this errors. Thanks everybody for the help.
luatex
add a comment |
I updated miktex and all packages and now i have an error,when i try use callback start_page_number in my document. The error appeared even in very small document,for example in this document:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguage[babelshorthands=true]russian
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
When i compile it,i get errors:
C:/Users/ksash/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map] (./lua3.aux
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing = inserted for ifnum.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
__bool_p_0:
l.3 select@language russian
Help me please fix this errors (i use russian language,because i want to use it in documents,which contains cyrillic chars). Help me please fix this errors. Thanks everybody for the help.
luatex
I updated miktex and all packages and now i have an error,when i try use callback start_page_number in my document. The error appeared even in very small document,for example in this document:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguage[babelshorthands=true]russian
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
When i compile it,i get errors:
C:/Users/ksash/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map] (./lua3.aux
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing = inserted for ifnum.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
p
l.3 select@language russian
?
! Missing number, treated as zero.
<to be read again>
__bool_p_0:
l.3 select@language russian
Help me please fix this errors (i use russian language,because i want to use it in documents,which contains cyrillic chars). Help me please fix this errors. Thanks everybody for the help.
luatex
luatex
edited 5 hours ago
Ulrike Fischer
195k8302688
195k8302688
asked 5 hours ago
Aleksandr KozlovskiyAleksandr Kozlovskiy
361
361
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
start_page_number "replaces the code that prints the [ and the page number at the begin of shipout.". This code sends information to the terminal and the log. It doesn't make much sense to replace it by code that tries to write something in the document. With texio.write_nl e.g. it works fine:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguagerussian
usepackagefontspec
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
texio.write_nl("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
add a comment |
You are trying to use tex.print in a callback. That will almost never work in the way you expect.
To show the issue in this particular case, compile the following modification of your document:
documentclassarticle
usepackageluacode
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
clearpage
Xdirectluatex.print''X
enddocument
On the second page, this will print

What happened? After clearpage LuaTeX finished up the first page and called your callback. This added something to the Lua TeX output buffer and returned.
Now the next time directlua tries to print something, it will be added to the same buffer which will be sent to TeX after the evaluation of directlua.
So the text printed with tex.print during a callback is printed during a random following directlua use. In you example, polyglossia tries to use LuaTeX to access some number and was confused about page 1 being returned instead.
This demonstrates: Never use tex.print in a callback. The actual behaviour might also change with any update, to quote the manual: (referring to the whole tex.*print family of functions)
The result of using these functions from inside callbacks is undefined at the moment.
Now you could add tokens into the TeX input stream from a callback using the token.put_next interface, but this is very likely not what you are trying to do: It would insert the tokens at a basically random position because the callback is called when shipout is done, so they would probably end up in the code of the output routine. This routine does not expect random code insertions, so it will either result in another error or add the tokens to the main vertical list. In the last case, the page number would end up in some "random" location after the actual page it refers to because of the asynchronous nature of the TeX output routine.
So how to fix it depends on what you are trying to archive:
If you want to print something to the console, see Ulrike Fischer's answer.
If you want to print a page number in your TeX document or some other information in the page footer, see for example this question. LuaTeX callbacks operate on a much lower level.
add a comment |
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%2f478937%2ferror-during-using-callback-start-page-number-in-lualatex%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
start_page_number "replaces the code that prints the [ and the page number at the begin of shipout.". This code sends information to the terminal and the log. It doesn't make much sense to replace it by code that tries to write something in the document. With texio.write_nl e.g. it works fine:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguagerussian
usepackagefontspec
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
texio.write_nl("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
add a comment |
start_page_number "replaces the code that prints the [ and the page number at the begin of shipout.". This code sends information to the terminal and the log. It doesn't make much sense to replace it by code that tries to write something in the document. With texio.write_nl e.g. it works fine:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguagerussian
usepackagefontspec
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
texio.write_nl("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
add a comment |
start_page_number "replaces the code that prints the [ and the page number at the begin of shipout.". This code sends information to the terminal and the log. It doesn't make much sense to replace it by code that tries to write something in the document. With texio.write_nl e.g. it works fine:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguagerussian
usepackagefontspec
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
texio.write_nl("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
start_page_number "replaces the code that prints the [ and the page number at the begin of shipout.". This code sends information to the terminal and the log. It doesn't make much sense to replace it by code that tries to write something in the document. With texio.write_nl e.g. it works fine:
documentclassarticle
usepackageluacode
usepackagepolyglossia
setmainlanguagerussian
usepackagefontspec
setmainfontTimes New Roman
pagestyleempty
thispagestyleempty
beginluacode
function f0()
texio.write_nl("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
enddocument
answered 4 hours ago
Ulrike FischerUlrike Fischer
195k8302688
195k8302688
add a comment |
add a comment |
You are trying to use tex.print in a callback. That will almost never work in the way you expect.
To show the issue in this particular case, compile the following modification of your document:
documentclassarticle
usepackageluacode
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
clearpage
Xdirectluatex.print''X
enddocument
On the second page, this will print

What happened? After clearpage LuaTeX finished up the first page and called your callback. This added something to the Lua TeX output buffer and returned.
Now the next time directlua tries to print something, it will be added to the same buffer which will be sent to TeX after the evaluation of directlua.
So the text printed with tex.print during a callback is printed during a random following directlua use. In you example, polyglossia tries to use LuaTeX to access some number and was confused about page 1 being returned instead.
This demonstrates: Never use tex.print in a callback. The actual behaviour might also change with any update, to quote the manual: (referring to the whole tex.*print family of functions)
The result of using these functions from inside callbacks is undefined at the moment.
Now you could add tokens into the TeX input stream from a callback using the token.put_next interface, but this is very likely not what you are trying to do: It would insert the tokens at a basically random position because the callback is called when shipout is done, so they would probably end up in the code of the output routine. This routine does not expect random code insertions, so it will either result in another error or add the tokens to the main vertical list. In the last case, the page number would end up in some "random" location after the actual page it refers to because of the asynchronous nature of the TeX output routine.
So how to fix it depends on what you are trying to archive:
If you want to print something to the console, see Ulrike Fischer's answer.
If you want to print a page number in your TeX document or some other information in the page footer, see for example this question. LuaTeX callbacks operate on a much lower level.
add a comment |
You are trying to use tex.print in a callback. That will almost never work in the way you expect.
To show the issue in this particular case, compile the following modification of your document:
documentclassarticle
usepackageluacode
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
clearpage
Xdirectluatex.print''X
enddocument
On the second page, this will print

What happened? After clearpage LuaTeX finished up the first page and called your callback. This added something to the Lua TeX output buffer and returned.
Now the next time directlua tries to print something, it will be added to the same buffer which will be sent to TeX after the evaluation of directlua.
So the text printed with tex.print during a callback is printed during a random following directlua use. In you example, polyglossia tries to use LuaTeX to access some number and was confused about page 1 being returned instead.
This demonstrates: Never use tex.print in a callback. The actual behaviour might also change with any update, to quote the manual: (referring to the whole tex.*print family of functions)
The result of using these functions from inside callbacks is undefined at the moment.
Now you could add tokens into the TeX input stream from a callback using the token.put_next interface, but this is very likely not what you are trying to do: It would insert the tokens at a basically random position because the callback is called when shipout is done, so they would probably end up in the code of the output routine. This routine does not expect random code insertions, so it will either result in another error or add the tokens to the main vertical list. In the last case, the page number would end up in some "random" location after the actual page it refers to because of the asynchronous nature of the TeX output routine.
So how to fix it depends on what you are trying to archive:
If you want to print something to the console, see Ulrike Fischer's answer.
If you want to print a page number in your TeX document or some other information in the page footer, see for example this question. LuaTeX callbacks operate on a much lower level.
add a comment |
You are trying to use tex.print in a callback. That will almost never work in the way you expect.
To show the issue in this particular case, compile the following modification of your document:
documentclassarticle
usepackageluacode
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
clearpage
Xdirectluatex.print''X
enddocument
On the second page, this will print

What happened? After clearpage LuaTeX finished up the first page and called your callback. This added something to the Lua TeX output buffer and returned.
Now the next time directlua tries to print something, it will be added to the same buffer which will be sent to TeX after the evaluation of directlua.
So the text printed with tex.print during a callback is printed during a random following directlua use. In you example, polyglossia tries to use LuaTeX to access some number and was confused about page 1 being returned instead.
This demonstrates: Never use tex.print in a callback. The actual behaviour might also change with any update, to quote the manual: (referring to the whole tex.*print family of functions)
The result of using these functions from inside callbacks is undefined at the moment.
Now you could add tokens into the TeX input stream from a callback using the token.put_next interface, but this is very likely not what you are trying to do: It would insert the tokens at a basically random position because the callback is called when shipout is done, so they would probably end up in the code of the output routine. This routine does not expect random code insertions, so it will either result in another error or add the tokens to the main vertical list. In the last case, the page number would end up in some "random" location after the actual page it refers to because of the asynchronous nature of the TeX output routine.
So how to fix it depends on what you are trying to archive:
If you want to print something to the console, see Ulrike Fischer's answer.
If you want to print a page number in your TeX document or some other information in the page footer, see for example this question. LuaTeX callbacks operate on a much lower level.
You are trying to use tex.print in a callback. That will almost never work in the way you expect.
To show the issue in this particular case, compile the following modification of your document:
documentclassarticle
usepackageluacode
pagestyleempty
thispagestyleempty
beginluacode
function f0()
tex.print("page "..tex.count["c@page"])
end
luatexbase.add_to_callback("start_page_number",f0,"start")
endluacode
begindocument
test
clearpage
Xdirectluatex.print''X
enddocument
On the second page, this will print

What happened? After clearpage LuaTeX finished up the first page and called your callback. This added something to the Lua TeX output buffer and returned.
Now the next time directlua tries to print something, it will be added to the same buffer which will be sent to TeX after the evaluation of directlua.
So the text printed with tex.print during a callback is printed during a random following directlua use. In you example, polyglossia tries to use LuaTeX to access some number and was confused about page 1 being returned instead.
This demonstrates: Never use tex.print in a callback. The actual behaviour might also change with any update, to quote the manual: (referring to the whole tex.*print family of functions)
The result of using these functions from inside callbacks is undefined at the moment.
Now you could add tokens into the TeX input stream from a callback using the token.put_next interface, but this is very likely not what you are trying to do: It would insert the tokens at a basically random position because the callback is called when shipout is done, so they would probably end up in the code of the output routine. This routine does not expect random code insertions, so it will either result in another error or add the tokens to the main vertical list. In the last case, the page number would end up in some "random" location after the actual page it refers to because of the asynchronous nature of the TeX output routine.
So how to fix it depends on what you are trying to archive:
If you want to print something to the console, see Ulrike Fischer's answer.
If you want to print a page number in your TeX document or some other information in the page footer, see for example this question. LuaTeX callbacks operate on a much lower level.
edited 4 hours ago
answered 4 hours ago
Marcel KrügerMarcel Krüger
12.6k11636
12.6k11636
add a comment |
add a comment |
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%2f478937%2ferror-during-using-callback-start-page-number-in-lualatex%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
-luatex