Lua is a powerful, fast, lightweight, embeddable scripting language.
6
votes
2answers
198 views
More than one width of a glyph in LaTeX or LuaLatex
I don't know where I can ask about it.
I have font with 2 or 3 versions of letter 'a'.
How I can put this information to LuaLaTeX, LaTeX etc.?
When the paragraph are breaking/making LaTeX made ...
7
votes
1answer
91 views
Strange interaction between fontspec, lua and pgfplots
While trying to combine some Lua code with plots written in pgfplots something went completely wrong. I have no idea what causes the problem, as the error message is a bit opaque to me. Here is the ...
20
votes
1answer
251 views
Bad interaction between fontspec and some lua code that performs string-related search and replace operations
I'm in the process of readying a LuaLaTeX package for "official" release to the CTAN, but I need to squash a few remaining bugs first. The bug described in this question concerns incorrect behavior of ...
8
votes
1answer
332 views
How to properly install and use a new font with LuaLaTeX?
I have problems trying to get new fonts to work when compiling with LuaLaTeX. I'm working on Mac and use TexShop (with the MacTeX package).
It goes like this:
I downloaded for example the Cardo ...
14
votes
4answers
454 views
How to read a file with luatex
I tried to read a file with lua and set the content as normal text in my document, but I didn't worked it out. Here my code:
\documentclass{scrartcl}
\usepackage{luatextra}
\usepackage{filecontents}
...
8
votes
1answer
341 views
Speeding up latex/lua/tikz
I have a rather large LaTeX document in that it generates a lot of LaTeX code using lua (small .tex file on disk but large amount of generated LaTeX code). It is very slow to compile and takes about 1 ...
6
votes
1answer
217 views
Search & Replace Script for TeXworks
Does anyone have an example for a search & replace lua script that I can use with TeXworks. I have a rather large document here (about 3'000 pages DIN A5) which I need to update continously. To ...
5
votes
1answer
225 views
Hacking Animate
While babysitting my kids yesterday I played little bit with one of my favorite LaTeX package PSTricks. Naturally I started toying with something more "advanced" so a toyed a bit with animations. On ...
9
votes
3answers
814 views
Matrix multiplication (and other operations) macro using lua module
I am hoping to be able to create a macro to multiply matrices using a lua module. The module is here:
https://raw.github.com/davidm/lua-matrix/master/lua/matrix.lua
As suggested to me in a previous ...
4
votes
2answers
163 views
Why does \luaexec work but the luacode environment doesn't?
The following code can be compiled by lualatex (Version beta-0.70.1-2011061410 (rev 4277)) correctly. But if I use \begin{luacode} ... \end{luacode} environment to replace the \luaexec{...} command, ...
7
votes
1answer
135 views
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")
...
1
vote
0answers
221 views
Debugging Lua in LuaLatex with LDT [closed]
LDT is an IDE for lua based on eclipse. It is quite nice and the best free lua debugger I've seen(I've just stumbled upon it the last 2 days or so). It took me a bit to get setup properly but because ...
6
votes
2answers
322 views
How to check if a value is not equal using TeX conditionals?
I have a value defined in a macro, e.g.:
\mymacro{apple}
I need to check if a value does not equal a string, e.g.:
IF #1 NOT EQUAL TO "apple" THEN
PRINT "It is not a apple, it is #1."
FI
I ...
10
votes
3answers
248 views
In which order is Lua Code in LuaTeX being processed
Can someone help me understand the order in which LuaTeX documents are being processed?
From what I've understood, the order is the following:
the code is being read, top to bottom
when the ...
5
votes
3answers
339 views
How to do a 'printline' in LuaTeX
I have just started exploring the world of LuaTeX and wanted to write a piece of code, that prints a name to a new line in the document.
\directlua{
for i=1,3,1 do
tex.print("FOO")
end
}
which ...
4
votes
1answer
262 views
How to use string.find from Lua in ConTeXt?
I am trying to make some conditionals with Lua, which check if some text is found within a string. Unfortunately, when I compile it, I get:
! LuaTeX error <main ctx instance>:4: bad argument #1 ...
5
votes
0answers
270 views
Lua techniques and libraries for LuaTeX [closed]
With LuaTeX, it is possible to use many libraries and functions that can simplify various aspects of Lua programming. As Lua as language is quite new for the majority of TeX users, I think it would be ...
13
votes
1answer
181 views
Lua function to see if a macro is defined or not
I need to determine if a TeX macro is already defined or not via a Lua function. Any ideas?
function IsTeXMacroDefined(macroname)
if defined(macroname) then return true end
return false
end
7
votes
2answers
302 views
How to display special symbols in ConTeXt which are processed by Lua?
I have a ConTeXt document containing many special characters. I have followed the instructions at Which symbols need to be escaped in ConTeXt? to ensure they can all display properly in the document, ...
0
votes
2answers
445 views
Print large macro block from Lua to TeX
I have a rather large block of TeX macro code that is no problem to do in TeX but I'd like to create the macro in Lua instead
The macro contains various TeX macro characters (\, %, [, ])
How can I ...
2
votes
1answer
142 views
LPeg self-referential pattern
I am trying to create a self-referential pattern in lua/lpeg
local group = lpeg.P(sep1 * (1 - sep2)^0 * group^0 * sep2)
notice that group refers to itself. This is not possible since group is ...
-1
votes
1answer
145 views
LPeg alternative match? [closed]
Looking over the LPeg docs I do not see a way to have alternatives(OR)
http://www.inf.puc-rio.br/~roberto/lpeg
e.g., a | b will match a or b. Am I missing something?
18
votes
4answers
1k views
Reading data from a relational database into a LaTeX table
I'm using Tex Live 2009 on Debian squeeze. I can upgrade if I really, really have to, but I'd rather not. i was wondering if it would be possible to do the following.
Given some data in a ...
7
votes
3answers
488 views
What is the correct way to delineate directories in Lua?
I have been experimenting with some Lua code to list directories and provide them to the TeX engine.
I have been using the Lua File System (lfs) module.
The first part list the current directory ...
3
votes
2answers
303 views
Using macro variables with Lua in ConTeXt
I need to make some macros in ConTeXt. I have tried to use Lua code, but I do not understand how to mix ConTeXt source and Lua source together. Here is an example:
\define[3]\textmacro{
\startlua
...
16
votes
6answers
2k views
What are the advantages of Lua over other scripting languages for a TeX implementation?
The question is inspired by Martin Schröder's answer to I am new to TeX. Should I use LaTeX, XeLaTeX, …? as well as my two previous questions on this forum:
Automatic document update
Generate LaTeX ...
1
vote
0answers
74 views
Sorting tlpdb.tlu output [closed]
I get an output from tlpdb.tlu, which is unsorted. When I now use table.sort the output as a pdf is still unsorted.
tlpdb = read_tlpdb( kpse.var_value("SELFAUTOPARENT") )
table.sort(tlpdb)
Do I ...
6
votes
1answer
287 views
LuaTeX with unicode-math, how to get the font id of current math font
How can I query informations about the current math font?
I tried the following in a document using unicode-math and Cambria Math font
\documentclass{article}
\usepackage{unicode-math}
...
16
votes
2answers
597 views
LuaJIT and LuaTeX
Is it possible to change the Lua engine in LuaTeX to LuaJIT?
Will it be as simple as replacing the Lua5.1 source code in the LuaTeX tarball with the LuaJIT source, or does it require (drastic) ...
4
votes
1answer
80 views
Find node above and under
Using a post_linebreak_filter callback, is it possible to access the nodes positioned above and under a given node?
9
votes
1answer
173 views
Convert color name to pdfliteral code
How can I convert a color name (such as used with the xcolor package) to a pdfliteral code, like q 1 0 0 rg (for red)?
2
votes
1answer
306 views
Using pdfliteral to highlight text
Using pdfliteral, one can color text like the following:
w1_prev = node.new("whatsit","pdf_literal")
w1_prev.data = "q 1 0 0 rg"
w1_prev.mode = 1
w2_prev = ...
6
votes
2answers
92 views
Problems with insert_before and post_linebreak_filter
I'm coding an algorithm to detect and highlight homeoarchies.
Here my current almost working (but compiling at least) code:
\documentclass{article}
\usepackage[french]{babel}
\usepackage{kpfonts}
...
2
votes
1answer
88 views
post_linebreak_filter and glyph analysis
When calling a function with a post_linebreak_filter callback, the nodelist only contains nodes of type 0 (hlist), 10 (glue) and 12 (penalty), whereas when using a pre_linebreak_filter callback, type ...
7
votes
1answer
185 views
Testing for TeX boolean in Lua code
How can I test for a TeX boolean in Lua?
This kind of code doesn't work:
\newif\if@mypkg@someif
\begin{luacode}
-- some lua code
\if@mypkg@someif
-- some more lua code
\else
...
4
votes
2answers
326 views
How can one get a list of the available functions in Lua(La)TeX
Is there a list or method to determine a list of the lua functions available/installed?
Sofar I could only find the lua source files. Maybe I should write something that search through all the ...
2
votes
1answer
454 views
Passing two or more dimensional arrays to lua
I can write:
\def\myarray{{Nrs,1,2,3}}
then I can call lua:
\luadirect{myfunc(\myarray)}
and access the values in the array/table.
How would one do it for multidimensional ones?
I initially ...
3
votes
1answer
124 views
ConTeXt's user namespace seems somewhat empty
With
ConTeXt ver: 2010.05.24 13:05 MKIV fmt: 2010.12.18 int: english/english
the ConTeXt code
\starttext
\message{one}
\directlua{print(1)}
\message{two}
\usercode{print(2)}
...
12
votes
1answer
877 views
Installing Lua Modules for use in LuaLaTeX
I've done all of the searching that I can, and I think I've read the right answer, but am too dumb to know that I read it.
I can't seem to figure out the magic tricks to get Lua modules, installed by ...
5
votes
2answers
246 views
How to register a callback in ConTeXt
In ConTeXt mkiv, how do I register a callback? callback.register() does nothing (and IIRC most callbacks are frozen anyway) and somewhere I found tasks.appendaction, but this gives me an error that ...
8
votes
2answers
383 views
percent signs in luacode* environment (LuaLaTeX)
Can someone explain what happens here:
\documentclass{article}
\usepackage{luacode}
\begin{document}
\begin{luacode*}
tex.print("xx\%a","yy\\%b","zz\\\%c")
\end{luacode*}
\end{document}
The ...
