Questions tagged [lua]

Lua is a powerful, fast, lightweight, embeddable scripting language.

Lua is a powerful, fast, lightweight, embeddable scripting language. It can be embed in TeX/LaTeX code by using the LuaTeX rendering engine.

348 questions
52
votes
5 answers

Practical use of Lua

Although I always use LuaLaTeX to compile my documents, I don't really use Lua that often. Sometimes I even forget about it. In my last document I used it to write a random word generator, which picks a word from a pool of words. Which can be really…
8
votes
1 answer

Pass parameter to texlua script

Calling texlua file.lua on the command line runs the file through a Lua interpreter. Is it possible to give arguments to the script? For instance, in -- file.lua io.write(3.4 + 5.6) io.write("\n") How do I make 5.6 into a parameter given on the…
6
votes
0 answers

Lua equivalent for `\iffontchar`

I am looking to replace the TeX command \iffontchar with Lua code. Reason I am printing some tables with Lua code and want to replace the notdef(tofu) with something else. \documentclass{article} \usepackage{fontspec} % Font at…
yannisl
  • 117,160
5
votes
1 answer

Luarandom causes infinite loop

I'm trying to get a list of unique random integers within an interval with the luarandom package. Here is a MWE, adapted from the package…
Matthew Leingang
  • 44,937
  • 14
  • 131
  • 195
3
votes
1 answer

why lua multiline string [[ ]] does not work going from Lua to Latex?

lua supports multiline strings. I need to send such string from Lua back to Latex. I first verified the code works using lua standalone engine but lualatex does not like something. Here is the…
Nasser
  • 20,220
1
vote
2 answers

Printing Hostname in Lua

Related to How to detect and condition based on hostname . Answer in next post.
ivo Welch
  • 3,766
1
vote
0 answers

how to find any values include special characters using lua regex

local tex = '\\authors{\\author[]{{Surname}…
Balaji
  • 127
1
vote
1 answer

Lua, does tex.print only accumulate

I can either build the output first then use tex.print or I can use tex.print for each string. Is there a performance penalty? It's easier to use tex.print than having to build the string but if it is slow(for thousands of calls) then it is not…
user184375
0
votes
1 answer

Problem to define a key and the associated value of a table from a variable

I'm sorry for the imprecision of my question but I couldn't find a way to describe my problem correctly. I created a new package and in the "lua" part, I use two classes, one for points and the other for lines. Two tables z and L are associated to…
Alain Matthes
  • 95,075
0
votes
1 answer

Function to get multiple special assignments in a lua code

Assuming that the following assignments a = z.a etc. are correct, is it possible to use a function iso to obtain them. I thought of the name "iso" because in my main code a is a point, z.a is an affix that represents the point. % !TEX TS-program =…
Alain Matthes
  • 95,075
0
votes
0 answers

(Not) finding Lua modules

I get an error that looks like my code doesn't find some Lua module(s) even from a Lua file in the same directory. git/uliska/diss/latexstuff/ulDissLua.lua:14: module './template-config.lua' not found: no field…
uli_1973
  • 1,920
0
votes
1 answer

Lua OR find and Replace

My LaTeX-out.tex TeX Code is (single line): \begin{align*}\alpha + \beta = \gamma\end{align*} Some text here. \begin{align*}\sum^{k}_{i=1} \iota \end{align*} and so on the text. \begin{thebibliography}{000}\bibitem{cqgab7bbabib1}{Aasi J et al LIGO…
Balaji
  • 2,282