Questions tagged [lua]
Lua is a powerful, fast, lightweight, embeddable scripting language.
436 questions
5
votes
2
answers
70
views
Graph of f and f' with luacas package
Recently I have discovered the interesting package named luacas (compilable with LuaLaTeX). To pag. 14 of the manual
https://ctan.mirror.garr.it/mirrors/ctan/macros/luatex/latex/luacas/doc/luacas.pdf
...
10
votes
1
answer
106
views
What would be the expl3 equivalent of \setbox0... + (Lua) box[0]
This question is a followup of a previous question of mine that David kindly answered with the following example:
\documentclass{article}
\usepackage{csquotes}
\def\test#1{%
\setbox0\hbox{#1}%
\...
3
votes
1
answer
111
views
Prevent `babel` from interfering with Lua code?
The following MCE works as expected.
\documentclass{article}
% \usepackage{babel}
% \shorthandoff*{~}
\begin{document}
\directlua{
local n=0
if n~=42 then tex.print("Foo") else tex.print(...
1
vote
0
answers
38
views
A revisitation of 3D surface outlines, using more specific language
This question has technically been asked before: Creating outlines of 3D surfaces in Tikz. Frankly, here too: Surface outline – pgfplots 3D.
I have thought about the problem in some detail, and ...
11
votes
2
answers
237
views
How can I calculate or approximate the intersection(s) or lack thereof of a line and an exponential curve using Lua?
How can I calculate or approximate the intersection(s) or lack thereof of a line and an exponential curve.
My goal is to avoid using an approach which first tessellates curves into line segments, and ...
3
votes
1
answer
79
views
Setting an OpenType MATH kern for a particular stylistic set glyph
How do I add a math kern for a particular glyph belonging to a particular stylistic set in an OpenType MATH font?
As shown here, one adds the kern to a particular Unicode slot---[0x211D] in this case. ...
4
votes
1
answer
116
views
Top right math kern value not being used with \directlua code (bug?)
I want to add a topright math kern (aka cut-in or staircase kerning) to DOUBLE-STRUCK CAPITAL R (Hex value: 0x211D, Code point: U+211D). I tried the method as shown in this answer of mickep, but it ...
4
votes
1
answer
82
views
How can I map TFM data for a type1 font in LuaLaTeX (probably using luaotfload.patch_font_unsafe) when the font encoding has unused slots?
This code is derived from code by Max Chernoff, but the mangling is entirely my responsibility.
Aim: to add tounicode mappings to the characters in uzdr.pfb (URW's clone of Zapf Dingbats) when ...
2
votes
1
answer
141
views
Is it a good idea to create a Lua "class" with C++ style constructor and (function) pointers in LuaLaTeX?
Background
Consider the following: One has several LuaLaTeX packages, which provide similar, but case specific functionality. Consequently, they have slightly different internal logic and require ...
4
votes
0
answers
96
views
What is the correct way to doc-string a Lua function?
What is the correct way to doc-string a Lua function?
I just picked this up from reading the code of others:
--- the dot product
--- @param u table<table<number>> a vector
--- @param v ...
1
vote
0
answers
71
views
lua file in the local folder is not enabled after texhash
I am trying to add the pre-release version of lua-widow-control to my local TeX directory. In the local folder, I created a new folder lua-widow-control and placed the files lua-widow-control.sty, lua-...
8
votes
2
answers
204
views
Don't get decimal output with luacas
First of all "Merry Christmas" to everyone.
I'm trying to get decimal output with luacas and don't get it.
\documentclass[paper=a4,fontsize=12pt]{scrartcl}
\usepackage{luacas}
\begin{...
6
votes
1
answer
180
views
Running Lua function on biblatex output
I want to automatically transliterate titles and author names I'm citing if they're written in another script. For example, given an author named مَحْمُود, I would like to be able to cite them inline ...
2
votes
0
answers
104
views
ConTeXt: Correctly classifying arguments with CLD
I have the following MWE:
\startluacode
local function startenv(keyword, keyval)
if keyword[1]:find("=", 1, true) then
local cadena = utilities.parsers.array_to_string(keyword, &...
2
votes
2
answers
224
views
The method of marching cubes (for implicit surfaces) is very slow, and does not reach the level of accuracy of existing pictures. How to improve?
I was inspired by some of the illustrations in https://math.stackexchange.com/a/46222.
I wanted to try graphing implicit surfaces myself, and came across the method of marching cubes. See https://...