We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [lua]

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

Filter by
Sorted by
Tagged with
7
votes
4answers
345 views

How can I retrieve \thepage (or detect a page change) from Lua in LuaTeX?

I am writing (contributing to) a LuaLaTeX package where a Lua function is used to generate images that are inserted in the LaTeX document. One piece of information we need is the current page number ...
2
votes
1answer
491 views

LuaTeX error: LuaTeXbase-loader.sty

I am trying to edit my old CV with modernCV in Linux. Some missing styles and classes are not installed automatically -- so I now must try to do this manually. Since the popular package source ctan....
5
votes
1answer
154 views

Strange ConTeXt fail to load pgf.gd.control

I'm playing with PGF's (algorithmic) graph drawing, which relies on Lua internally. I have no problems with LaTeX, but ConTeXt fails to load the package. For the simple document: \usemodule[tikz] \...
3
votes
1answer
79 views

How can I retrieve the current roman, sans, and mono fonts in LuaTeX

I am working on a LuaLaTeX package, and at one point I have to pass the full names of the three basic font families (roman, sans, mono) to another tool. I have found and checked that I can correctly ...
0
votes
1answer
73 views

Calling Lua on the output of a \@for loop to add “and” to the end of a comma-separated list

I'm trying to make a package-free command that applies a command across a comma-separated list, and then adds the word ``and'' to the output as is grammatically appropriate. I've already gotten some ...
12
votes
0answers
277 views

metafun: Why is the arrow tip not filled? [closed]

Trying out another example I saw that with the metafun format (luatex version) the arrow tips are no longer filled. The following document (to be compile with lualatex) shows the problem: \...
3
votes
1answer
1k views

Do I have to install Lua in order to compile with LuaTex? Which is the best way to do it?

I've already installed TeXLive and TexMaker. Now I'm thinking of turning to LuaTeX. What are the steps I have to follow in order to start compiling with LuaTeX? Do I have to install Lua first? If so, ...
12
votes
2answers
559 views

Problem using length operator in Lua

This is my MWE: \documentclass{article} \newcommand{\printdata}{% \directlua{ data = {"a", "b", "c"} for i = 1, #data do tex.print(data[i]) end } } \begin{document} \...
0
votes
1answer
111 views

Generate a list of QR-code with lua

I want to generate a list of digit sequences, where a part of a sequence is a counter and another one is generated depending on this counter. My MnotWE \documentclass{book} \usepackage{luacode} \...
1
vote
0answers
77 views

Can't use SQL to format date in LuaLaTeX with LuaSQL & passing parameters to compiler

I am working on a LuaLaTeX example where date has to be transferred from my database using Lua and then compiled using LuaLaTeX. I am using LuaSQL to do all this and this is the minimal working ...
0
votes
2answers
152 views

How shall I launch from lualatex a lua program contained in a lua variable?

I store contents in lua variables and use them in a lualatex document. I know how to do insert that content in the TeX flow, in a macro but I don't know how to launch a lua program contained in a lua ...
1
vote
1answer
190 views

Human-readable context-free manuscript metadata [closed]

tl;dr • Would lua be a good option to process metadata stored in an external text file and output TeX fragments for use in a front matter? A minimal lua example to solve the following sub-problem ...
9
votes
2answers
3k views

My first luaLaTeX example

I am totaly inexperienced in LuaLaTeX and I don't know why but it was somehow very difficult to find working LuaLaTeX example so I can start playing around. I finaly found the example in a document ...
2
votes
1answer
132 views

lstlisting environment inside luacode

I'd like to feed a lstlisting environment (from the listings package) with contents back to TeX from Lua, but the end of lstlisting is apparently not found. The same happens if lstlisting is replaced ...
3
votes
1answer
693 views

Error: Only one # is allowed per tab

Whenever I try processing the following code it gives the error Only one # is allowed per tab. ... .25ex\everycr {}\tabskip \z@skip \halign {##. Can someone let me know what is wrong with it? \...
3
votes
1answer
462 views

XML parsing and data retrieving in ConTeXt

ConTeXt provides a way of managing XML files. The reason I approached this functionality is due to the need of being able to publish xml data in PDF to obtain catalogs or other technical ...
4
votes
3answers
248 views

Selecting a Specific Array Element in LuaTeX?

I need to create a command that goes \MyCommand{x,y} or \MyCommand{x,y,z} (both ways should be possible), where x, y, and z are three numbers. It should give the output \begin{matrix}x\\y\end{matrix} ...
4
votes
2answers
604 views

Does lua scripting entirely replace the TeX macro-definition commands & allies?

Does lua scripting in LuaTeX entirely eliminate the need to use the TeX macro-definition commands \def, \gdef, \edef and \xdef? What about \exapndafter, \noexpand, \protected, \long and \relax?
5
votes
1answer
109 views

Automatically highlighting nominalizations (a.k.a. zombie nouns) as a writing aid

To improve my writing, I want to reduce the number of nominalizations (a.k.a. zombie nouns) that I use. For that purpose I would like to have all nominalizations automatically highlighted in the ...
10
votes
1answer
207 views

Call a (luatex-)combo font through NFSS

After some struggles I found a way to call a combo-font (which combines glyphs from two fonts) so that I can get various font sizes. Has anyone an idea how one could inject this code (or other code ...
9
votes
2answers
594 views

LuaTeX C API as Lua C API

I'm writing a Lua Module for LuaLaTeX. Does a LuaTeX C API exist? For example, how can I use the C version of tex.print into my C code? Thanks in advance
14
votes
2answers
400 views

Fill a lua table with lowercase/uppercase pairs.

I would like to add the Letters=Uppercase option to a font which hasn't the needed open type feature built in. This is (with lualatex) possible like this: \documentclass{article} \directlua { ...
5
votes
1answer
245 views

How to redefine caption in KOMA-Script to captionbeside?

While experimenting with KOMA-Script's features I have found captionbeside. That's a really great option for me as I want my captions to be formatted this way. The only problem is that in a long ...
26
votes
3answers
4k views

Why should I be interested in Lua?

I have been using LuaLaTex since I got acquainted with TeX, because it can easily work with system fonts, which I really need. Font packages in TeX are not friends of the Russian language, though ...
5
votes
1answer
188 views

How to print a verbatim block at its end automatically in LuaLaTeX?

This is a follow-up question to this answer by Mico. I try to adjust his Lua code to my needs and line numbering already works. Actually there is one real usability issue and that's my question: How ...
4
votes
2answers
274 views

Order list of names with Lua

I want to define a command using \directlua that looks something like: \sort{c, b, a} and outputs a, b, c to the document.
5
votes
2answers
302 views

Code Comment in directlua

How can I add comments to my directlua code? {\catcode`\%=12 \directlua{ function boxed (s) ??? Add a comment ??? if not(boxedflag) then i=string.find(s,'^!!!') if(i==1) then boxedflag=true ...
2
votes
1answer
127 views

Is it possible be use directlua substitutions inside listings environment?

is it possible to insert a directlua substitution inside a listings environment? for example - \begin{luacode} a=math.random() b=math.random() \end{luacode} \begin{listings} if(\...
3
votes
0answers
144 views

Bake LuaSQL into luatex binary on Windows

Further to this question, I want to build luatex on Windows with the LuaSQL library baked in, at least with the ODBC drivers. This post by Taco Hoekwater back in 2010 walks through the process for ...
5
votes
0answers
370 views

How to install LuaSQL for Lua(La)TeX on Windows with MikTeX [closed]

I would really like to be able to pull data directly from ODBC databases into LuaLaTeX and it seems as if the LuaSQL package is the way to go. But for the life of me, after a couple of days of trying, ...
5
votes
1answer
261 views

Write to aux file directly from lua

Is it possible to write to the aux file directly from within a \directlua command? I am converting an older package to LuaLaTeX, which at some point builds a large string and writes it to the aux ...
3
votes
1answer
82 views

Custom spacing and TikZ

Using a solution to adjust spacing in my document with LuaLaTeX, I run into the problem, that the semicolons are also replaced in a TikZ environments: MWE: \documentclass{scrbook} \usepackage{tikz} ...
4
votes
1answer
332 views

Obtaining the name of an undefined control sequence in LuaTeX

I want to implement something similar to \detokenize as a Lua function. But there is one case where I am prevented from accomplishing my goal. \directlua{tex.sprint("[" .. token.get_next().csname .. "...
3
votes
1answer
528 views

hyperref error : ! Argument of \@providesfile has an extra }

Using a solution to adjust spacing in my document with LuaLaTeX, I run into this cryptic error, as soon as I use \label{} in a math environment: (c:/texlive/2016/texmf-dist/tex/generic/oberdiek/se-...
4
votes
2answers
443 views

Automatically adding space before punctuation in LuaLaTeX

I'm typesetting a text in which I want to add space before double punctuation using LuaLaTeX. To give you the idea: Using this answer and this one, I wrote following code which do not work (for "Test!...
2
votes
0answers
155 views

Filtering results of iterator from table in csv file

I am a Lua novice, and I would like to know if there is any way for an iterator to filter out or skip certain items in a table from a csv file. In particular, I would like for an iterator to be able ...
1
vote
1answer
233 views

tex4ebook and 4ht files

I am using MiKTeX on windows and calling tex4ebook.lua as a parameter to lualatex to make epub3. Can somebody explain in simple terms what the .4ht files in the tex4ebook directory are used for ...
2
votes
1answer
251 views

Execute luacode after \end{document} to rename pdf file after creation

I'm using toggle switches to create different outputs with a single tex-file. However my output PDF is always named after the producing tex-file e.g. luaexample.tex produces luaexample.pdf. Along ...
4
votes
2answers
494 views

why luacode environments do not ignore lua comment — lines?

I do understand (a little) the difference between luacode and luacode* But I almost fell of my seat when something I wrote inside a commented line caused lualatex to scream at me. I changed luacode* ...
2
votes
2answers
1k views

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 MWE ...
1
vote
1answer
639 views

another luacode new line question, how to generate new line without making everything string

I wanted to print something from luacode, and have it show up on its own line in Latex, not on the same line. The question here, which is similar, but uses strings, but I am not printing strings from ...
12
votes
3answers
364 views

Accessing TeX token or exporting filtered plain text

(updated according to gained information) In the context of keyword extraction from arbitrary (La)TeX documents and simple manipulations with them (automated annotation), I would like to be able to ...
2
votes
1answer
88 views

Implementing \luaescapestring in plain e-TeX

I'm trying to implement \luaescapestring in plain e-TeX. My solution needs to be fully expandable, so that \immediate\write\luascript{ local file = "\luaescapestring{\something}" } works. The ...
3
votes
1answer
730 views

How to use LaTeX commands in a luacode* environment?

How can one access LaTeX commands in the starred version of luacode environment? I am basically interested in using \ifdefined code below. For example, this works: \documentclass{article} \...
2
votes
2answers
496 views

Compilation time speed up for this pgfplots figure possible?

I already experienced in this question that the right choice of assignments for the coordinate values and meta values from a table could increase the compilation speed of pgfplots due to the lua ...
4
votes
1answer
579 views

How to determine the lua version in texlive 2015

I look for the lua interpreter version in luatex in texlive 2015 ?
2
votes
1answer
286 views

Help integrating some LUA code into a Luatex document?

Consider the following MWE: \documentclass[12pt,a4paper]{amsart} \usepackage{fontspec} \usepackage{luacode} \begin{document} ABC \begin{luacode} tex.sprint(os.date("compiled on --- %A at %X " ) ...
0
votes
1answer
269 views

Run pdflatex.exe from LuaLaTeX document

My document-combiner combine pdf-files via package pdfpages using command \includepdf. But before including, a source tex compiling by pdflatex.exe to produce the pdf. But now I have a little ...
4
votes
1answer
290 views

Is there a way to step through LuaLaTeX macros using a remote debugger?

Writing LaTeX macros has always been difficult, and it seems like writing a major package can only be accomplished by a Real Programmer. Fortunately, LuaTeX is on its way, and writing Lua macros is ...
3
votes
1answer
630 views

LuaLaTeX output from tex.print not interpreted

This is a follow-up from my previous answer to Automated Creation of Questions and Solutions for a Worksheet/Exam. I realised, that the macros I created like this \ewcommand{\currentI}{\directlua{tex....