[texhax] list files with lua: windows vs linux
Arno Trautmann
Arno.Trautmann at gmx.de
Fri Apr 8 15:23:52 CEST 2016
Hi all,
I have a data evaluation script that produces eps output files named like
scan043_shot001...
scan043_shot002...
scan043_shot003...
I want to have them nicely put together in one pdf, including some
additional information. Using some Lua code, I managed to get exactly
what I wanted. Under Windows, at least – using:
for file in lfs.dir(".") do
This results in an iterator that lists the files numerically. Under
Linux, however, the file listing is completely arbitrary. Is there a way
to influence the order of the output of lfs.dir? The full example is
listed below.
Is there a (maybe even more elegant) way to get this reliably listing
the files independently of the OS?
I would be very thankful for any hints!
Best,
Arno
\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{graphicx,luacode}
\begin{document}
\catcode`\_12
\begin{luacode}
require "lfs"
for file in lfs.dir(".") do
texio.write_nl(file)
if string.find(file,string.sub(tex.jobname,-7)) then
if string.find(file,".eps") then
if string.find(file,".pdf") then else
tex.print("\\begin{frame}{"..file.."}\\includegraphics{{{"..string.sub(file,1,-5).."}}}\\end{frame}")
end
end
end
end
\end{luacode}
\end{document}
More information about the texhax
mailing list