Questions tagged [lua]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
35 views

How to create an alphabetical attachment list that supports unicode characters?

I would like to be able to create a list of attachments similar to the list of figures or tables. However, since it makes little sense to sort the attachments by page number, I would like to sort them ...
user avatar
  • 281
0 votes
0 answers
6 views

Local declaration of (built-in) Lua functions to reduce overhead [migrated]

It is often said that one should redeclare (certain) Lua functions locally, as this reduces the overhead. But what is the exact rule / principle behind this? How do I know for which functions this ...
user avatar
  • 371
1 vote
1 answer
54 views

Origin of Lua Error

If a lualatex compilation breaks with/at this terminal output: (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c ode.tex))[\directlua]:1: attempt to call a nil value (...
user avatar
  • 1,870
0 votes
1 answer
53 views

LuaTeX: How can I change the width (bounding box) of a letter?

I tried to adapt this solution by Marcel Krüger Fixing the position of math accents when using unicode-math in lualatex with a text font for letters and digits for changing the width (bounding box) of ...
user avatar
1 vote
1 answer
34 views

commands defined in external file and imported by lua are not recognized

Suppose I have a file sourced.tex which defines a new command \MyCommand: \newcommand{\MyCommand}{Hello World} If I create a file main.tex and I source this file with \input, I'm able to use the ...
user avatar
  • 1,372
0 votes
0 answers
55 views

(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 ...
user avatar
  • 1,870
0 votes
1 answer
38 views

Detect draft mode from Lua in LuaLaTex

I'm working with a document for which I need to generate some data from a Lua script each time the PDF is produced. However, the generation of this data might be a slow, so I would like the script ...
user avatar
  • 103
0 votes
1 answer
27 views

Pass string with escape characters and comma through xkeyval package while compiling the document with LuaLaTeX

The following is the code of the file temptest.sty \ProvidesPackage{temptest} \RequirePackage{amsmath,amssymb} \RequirePackage{xkeyval} \RequirePackage{luacode} \begin{luacode*} function myfunc(m,n) ...
user avatar
  • 1,411
1 vote
2 answers
36 views

Alignment Gets changed in tabular environment on adding argument in lua function on compiling with LuaLaTeX

The following code works and gives expected output with expected alignment. \documentclass{article} \usepackage{luacode} \begin{luacode} function myfunc() str2=[[$1$ & $2$ & $3$ & $4$ &...
user avatar
  • 1,411
1 vote
0 answers
50 views

Is it possible to generate LaTeX documents from within a lua interpreter?

I'm curious about the possibilities LuaTeX offers. I understand LuaTeX is a sort of unified API which allows you to hook into the TeX engine and benefit from some abstractions which would make the ...
user avatar
  • 1,372
0 votes
1 answer
49 views

Issue with xkeyval package and special characters while compiling with LuaLaTeX

The following is the code of document myfile.tex. \documentclass{article} \usepackage{test} \begin{document} \begin{tabular}{|ccc|c|c|} \myPrint[trtext=Yes, fltext=No]{p,q,r}{stu} \\ \end{tabular} \...
user avatar
  • 1,411
1 vote
0 answers
63 views

Define a polynomial symbolically, then differentiate it to find its local maximum [closed]

For the following, how to symbolically construct the polynomial Te(Ne) = a*Ne^2 + b*Ne + c, then find its maximum by equating its derivative to zero. I would like to find how to do it using either lua ...
user avatar
  • 8,759
1 vote
0 answers
136 views

weird verbatim-like manual environment writing with luatex preprocessing

I'm currently trying to make my wrapper around tikzpicture while preserving the tikzexternalize functionality (see this post, this and this one for reference where some of my ideas came from): a real ...
user avatar
  • 393
0 votes
1 answer
47 views

Pandoc convert specific parts of document

I have a markdown file of which I want to convert sometimes only specific parts, sometimes the whole document. I know about lua-filters and fenced div which I think is a possible approach, but how can ...
user avatar
  • 21
0 votes
1 answer
38 views

macros avoid linebreak if macro expands to nothing

I know this one is quite similar to this post (from me). But even with using % all over the place and \ignorespaces there is still a linebreak. See my mwe: (main2.tex) \documentclass{article} \...
user avatar
  • 393
0 votes
0 answers
48 views

I can't figure out tikz + gnuplot

I'm trying to output a gnuplot graph to tikz code. I tried using the set terminal lua tikz terminal in gnuplot. Gnuplot issued the corresponding code in the \begin{tikzpicture}[gnuplot] environment... ...
user avatar
0 votes
0 answers
45 views

citeproc-lua prevent hyphenating the urls in references

I use citeproc-lua with texstudio in Windows 11. I have used apa csl style provided with the package citation-style-language as example here, but I have to use american-medical-association csl style ...
user avatar
  • 55
1 vote
0 answers
66 views

citeproc-lua giving errors in luatex

I use windows 11. I don't konw how to use tex with command prompt. So, i use texstudio. I wanted to use cep referencing style in my report, which was not available in biblatex, bibtex. So, i installed ...
user avatar
  • 55
0 votes
0 answers
47 views

Luaotfload: change kerning for many characters at once

How can I iterate over many characters? And how can I iterate over hexadecimal values? Not working MWE: \documentclass{article} \usepackage{unicode-math} \directlua{function W(s) return string.gsub(&...
user avatar
2 votes
1 answer
51 views

How can I filter math with Lua toks?

Related to a previous question (How can I avoid TeX environment's when token filtering in LuaLaTeX?), I have been playing with creating a package using Lua to censor text (though it's at an early ...
user avatar
0 votes
1 answer
58 views

gnuplot lua-tikz font to Arial

In gnuplot lua-tikz, I would like to change all letters that appear in a figure (including labels, tics numbers) to Arial. I tried several patterns as set term lua tikz tightboundingbox standalone ...
user avatar
  • 101
2 votes
1 answer
54 views

How can I avoid TeX environment's when token filtering in LuaLaTeX?

This is a follow-up to: How can I exclude TeX macros when counting a string's characters in Lua? Thanks to @Henri Menke's excellent answer to that question (below), I know how to filter out macros ...
user avatar
1 vote
2 answers
80 views

How can I exclude TeX macros when counting a string's characters in Lua?

A follow-up to my earlier question: Macro to replace text with random string of same length Thanks to the answer of @Mico, we now have a macro in Lua to replace a UTF-8 String with random characters. ...
user avatar
2 votes
1 answer
95 views

Macro to replace text with random string of same length

I am playing with LuaLaTeX substitutions, trying to find a way to replace a string within a macro with random characters of the same length. The chickenize package offers the randomchars function ...
user avatar
3 votes
1 answer
341 views

Minimal Testing Environment For LuaMetaTeX

The new LuaMetaTeX typesetting engine praises itself as being "lean and mean", but the ConTeXt package that it comes shipped with is actually pretty obese (around 270 MiB when installed). To ...
user avatar
  • 49
1 vote
1 answer
78 views

Strange interaction between fontspec and lua

I noticed a strange interaction between the fontspec package and lua code. I have been using for some time a lua code found on this site that prevents words composed of a single letter ("a", ...
user avatar
  • 427
0 votes
0 answers
39 views

textcolor inside bookdown math blocks

I am trying to get text coloring to work inside tex/math blocks. The code I inherited in latex is \[ H_0: b = \textcolor{orange}{0} \] This works fine for pdf but not for html. I have then read https:...
user avatar
1 vote
2 answers
66 views

Printing Hostname in Lua

Related to How to detect and condition based on hostname . Answer in next post.
user avatar
  • 3,261
1 vote
0 answers
68 views

A command call implemented in C, called from TeX via Lua. Why is it hanging?

The following C code (popen3luatex.c) implements a command call at the C level. This can be called from LuaTeX using the LaTeX file popen3luatex.tex, below popen3luatex.c. I've written little C code ...
user avatar
  • 7,394
1 vote
1 answer
73 views

pgfplots contour lua with data in external file

i am working on a lot of measured data stored in a file, which i want to visualize with a contour plot. There I have coordinates x and y and a value z as function of x and y, which should be used to ...
user avatar
2 votes
1 answer
66 views

LuaLaTeX code should generate an error, yet doesn't

I'm trying to learn a bit more about LuaLaTeX and came across this introduction. The author claims that the following code does not work: % this code will not work \directlua{ tex.print("\\...
user avatar
  • 1,372
0 votes
1 answer
77 views

LuaLaTeX full font embedding + eforms package

i tried fully embedding a font using directives from How can I verify that the fonts are all embedded in my LuaLatex document? [1], using font BlackChancery from https://www.1001fonts.com/...
user avatar
  • 1
1 vote
1 answer
101 views

LuaTeX compiling

May someone can explain me how to compile the LuaTeX source files available here : http://michel.quercia.free.fr/cours-MP.tgz together with the macro's files http://michel.quercia.free.fr/montchapet....
user avatar
  • 516
1 vote
1 answer
106 views

lualatex luasec/luasocket

I hope this isn't frustrating since there are already other posts regarding a similar question, but somehow nothing I read so far works. As I'm under Arch Linux, I installed lua and luarocks via ...
user avatar
  • 393
0 votes
1 answer
109 views

How can I use Lua's string.len() inside a metapost function?

I am designing pseudo-crosswords for my pupils exercices with the following macro: \startMPinclusions % could'nt achieve using the word string length as a first parameter vardef MotMystere (expr ...
user avatar
  • 2,952
3 votes
1 answer
209 views

Lua - automatically turn - into -- if between two numbers

I've repeatedly read that Lua can do some cool under-the-hood things to TeX. One thing that comes to mind: I have a rather forgetful coworker who always used a hyphen instead of en-dash between two ...
user avatar
3 votes
1 answer
71 views

Different output in Lua and LuaLaTeX

I'm using TeX Live 2020 (with LuaLaTeX 1.12.0) and Lua 5.3. When I compile the following .tex file using lualatex --shell-escape the content of the resulting .pdf is a. \documentclass{article} \...
user avatar
1 vote
1 answer
56 views

Help on specific Latex command referencing Lua functions to be written with Lua

Today I write the following code snippet in a latex file and what I want to achieve works well : \draw [dotted] (\ordinateOnTimeAxis{-1500}, 2 * \laneHeight) -- (\ordinateOnTimeAxis{-1500}, 2 * \...
user avatar
0 votes
0 answers
54 views

Unable to read a 'second' json file from inside a 'for' loop (Lua+Latex)

I'm looping through a json file and displaying content in the format below: Zone 1 Projection(Main.tex) Grat Table(gratsection.tex) Zone 2 Projection (Main.tex) Grat table (gratsection....
user avatar
  • 37
1 vote
0 answers
147 views

Latex renders "Script file ./input.markdown.lua not found" error into pdf

I am using this command line (batch file): .\pandoc.exe --pdf-engine-opt=-shell-escape --from=markdown --output=test.pdf mini.md --template .\templates\test.template with this input file #Testbook ...
user avatar
1 vote
1 answer
61 views

Table CHAR alignment in XML

I have successfully loaded XML in LuaLaTeX with XML-Tables based on this example Count Number of Columns in XML. I have need the table alignments from tbody instead of thead. And how to define ...
user avatar
  • 2,036
1 vote
1 answer
89 views

Split Table to Next Page - LuaLaTeX

I have need to split the table to next page without using longtable package. Because longtable package is not supporting directly float. MY MWE is: \documentclass{article} \usepackage{luacode} \begin{...
user avatar
  • 2,036
3 votes
1 answer
133 views

LuaLaTeX cannot find C module, but Lua can

My directory looks like this: main.so mainlua.lua maintex.tex where main.so is a module written in C++. mainlua.lua contains the following code: package.cpath = package.cpath .. ";./?.so;" ...
user avatar
2 votes
1 answer
89 views

Using Lua to format section titles

I'm trying to create a new lecture environment from the base section one. I'd like its title to be Lecture <number>: <title> if a title is provided, and Lecture <number> if it isn't. ...
user avatar
  • 1,994
1 vote
1 answer
50 views

XML Keyboard Characters to TeX Characters - LuaLaTeX

I would like to convert all the XML Keyboard Characters to LaTeX Code Conversion. For Example $ should convert to \$, { should convert to \{ in LaTeX. How to achieve this? I know it's possible to do ...
user avatar
  • 2,036
1 vote
1 answer
47 views

Figure Text in same Document with Anchor Tag

I had referred this link: Create Separate File using LuaLaTeX But i have need in the same document. I would like to give anchor tags in the figure caption and move the figure caption text in the top ...
user avatar
  • 2,036
3 votes
1 answer
86 views

Create Separate File using LuaLaTeX

My Input LaTeX FileName is Article05.tex. I would like to find the text <stepn number>(.-)</stepn number> and store the text is individual file like name is Article05-step.tex. How to ...
user avatar
  • 2,036
0 votes
1 answer
42 views

Problem issuing \egroup ("}") from Lua

I would like to define a command using Lua that will start and end a \savebox depending on if it is starred or not. Let's call this command \switchcolumn. Here is the code (the first \switchcolumn ...
user avatar
  • 743
1 vote
0 answers
61 views

How can I substitute an ampersand in LuaLaTeX?

I am trying to use Lua to substitute the default ampersand for a swashy one. Fontforge tells me the glyph's name is 'ampersand', and the swashy version is 'u0026.da'. However, I can't get the swash ...
user avatar
1 vote
0 answers
71 views

How to make sure LuaTeX write all that is supposed to?

I have a file \documentclass{standalone} \begin{document} \( \mathaccent"7017 c \) \end{document} that prints what is supposed to, a C-with a circle on top in math-mode, just fine. Suppose now ...
user avatar

1
2 3 4 5 6