lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Nov 29, 2010 at 10:06:43PM +0200, Marc Balmer wrote:
> Am 29.11.10 21:01, schrieb Lorenzo Donati:
> > 
> > I'd like to create good-looking PDF documents using data obtained from
> > Lua (parsing and processing various data sources).
> > 
...
> > I'd like something which is not too difficult to learn (I don't know PDF
> > format, but I gathered that it wouldn't be easily generated from Lua).
> > 
...
> > 
> > I hope there is a better and simpler alternative.
> > Ideally all tools should be amenable to be carried away on a portable
> > HD

All these conflicting requirements: good-looking but easy to learn,
better but simpler ...

I think you have two options.
1. If you already have good skills/software for producing HTML files,
there is a tool called wkhtmltopdf that makes a PDF directly from the
HTML, much nicer than any browser does.
2. But in the long run it is better to do as Marc says:
> 
> LuaTeX is your friend.  Or just use Lua to produce LaTeX markup 
>
LuaTeX is TeX with Lua 5.1 inside it.  In LuaLaTeX your complete
TeX file looks like this:

\documentclass{article}
\begin{document}
\directlua{
    dofile('myfile.lua') -- generate your data and put its TeX code
                         -- into an array of strings called 'mytexcode'
    tex.print(mytexcode)
}
\end{document}

Inside the \directlua statement you can use all of Lua plus some extra
packages.  Each element of 'mytexcode' will be treated as a line of
TeX.

To learn LuaTeX (or its variation LuaLaTeX) you need know two things:
Lua and TeX.  You're halfway there already!

As for fitting onto a portable HD, heck, what sort of restriction is
that?  I have a Verbatim that fits into my shirt pocket, plugs into 
a USB port with no other power supply, and stores 250GB.  

Dirk


Dirk