Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [luacode]

A package to simplify inclusion of lua code in a LaTeX document

Filter by
Sorted by
Tagged with
0 votes
1 answer
59 views

Store has a variable from LaTeX Code

I would like to store as a Lua Variable and will check syntax using lualaTeX. How to do with LaTeX + LuaLaTeX String. My MWE is: \documentclass[format=acmsmall, review=false, screen=true]{acmart} ...
Balaji's user avatar
  • 129
0 votes
2 answers
131 views

Generating BiBTeX Source from LuaLaTeX

I am wondering if there's a way to generate the BibTeX entries directly from the LuaLaTeX source of the document being compiled. Given a particular filing system, the LuaTeX source might have all the ...
QuirkyTurtle's user avatar
1 vote
1 answer
88 views

luacode works with \newcommand but not with \NewDocumentCommand

Imagine the following code: \documentclass{book} \usepackage{luacode} \usepackage{xparse} \NewDocumentCommand{\HelloWorld}{}{Hello World} \newcommand{\DefaultHelloWorld}{Hello World} \begin{luacode}...
Dave's user avatar
  • 133
0 votes
1 answer
33 views

Why are the brackets not displayed in the formula as desired: C=A·(B)

\documentclass[paper=A4, 11pt]{scrreprt} \usepackage{luacode} \usepackage{amsmath} \usepackage{mathtools} \usepackage{siunitx} \sisetup{output-exponent-marker=\ensuremath{\mathrm{e}}} \begin{luacode*}...
PaulJGD's user avatar
  • 263
0 votes
2 answers
124 views

Lua script in separate LaTeX Style File

I have successfully loaded XML in LuaLaTeX with help of Michal.h21. Now I would like to store all the customized defined Lua Script in a separate LaTeX Style file, like bibr.sty, so that I will call ...
Balaji's user avatar
  • 2,282
3 votes
1 answer
179 views

Breaking equation with LuaLaTeX

The following code works as expected. It breaks mathematics expression in multi-lines. \documentclass{article} \usepackage{breqn} \begin{document} \begin{dmath*} f(1.02) + f (1.06) + f (1.1) + f (1....
user61681's user avatar
  • 1,749
1 vote
1 answer
75 views

BIBR expend as per Input XML using LuaLaTeX

In the XML file cross-links are not expended like 2–5 and final latex should be \citep{B2,B3,B4,B5}. Any Number should expend in all the cross-links like, if XML coded as 11–18 it should be convert to ...
Balaji's user avatar
  • 2,282
0 votes
1 answer
125 views

Plot a summation of cosine wave

I need to draw a wave that is the summation of these cosine waves This is my attempt in LuaLaTeX: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{luacode} \...
user3713179's user avatar
1 vote
1 answer
71 views

Conditional formula format with entered values and answer

With the luacode below I have tried to generate a conditional formula format with entered values including answer. However, it seems unnecessarily complicated and the formula formatting does not work. ...
PaulJGD's user avatar
  • 263
0 votes
1 answer
42 views

Multiple ShellEscape compiling at the same time in .tex file

I have been working on a project, where I'm compiling a single document into differents .pdf, thanks to a trick I found. In my .tex file, I'm creating an empty .pdf to make LaTeX happy thanks to ...
Vince's user avatar
  • 55
0 votes
1 answer
105 views

Problem with underscore (_) in lua loop

The next code gives the error: Missing $ inserted. This is because one of the keys is c_a. How to modify the loop to use c_a? % !TEX TS-program = lualatex \documentclass{article} \usepackage{luacode} ...
Alain Matthes's user avatar
1 vote
1 answer
285 views

Problem with syntax about keys in lua table

I use a table z={}: the keys are names of points and the values are in my example coordinates. Example : z.a = {0,1} I prefer this notation to the one z[a]. I try to keep the syntax as simple as ...
Alain Matthes's user avatar
0 votes
0 answers
65 views

Read the text from One File and Replace with Another LaTeX file using RegEX

Using Regex and Create Separate File with before and after count text this, I have exported PI Instructions from Original LaTeX file and stored in a separate LaTeX file Global_PItexts.tex. Now, I ...
Balaji's user avatar
  • 2,282
0 votes
1 answer
82 views

Regex and Create Separate File with before and after count text

When I have running LuaLaTeX filename.tex all the PI Instructions tags only like <?LuaLaTeX Sample XXX1?> and <?LuaLaTeX \hspace*{12pt}Abc?> should be store to separate filename called ...
Balaji's user avatar
  • 2,282
12 votes
3 answers
583 views

Passing values from a Lua function to TeX

The answer is probably simple but I can't find anything in the documentation For example: \begin{luacode} function divmod(a,b) local q = 0 local r = a while not (r < b) do q = q+...
Alain Matthes's user avatar
4 votes
1 answer
236 views

Old Lua code not working anymore

Consider the following code: \documentclass[ a4paper, landscape, 12pt ]{article} \usepackage{fontspec} \setmainfont[ Extension = .otf, UprightFont = *-regular, BoldFont = *-...
Svend Tveskæg's user avatar
3 votes
2 answers
138 views

Find error: Using Lualatex to print a table

I have 题 as a counter. I'm using LuaLaTeX and loaded the luacode package. \newcommand{\scoretable}{ \directlua{ tex.print("\begin{tabular}{|c|") for i=1,\the题 do ...
youthdoo's user avatar
  • 871
1 vote
1 answer
80 views

Expand command argument twice before passing to lua function (like \luastringO)

I would like to make a helper macro like luacode's \luastringO, but instead expand the arg twice instead of once. There is a bunch of \expandafter/\unexapnded\noexpand hackery that always seems to go ...
likethevegetable's user avatar
1 vote
0 answers
94 views

How to insert LaTeX commands through LuaLaTeX callbacks?

I would like to encourage LaTeX to break a line or page at the end of a sentence, after one of the following punctuation marks: "." ; "!" and "?". I would like to put a ...
B Legrand's user avatar
  • 413
1 vote
1 answer
80 views

Reduce the space between letter "f" and subscript that follows for Asana-Math (unicode-math)

Following the second part of this answer, I'm trying to do the similar thing for Asana-Math: reducing the space between letter "f" and the subscript that follows. However, my modified ...
Jinwen's user avatar
  • 8,568
0 votes
3 answers
234 views

Lua function returning a list of values to TikZ foreach loop

I was trying to come up with a Lua-based solution to another question here and failed miserably. There something I certainly don't understand about LuaLaTeX. Here is a toy code that shows the problem. ...
Miyase's user avatar
  • 2,574
1 vote
1 answer
113 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) ...
user61681's user avatar
  • 1,749
1 vote
2 answers
55 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$ &...
user61681's user avatar
  • 1,749
1 vote
1 answer
102 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", ...
Bastien's user avatar
  • 449
3 votes
2 answers
171 views

LuaTeX strings and xspace

I am using lua code to automate recording todos that come up during meetings I take minutes of. For this I use \luastringN from the luacode package currently. However, I would like to have all the '...
D Hoekstra's user avatar
0 votes
0 answers
169 views

Make a copy of the pdf file using lua

I would like to make a copy of the pdf file, but the following command (just before \end{document}) doesn't work. \directlua{os.execute("cp \jobname.pdf \jobname_bis.pdf")} My aim is the ...
jowe_19's user avatar
  • 939
1 vote
1 answer
289 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 ...
Balaji's user avatar
  • 2,282
2 votes
1 answer
164 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{...
Balaji's user avatar
  • 2,282
1 vote
1 answer
56 views

Delete a file using luacode

I would like to delete a file called \jobname.someext which is in the same directory of my .tex file, at the beginning of a typesetting. I know the shellesc package, but can I do this with a luacode ?
jowe_19's user avatar
  • 939
1 vote
1 answer
80 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 ...
Balaji's user avatar
  • 2,282
1 vote
1 answer
67 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 ...
Balaji's user avatar
  • 2,282
3 votes
1 answer
255 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 ...
Balaji's user avatar
  • 2,282
0 votes
1 answer
1k views

How to change output PDF filename(LuaLatex)

I'm using Lualatex and looking for a way to change the name of the output PDF generated. Can I do this via command line arguments when calling Lualatex to compile my document? or can it be set ...
24suns's user avatar
  • 37
0 votes
1 answer
217 views

Looping and printing code with luacode

I intend to print several plots by using pgfplots and a CSV file with several columns, one for each plot. this is how it would be implemented for a single column: \documentclass[12pt]{article} % lua \...
Felipe9's user avatar
  • 329
1 vote
1 answer
145 views

How to pass an argument to lua tex.print with maths

I want to create a blank exercise, in which answers can be text or mathematical expression, and to have below a list of all answers in disorder. In the MWE i made with LUA, the text appears below as ...
mathteacher's user avatar
3 votes
1 answer
72 views

luaxml always outputs with one letter indentation

I have a code to process an xml file and fill tcolorboxes with its contents. I'm using luaxml but it seems that i always get one letter indentation. Latest luaxml is needed. The code is here and a ...
user1850133's user avatar
4 votes
1 answer
96 views

Automatically formating all-caps passages with lualatex

I want to apply specific formatting to all all-caps passages in a longer text, specifically tracking/letterspacing using fontspec's mechanism, so it can be adjusted for different font-styles. I have a ...
Florian's user avatar
  • 2,919
0 votes
1 answer
73 views

Last Word not break avoid automatically

I have need to avoid last word break. It must print in PDF before the line or break with previous word. My MWE IS: \documentclass{book} \doublehyphendemerits=100000 \frenchspacing \usepackage{...
Balaji's user avatar
  • 2,282
0 votes
0 answers
77 views

Luacode with several .tex files [duplicate]

I wrote some luacode in my main.tex and I'm a adding several other files due to \input{code.tex} I already asked this question here and it works on a standalone environment but not in my case. I can't ...
stephank's user avatar
1 vote
3 answers
282 views

Generate table using formula

What is the simplest most universal way to generate a table using a formula? Minimal amount of code that is most robust. I simply want to essentially generate a table of values where the values are ...
Stretto's user avatar
  • 143
0 votes
1 answer
123 views

Lua Multiple for-loop statement

My XML Look is: <contrib-group content-type="all"> <contrib contrib-type="author"><name><surname>Bronnikov</surname><given-names>Kirill A<...
Balaji's user avatar
  • 2,282
13 votes
3 answers
1k views

Avoid Three Consecutive Hyphens

I need to suppress occurrences of 3 consecutive lines of text that end in hyphenated words. How to solve this? My LaTeX Source Code is: \documentclass{book} \usepackage{luacode} \begin{document} \...
Balaji's user avatar
  • 2,282
2 votes
1 answer
602 views

Count Number of Columns in XML

I have successfully loaded XML in LuaLaTeX but how to load XML-Tables? \documentclass{book} \usepackage{luacode} \begin{document} \begin{luacode*} local domobject = require "luaxml-domobject&...
Balaji's user avatar
  • 2,282
0 votes
0 answers
51 views

Calculated solution is not recognized as value

In the code below it should be checked if treq<t. In TEST 1, treq is specified as 2.93. The condition treq<t is met and turns blue (or red). \ifthenelse condition works fine. In TEST 2, xreq is ...
PaulJGD's user avatar
  • 263
0 votes
0 answers
159 views

Substitute font usage in XeLaTeX/LuaLaTeX

I have using LuaLaTeX and is there any way to tell XeLaTeX/LuaLaTeX to make automatic substitutions if the font is missing glyphs? My LaTeX MWE: \documentclass{article} \usepackage[no-math]{fontspec} \...
Balaji's user avatar
  • 2,282
0 votes
1 answer
360 views

tex.sprint in LuaLaTeX

I would like to print text as per XML file. But when using tex.sprint enter mark is removed and all the text are displayed in single line in PDF. How do avoid this? My ds.tex file is \documentclass{...
Balaji's user avatar
  • 2,282
2 votes
1 answer
221 views

Pass preceding character to a command LuaLaTeX

I want to make a character active/sensitive and pass its preceding character as an argument of some command. I could do it using LuaLaTeX engine and luacode package. Thanks to this and this post. % !...
Niranjan's user avatar
  • 3,415
0 votes
1 answer
1k views

Error message from including luacode package in Overleaf

I am including the LuaTeX into an Overleaf LaTeX document by \usepackage{arxiv} \usepackage[T1]{fontenc} % use 8-bit T1 fonts \usepackage{hyperref} % hyperlinks \hypersetup{ colorlinks=...
Hans's user avatar
  • 115
2 votes
1 answer
609 views

Find and replace string with leading comma and space using lualatex and gsub, or a macro

I need to get rid of mulitple instances of hyperlinked text ", foo bar" in my compiled latex document. It would be incredibly laborious to employ global find and replace on source code ...
Bob's user avatar
  • 263
2 votes
1 answer
493 views

MathML Format XML in Lua

I have successfully loaded XML in LuaLaTeX. But how to load MathML. Any Lua Modules are available? My LaTeX file: \documentclass{article} \usepackage{luacode} \begin{luacode*} xml = require('luaxml-...
Balaji's user avatar
  • 129