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
Subtle ways to render a planet uninhabitable
Who's behind community AMIs on Amazon EC2?
What is Albrecht Dürer's Perspective Machine drawing style?
Does proof-of-work contribute directly to prevent double-spending?
Why wasn't interlaced CRT scanning done back and forth?
Does WSL2 runs Linux in a virtual machine or alongside windows Kernel?
How to transform a function from f[#1] to f[x]
HackerRank Implement Queue using two stacks Solution
On the expression "sun-down"
Why does Shift-right says it is bound to right?
Is there a word that describes people who are extraverted and/or energetic, but uneducated, unintelligent and/or uncreative?
How long should I wait to plug in my refrigerator after unplugging it?
Difference between "jail" and "prison" in German
Lower bound for the number of lattice points on high dimensional spheres
Why adjustbox needs a tweak of raise=-0.3ex with enumitem?
Being told my "network" isn't PCI compliant. I don't even have a server! Do I have to comply?
What license to choose for my PhD thesis?
Phase portrait of a system of differential equations
What is the reason behind water not falling from a bucket at the top of loop?
Why isn't the new LEGO CV joint available on Bricklink or Brickowl?
Want to manipulate and visualize differential equation of a falling object
Can an unintentional murderer leave Ir Miklat for Shalosh Regalim?
What is it exactly about flying a Flyboard across the English channel that made Zapata's thighs burn?
Basic CPA walkthrough
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
Jul 24 at 14:26
Rather than a bug in LuaTeX, I'd suspect a bug incomplex.lua
first.
– egreg
Jul 24 at 14:27
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 Jul 24 at 14:14
user61681user61681
5092 silver badges12 bronze badges
5092 silver badges12 bronze badges
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
Jul 24 at 14:26
Rather than a bug in LuaTeX, I'd suspect a bug incomplex.lua
first.
– egreg
Jul 24 at 14:27
add a comment |
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
Jul 24 at 14:26
Rather than a bug in LuaTeX, I'd suspect a bug incomplex.lua
first.
– egreg
Jul 24 at 14:27
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
Jul 24 at 14:26
copy matrix.lua and complex.lua from the given links to the working folder. Then compile with lualatex.
– user61681
Jul 24 at 14:26
Rather than a bug in LuaTeX, I'd suspect a bug in
complex.lua
first.– egreg
Jul 24 at 14:27
Rather than a bug in LuaTeX, I'd suspect a bug in
complex.lua
first.– egreg
Jul 24 at 14:27
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
Jul 24 at 14:30
add a comment |
Unlike the Lua print
function, which implicitly applies tostring
to 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
Jul 24 at 14:30
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
Jul 24 at 14:30
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 Jul 24 at 14:28
MarijnMarijn
11.2k1 gold badge6 silver badges40 bronze badges
11.2k1 gold badge6 silver badges40 bronze badges
1
Thanks for fast and correct explanation.
– user61681
Jul 24 at 14:30
add a comment |
1
Thanks for fast and correct explanation.
– user61681
Jul 24 at 14:30
1
1
Thanks for fast and correct explanation.
– user61681
Jul 24 at 14:30
Thanks for fast and correct explanation.
– user61681
Jul 24 at 14:30
add a comment |
Unlike the Lua print
function, which implicitly applies tostring
to 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 tostring
to 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 tostring
to 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 tostring
to 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 Jul 24 at 16:30
David CarlisleDavid Carlisle
518k44 gold badges1173 silver badges1943 bronze badges
518k44 gold badges1173 silver badges1943 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
Jul 24 at 14:26
Rather than a bug in LuaTeX, I'd suspect a bug in
complex.lua
first.– egreg
Jul 24 at 14:27