Bug in Lualatex: not printing characters from calculationLuaLaTeX pass characters without “ ” to luaProblem printing LaTeX from lua in lualatexSymbol not found error when using Lua C .so module with LuaLaTeXnon-printing characters in the OpenType layout of LuaLaTeXLuaLaTeX output from tex.print not interpretedcsquotes conflicts with quotation marks in Lua codeHow shall I launch from lualatex a lua program contained in a lua variable?Load fields from JSON file using LuaLatexHow to use lua code from external file in lualatex?Lualatex function producing trailing characters
From the start of the game what is the longest possible series of consecutive white moves where white can do those moves no matter what black does?
Idioms: Should it be " the internet is a seemingly infinite well of information" or "the internet is a seemingly infinite wealth of information"
Other than a swing wing, what types of variable geometry have flown?
What is the spanish equivalent of "the boys are sitting"?
Can a character with a low Intelligence score take the Ritual Caster feat and choose the Wizard class?
Is it okay to paraphrase other authors' literature reviews?
The seven story archetypes. Are they truly all of them?
What is "ass door"?
How to repair basic cable/wire issue for household appliances
Impact of throwing away fruit waste on a peak > 3200 m above a glacier
Is the apartment I want to rent a scam?
Are symplectomorphisms of Weil–Petersson symplectic form induced from surface diffeomorphisms?
Why is chess failing to attract big name sponsors?
Travelling from Venice to Budapest, making a stop in Croatia
ExactlyOne extension method
Short story about a group of sci-fi writers sitting around discussing their profession
Monty Hall Problem with a Fallible Monty
What Is the Meaning of "you has the wind of me"?
What kind of world would drive brains to evolve high-throughput sensory?
What happens when two cards both modify what I'm allowed to do?
What's the explanation for this joke about a three-legged dog that walks into a bar?
What would be the side effects on the life of a person becoming indestructible?
Why must API keys be kept private?
Short story where a flexible reality hardens to an unchanging one
Bug in Lualatex: not printing characters from calculation
LuaLaTeX pass characters without “ ” to luaProblem printing LaTeX from lua in lualatexSymbol not found error when using Lua C .so module with LuaLaTeXnon-printing characters in the OpenType layout of LuaLaTeXLuaLaTeX output from tex.print not interpretedcsquotes conflicts with quotation marks in Lua codeHow shall I launch from lualatex a lua program contained in a lua variable?Load fields from JSON file using LuaLatexHow to use lua code from external file in lualatex?Lualatex function producing trailing characters
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have the following code
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(matrix.det(cmatrix(m)))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
Here I am using matrix.lua and complex.lua from the following links.
https://github.com/davidm/lua-matrix/blob/master/lua/matrix.lua
https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua
The expected answer is -3-24i. However it gives the answer -3-24. The character i is not printed. This works well in lua itself. But it seems to be a bug in lualatex. How can it be over come? Any help will be appreciated.
luatex matrices lua luacode directlua
add a comment |
I have the following code
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(matrix.det(cmatrix(m)))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
Here I am using matrix.lua and complex.lua from the following links.
https://github.com/davidm/lua-matrix/blob/master/lua/matrix.lua
https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua
The expected answer is -3-24i. However it gives the answer -3-24. The character i is not printed. This works well in lua itself. But it seems to be a bug in lualatex. How can it be over come? Any help will be appreciated.
luatex matrices lua luacode directlua
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
8 hours ago
Rather than a bug in LuaTeX, I'd suspect a bug incomplex.luafirst.
– egreg
8 hours ago
add a comment |
I have the following code
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(matrix.det(cmatrix(m)))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
Here I am using matrix.lua and complex.lua from the following links.
https://github.com/davidm/lua-matrix/blob/master/lua/matrix.lua
https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua
The expected answer is -3-24i. However it gives the answer -3-24. The character i is not printed. This works well in lua itself. But it seems to be a bug in lualatex. How can it be over come? Any help will be appreciated.
luatex matrices lua luacode directlua
I have the following code
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(matrix.det(cmatrix(m)))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
Here I am using matrix.lua and complex.lua from the following links.
https://github.com/davidm/lua-matrix/blob/master/lua/matrix.lua
https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua
The expected answer is -3-24i. However it gives the answer -3-24. The character i is not printed. This works well in lua itself. But it seems to be a bug in lualatex. How can it be over come? Any help will be appreciated.
luatex matrices lua luacode directlua
luatex matrices lua luacode directlua
asked 8 hours ago
user61681user61681
4162 silver badges11 bronze badges
4162 silver badges11 bronze badges
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
8 hours ago
Rather than a bug in LuaTeX, I'd suspect a bug incomplex.luafirst.
– egreg
8 hours ago
add a comment |
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
8 hours ago
Rather than a bug in LuaTeX, I'd suspect a bug incomplex.luafirst.
– egreg
8 hours ago
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
8 hours ago
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
8 hours ago
Rather than a bug in LuaTeX, I'd suspect a bug in
complex.lua first.– egreg
8 hours ago
Rather than a bug in LuaTeX, I'd suspect a bug in
complex.lua first.– egreg
8 hours ago
add a comment |
2 Answers
2
active
oldest
votes
There seems to be an issue in how tex.sprint interprets complex numbers. As a solution, you can convert it to a string before printing:
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(tostring(matrix.det(cmatrix(m))))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
1
Thanks for fast and correct explanation.
– user61681
8 hours ago
add a comment |
Unlike the Lua print function, which implicitly applies tostringto its argument, tex.sprint is defined to print each entry of a table separately if its argument is a table. The complex number is a two item table with the real and imaginary part with a custom tostring function that adds the i.
So print(matrix.det(cmatrix(m))) invokes tostring and prints -3-24i but tex.sprint applies the normal numeric tostring to each element of the table separately so prints -3 then -24. If you explicitly apply tostring before calling tex.sprint then the function specified for the complex number table will be used, resulting in "-3-24i" again.
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%2f501273%2fbug-in-lualatex-not-printing-characters-from-calculation%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
There seems to be an issue in how tex.sprint interprets complex numbers. As a solution, you can convert it to a string before printing:
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(tostring(matrix.det(cmatrix(m))))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
1
Thanks for fast and correct explanation.
– user61681
8 hours ago
add a comment |
There seems to be an issue in how tex.sprint interprets complex numbers. As a solution, you can convert it to a string before printing:
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(tostring(matrix.det(cmatrix(m))))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
1
Thanks for fast and correct explanation.
– user61681
8 hours ago
add a comment |
There seems to be an issue in how tex.sprint interprets complex numbers. As a solution, you can convert it to a string before printing:
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(tostring(matrix.det(cmatrix(m))))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
There seems to be an issue in how tex.sprint interprets complex numbers. As a solution, you can convert it to a string before printing:
documentclassarticle
usepackageluacode
begindocument
beginluacode*
local matrix = require "matrix"
local complex = require "complex"
function cmatrix(n)
return matrix(n):replace(complex)
end
function det(m)
tex.sprint(tostring(matrix.det(cmatrix(m))))
end
endluacode*
newcommandmatrixdet[1]directluadet(#1)
matrixdet1,2,3,4,5,6,"7+8i",8,10
enddocument
answered 8 hours ago
MarijnMarijn
11k1 gold badge6 silver badges40 bronze badges
11k1 gold badge6 silver badges40 bronze badges
1
Thanks for fast and correct explanation.
– user61681
8 hours ago
add a comment |
1
Thanks for fast and correct explanation.
– user61681
8 hours ago
1
1
Thanks for fast and correct explanation.
– user61681
8 hours ago
Thanks for fast and correct explanation.
– user61681
8 hours ago
add a comment |
Unlike the Lua print function, which implicitly applies tostringto its argument, tex.sprint is defined to print each entry of a table separately if its argument is a table. The complex number is a two item table with the real and imaginary part with a custom tostring function that adds the i.
So print(matrix.det(cmatrix(m))) invokes tostring and prints -3-24i but tex.sprint applies the normal numeric tostring to each element of the table separately so prints -3 then -24. If you explicitly apply tostring before calling tex.sprint then the function specified for the complex number table will be used, resulting in "-3-24i" again.
add a comment |
Unlike the Lua print function, which implicitly applies tostringto its argument, tex.sprint is defined to print each entry of a table separately if its argument is a table. The complex number is a two item table with the real and imaginary part with a custom tostring function that adds the i.
So print(matrix.det(cmatrix(m))) invokes tostring and prints -3-24i but tex.sprint applies the normal numeric tostring to each element of the table separately so prints -3 then -24. If you explicitly apply tostring before calling tex.sprint then the function specified for the complex number table will be used, resulting in "-3-24i" again.
add a comment |
Unlike the Lua print function, which implicitly applies tostringto its argument, tex.sprint is defined to print each entry of a table separately if its argument is a table. The complex number is a two item table with the real and imaginary part with a custom tostring function that adds the i.
So print(matrix.det(cmatrix(m))) invokes tostring and prints -3-24i but tex.sprint applies the normal numeric tostring to each element of the table separately so prints -3 then -24. If you explicitly apply tostring before calling tex.sprint then the function specified for the complex number table will be used, resulting in "-3-24i" again.
Unlike the Lua print function, which implicitly applies tostringto its argument, tex.sprint is defined to print each entry of a table separately if its argument is a table. The complex number is a two item table with the real and imaginary part with a custom tostring function that adds the i.
So print(matrix.det(cmatrix(m))) invokes tostring and prints -3-24i but tex.sprint applies the normal numeric tostring to each element of the table separately so prints -3 then -24. If you explicitly apply tostring before calling tex.sprint then the function specified for the complex number table will be used, resulting in "-3-24i" again.
answered 6 hours ago
David CarlisleDavid Carlisle
516k44 gold badges1172 silver badges1941 bronze badges
516k44 gold badges1172 silver badges1941 bronze badges
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%2f501273%2fbug-in-lualatex-not-printing-characters-from-calculation%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
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
8 hours ago
Rather than a bug in LuaTeX, I'd suspect a bug in
complex.luafirst.– egreg
8 hours ago