Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

luatex with latex format, how to?

105 views
Skip to first unread message

Stefano Zacchiroli

unread,
Oct 28, 2007, 11:20:53 AM10/28/07
to
I'm using luatex 0.11.2 distributed via TeXLive (the current version
which is available in Debian/unstable). So far I've failed to sport how
to use luatex as a replacement of pdflatex.

I've tried "luatex --fmt=latex input.tex" but apparently luatex is unable
to find the latex format. I've tried to play around with fmtutil to
create the format file but without success. Looking at the strace output
it seems that luatex first tries to find a latex.fmt in some luatex
specific directories and then falls back to
"~/.texmf-var/web2c/pdftex/latex.fmt", but apparently is still unhappy
about that. The overall error message is the usual one:

$ luatex --fmt=latex main.tex
This is luaTeX, Version 3.141592-beta-0.11.2-2007092410 (Web2C 7.5.6)
(Fatal format file error; I'm stymied)

Any hint? So far I haven't yet understood if it's me doing something
wrong or my distribution which is bugged somewhere ...

Many thanks in advance,
Cheers.

--
Stefano Zacchiroli -*- PhD in Computer Science ............... now what?
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
(15:56:48) Zack: e la demo dema ? /\ All one has to do is hit the
(15:57:15) Bac: no, la demo scema \/ right keys at the right time

Michaël Grünewald

unread,
Oct 28, 2007, 5:25:09 PM10/28/07
to
Stefano Zacchiroli <za...@bononia.it> writes:

> ... and then falls back to


> "~/.texmf-var/web2c/pdftex/latex.fmt", but apparently is still unhappy
> about that. The overall error message is the usual one:
>
> $ luatex --fmt=latex main.tex
> This is luaTeX, Version 3.141592-beta-0.11.2-2007092410 (Web2C 7.5.6)
> (Fatal format file error; I'm stymied)

The error message you got is typically encountered when you try to
load a format dumped by TEXVARIANT_1(pdftex) with the
TEXVARIANT_2(luatex). I would suggest you to guess from fmtutil's
config file the recipe used ti dump the latex.fmt, then use the recipe
with luatex's INITEX version and put the dump file in an appropriate
directory.

To learn more about INITEX try initex(1) (for teTeX) or tex(1), see
-ini switch.

To learn more about ``appropriate directory'' try kpsewhich(1) and
look for texmf.cnf.

> Any hint? So far I haven't yet understood if it's me doing something
> wrong or my distribution which is bugged somewhere ...
>
> Many thanks in advance,
> Cheers.

I hope this helps ...
--
Best regards,
Michaël

Stefano Zacchiroli

unread,
Oct 29, 2007, 9:17:34 AM10/29/07
to
On Sun, 28 Oct 2007 22:25:09 +0100, Michaël Grünewald wrote:
>> $ luatex --fmt=latex main.tex
>> This is luaTeX, Version 3.141592-beta-0.11.2-2007092410 (Web2C 7.5.6)
>> (Fatal format file error; I'm stymied)
>
> The error message you got is typically encountered when you try to load
> a format dumped by TEXVARIANT_1(pdftex) with the TEXVARIANT_2(luatex). I

Thanks for your reply! Yep, I've got something like that in my
yesterday's (unsuccessful) googling around for an answer ...
So probably here luatex is in the end falling back to pdftex's format
dump, which is (as expected, I presume) binary incompatible with what
luatex would need.

> would suggest you to guess from fmtutil's config file the recipe used ti
> dump the latex.fmt, then use the recipe with luatex's INITEX version and
> put the dump file in an appropriate directory.

I'm stuck at this. fmtutil in my distro is distributed by texlive-base-
bin. My best guess at what is the configuration file is the following:

$ dpkg -L texlive-base-bin | grep etc | grep fmt
/etc/texmf/fmt.d/10texlive-base-bin.cnf
$ cat /etc/texmf/fmt.d/10texlive-base-bin.cnf | grep -v ^#
etex pdftex language.def -translate-
file=cp227.tcx *etex.ini
pdfetex pdftex language.def -translate-
file=cp227.tcx *pdfetex.ini
mf mf-nowin - -translate-
file=cp227.tcx mf.ini
pdftex pdftex - -translate-file=cp227.tcx
*pdftex.ini
tex tex - tex.ini

... but from its content I fail to understand the recipe (sorry, I've
never been so deep in *tex internals).

From a miktex FAQ I've also found the mention to try "fmtutil --all" but
it hasn't done any better.

Ah, finally, I also see a luatex specific texmf configuration on my
system:

$ cat /etc/texmf/fmt.d/20luatex.cnf | grep -v ^#
luatex luatex - tex.ini

Maybe I've to add something there to enable the dump of the latex format
for luatex? Any hint on this?

> To learn more about INITEX try initex(1) (for teTeX) or tex(1), see -ini
> switch.
>
> To learn more about ``appropriate directory'' try kpsewhich(1) and look
> for texmf.cnf.

Ok, I'll give a step at these pointers ...

TIA,

Michaël Grünewald

unread,
Oct 29, 2007, 2:54:41 PM10/29/07
to
Stefano Zacchiroli <za...@bononia.it> writes:

>> I would suggest you to guess from fmtutil's config file the recipe


>> used ti dump the latex.fmt, then use the recipe with luatex's
>> INITEX version and put the dump file in an appropriate directory.
>
> I'm stuck at this. fmtutil in my distro is distributed by texlive-base-
> bin. My best guess at what is the configuration file is the following:
>
> $ dpkg -L texlive-base-bin | grep etc | grep fmt
> /etc/texmf/fmt.d/10texlive-base-bin.cnf
> $ cat /etc/texmf/fmt.d/10texlive-base-bin.cnf | grep -v ^#
> etex pdftex language.def -translate-
> file=cp227.tcx *etex.ini
> pdfetex pdftex language.def -translate-
> file=cp227.tcx *pdfetex.ini
> mf mf-nowin - -translate-
> file=cp227.tcx mf.ini
> pdftex pdftex - -translate-file=cp227.tcx
> *pdftex.ini
> tex tex - tex.ini

The 10texlive-base-bin.cnf's head give indications for the meaning of
the table.

> From a miktex FAQ I've also found the mention to try "fmtutil --all" but
> it hasn't done any better.
>
> Ah, finally, I also see a luatex specific texmf configuration on my
> system:
>
> $ cat /etc/texmf/fmt.d/20luatex.cnf | grep -v ^#
> luatex luatex - tex.ini

I would try something like

$ luatex -ini latex.ini

If it produces a `latex.fmt' you are done, you just have to put the
dump (latex.fmt) in an appropriate place. To figure out which places
are appropriate, do:

$ kpsewhich -engine luatex -var-value TEXFORMATS

The output should look like:

.:{/home/michael/.texmf-config,
/home/michael/share/texmf,/home/michael/texmf,
!!/usr/local/texlive/2007/texmf-config,
!!/usr/local/texlive/2007/texmf-var,
!!/usr/local/texlive/2007/texmf,
!!/usr/local/texlive/2007/texmf-local
:/usr/local/share/texmf-local,
!!/usr/local/texlive/2007/texmf-dist
}/web2c/{luatex,}//

(I have broken lines for clarity)

This basically mean that luatex (in fact, the KPATHSEA library) will
look for formats in directories

/home/michael/.texmf-config/web2c/luatex
/home/michael/share/texmf/web2c/luatex

and so on. (BTW, I do not have luatex, so my affirmations are a bit
speculative.) You see that first folders in the enumeration are kind
of ``user specific'' while the following are kind of ``system
wide''. You can put the dump file latex.fmt in the directory you like
best[1], then rebuild the KPATHSEA databases with mktexlsr(1)
(KAPTHSEA databases are ls-R files). You can ensure everything has
gone weel so far by checking output of:

$ kpsewhich -progname luatex latex.fmt

It should print the full path to your freshly installed latex.fmt.
In order to use the format, you will use `luatex -fmt latex' instead
of `luatex' as a typesetting engine.


[1] Basically, you have to choose between ``user-specific'' and
``system-wide''. I would suggest you to opt for ``user-specific''
installation. In case your TeX distribution installs a latex.fmt
file for luatex, your local copy will shadow the dostribution's
one. If you got trouble, use kpsewhich(1) to explore your TEXMF
tree. If, for some reason, you prefer to opt for ``system-wide''
installation, you can use

$ kpsewhich -progname luatex tex.fmt

This command should output the location of the `tex.fmt' (the
plain format described by the TeXbook) used by luatex. Beware that
if you put your custom latex.fmt here, it can be erased or
overwritten during administration tasks (e.g. reinstall or
update).

> Maybe I've to add something there to enable the dump of the latex format
> for luatex? Any hint on this?

Maybe the following line will do it:

lualatex luatex - latex.ini

You will then have to add a record to your texmf.cnf file, duplicate
the TEXINPUTS.luatex entry to TEXINPUTS.lualatex and let its value
look like an intelligent mixture of TEXINPUTS.latex and
TEXINPUTS.luatex. (In order to use a custom copy of texmf.cnf, you
have to set your TEXMFCNF environement variable to the directory
containing your custom copy.)

As a final word, please note that editing manually the *.cnf files may
not be the recommended way to update them, depending of your
distribution (the /etc/texmf/fmt.d/20luatex.cnf names let me think
that fmtutil.cnf is automatically generated, so your manual changes to
this file are exposed to automatic deletion). To determine the
recommended way to update these files, trust your distribution's
documentation.

Hope this helps. :)
--
Best wishes,
Michaël

Stefano Zacchiroli

unread,
Oct 30, 2007, 4:16:57 AM10/30/07
to
On Mon, 29 Oct 2007 19:54:41 +0100, Michaël Grünewald wrote:
> The 10texlive-base-bin.cnf's head give indications for the meaning of
> the table.

Yep, right, but I think I'm missing the basis to understand some of the
terminology used there ... Anyhow:



> I would try something like
>
> $ luatex -ini latex.ini
>
> If it produces a `latex.fmt' you are done, you just have to put the dump
> (latex.fmt) in an appropriate place. To figure out which places are
> appropriate, do:

That's worked as a charm!

> This basically mean that luatex (in fact, the KPATHSEA library) will
> look for formats in directories

I went for ~/.texmf-var/web2c/luatex/ which I had already there, but
which was missing latex.fmt. (For the sake of completeness and for a
question of mine later on: that dir previously contained two formats,
together with their .log files, namely luatex.fmt and pdflatex.fmt.)

After doing this I was able to run "luatex -fmt latex foo.tex" ... and it
worked properly \o/ !!!

> You
> can put the dump file latex.fmt in the directory you like best[1], then
> rebuild the KPATHSEA databases with mktexlsr(1) (KAPTHSEA databases are
> ls-R files). You can ensure everything has gone weel so far by checking
> output of:

I did not need this step, maybe on my distro the KPATHSEA is updated
lazily or something like that? Any other explaination of how could it
work without performing it?

> $ kpsewhich -progname luatex latex.fmt
>
> It should print the full path to your freshly installed latex.fmt. In

It does, cool.

> order to use the format, you will use `luatex -fmt latex' instead of
> `luatex' as a typesetting engine.

And here is my bonus question :) Being luatex a fork/continuation of
pdftex, I expected it to produce .pdf stuff per default, since that is
what pdftex does, doesn't it? So how come that running "luatex -fmt latex
foo.tex" I obtain a foo.dvi instead of a foo.pdf as I expected?

AFAIU the format concept we were discussing above explains how to
interpret a source file in some tex lingo (plaintex, latex, context, ...)
while the engine decide what to output, right? So ... I'm puzzled.

> [1] Basically, you have to choose between ``user-specific'' and
> ``system-wide''. I would suggest you to opt for ``user-specific''
> installation. In case your TeX distribution installs a latex.fmt
> file for luatex, your local copy will shadow the dostribution's one.

My distribution doesn't ship a latex.fmt file for luatex, I can only see
a "luatex.fmt" format file shipped with luatex. I think this is a bug, or
maybe the distributors do not want to encourage yet the use of luatex
(but then why is it there as a part of TeXlive in the first place?)

> Maybe the following line will do it:
>
> lualatex luatex - latex.ini

Thanks, I'll try this. But here what is lualatex? I don't have any
executable like this on my system. Is there any argv0 trick which luatex
will use and hence have I to symlink lualatex to luatex or something
similar later on?

> As a final word, please note that editing manually the *.cnf files may
> not be the recommended way to update them, depending of your
> distribution (the /etc/texmf/fmt.d/20luatex.cnf names let me think that
> fmtutil.cnf is automatically generated, so your manual changes to this

Indeed it is, but as a common practice in Debian systems, snippets of
configuration files available in .d directories are concatenated together
to generate fmtutil.cnf. Given that the snippets are under /etc/ they are
supposed to be customized and there is a command to regenerate the final
fmtutil.cnf file (which resides in /var) after any customization. Upon
texlive upgrades the Debian packaging system will ask the user what she
wants to do with her customizations wrt package maintainer customizations.

Many thanks for your help,
it is somehow working now :-)

Michaël Grünewald

unread,
Oct 30, 2007, 9:28:11 AM10/30/07
to
Stefano Zacchiroli <za...@bononia.it> writes:

> On Mon, 29 Oct 2007 19:54:41 +0100, Michaël Grünewald wrote:

>> You can put the dump file latex.fmt in the directory you like
>> best[1], then rebuild the KPATHSEA databases with mktexlsr(1)
>> (KAPTHSEA databases are ls-R files). You can ensure everything has
>> gone weel so far by checking output of:
>
> I did not need this step, maybe on my distro the KPATHSEA is updated
> lazily or something like that? Any other explaination of how could it
> work without performing it?

In fact, this has to do with the !! and // sitting in the value of
TEXFORMATS. If the file KPATHSEA looks for is not found in ls-R
databases, it may also be searched in the filesystem (see head of
texmf.cnf for explanations).

> And here is my bonus question :) Being luatex a fork/continuation of
> pdftex, I expected it to produce .pdf stuff per default, since that is
> what pdftex does, doesn't it? So how come that running "luatex -fmt latex
> foo.tex" I obtain a foo.dvi instead of a foo.pdf as I expected?
>
> AFAIU the format concept we were discussing above explains how to
> interpret a source file in some tex lingo (plaintex, latex, context, ...)
> while the engine decide what to output, right? So ... I'm puzzled.

This is not totally true, since PDFTEX will output a DVI file if you
do not explicitely ask for PDF output (see PDFTEX manual).

BTW, did you check that your pdlaftex is not actually luatex? You told
that web2c/luatex had a pdflatex.fmt file in it! If pdflatex is not
luatex, you can produce an adequate dump by using pdflatex.ini instead
of latex.ini.

> My distribution doesn't ship a latex.fmt file for luatex, I can only see
> a "luatex.fmt" format file shipped with luatex. I think this is a bug, or
> maybe the distributors do not want to encourage yet the use of luatex
> (but then why is it there as a part of TeXlive in the first place?)

Although I have no knowledge about this, I guess that experimenting
with luatex is encouraged, and providing something usable as a main
typesetting engine is not a short term goal for luatex developpers (s?).
I may be wrong, however.

>> Maybe the following line will do it:
>>
>> lualatex luatex - latex.ini
>

> Thanks, I'll try this. But here what is lualatex? I don't have any
> executable like this on my system. Is there any argv0 trick which luatex
> will use and hence have I to symlink lualatex to luatex or something
> similar later on?

Commonly available TeX implementations use the program name to guess
the format that should be loaded on start. Unfortunately, I do not
know how FMTUTIL is working, so I am unable to give you hints there.

> Indeed it is, but as a common practice in Debian systems, snippets of
> configuration files available in .d directories are concatenated together
> to generate fmtutil.cnf. Given that the snippets are under /etc/ they are
> supposed to be customized and there is a command to regenerate the final
> fmtutil.cnf file (which resides in /var) after any customization. Upon
> texlive upgrades the Debian packaging system will ask the user what she
> wants to do with her customizations wrt package maintainer
> customizations.

Thank you for the information. I wonder why using numeric prefix for
sorting instead of symbolic sorting information inside files (like
NetBSD's rcorder(1) do to order rc files on system startup). Numeric
prefix for sorting is quite cumbersome isn'it? (It makes me remind of
my first BASIC program :) )

> Many thanks for your help,
> it is somehow working now :-)

My pleaseure.

> Stefano Zacchiroli -*- PhD in Computer Science ............... now what?

^^^^^^^^^
That's the question!
--
All the best,
Michaël

Stefano Zacchiroli

unread,
Oct 31, 2007, 4:54:42 AM10/31/07
to
On Tue, 30 Oct 2007 14:28:11 +0100, Michaël Grünewald wrote:
> TEXFORMATS. If the file KPATHSEA looks for is not found in ls-R
> databases, it may also be searched in the filesystem (see head of
> texmf.cnf for explanations).

Thanks for this pointer.

> This is not totally true, since PDFTEX will output a DVI file if you do
> not explicitely ask for PDF output (see PDFTEX manual).

Right, /me has just finished reading the manpage. However the manual
says that there exists a DVI mode and a PDF mode, and that (quoting)
"The typical use of pdfTeX is with a pregenerated formats for which PDF
output has been enabled." From this I guess that PDF mode should be
enabled at format dump time, even because I don't see any other option
to explicitly enable PDF mode at typesetting time ...

> BTW, did you check that your pdlaftex is not actually luatex? You told
> that web2c/luatex had a pdflatex.fmt file in it!

They are different:

$ md5sum `which pdflatex` `which luatex`
b42d9216293e567ea2276980a5942c18 /usr/bin/pdflatex
8258b4e6a7b532757c86b7a2230a181a /usr/bin/luatex

> If pdflatex is not luatex, you can produce an adequate dump by using
> pdflatex.ini instead of latex.ini.

Ok, got it. Whether to output PDF or DVI is part of the format. So doing
"luatex -ini pdflatex" as you suggested, and then typesetting as "luatex
-fmt pdflatex foo.tex" it does work and finally produces a .pdf.

Eureka!

> Thank you for the information. I wonder why using numeric prefix for
> sorting instead of symbolic sorting information inside files (like
> NetBSD's rcorder(1) do to order rc files on system startup). Numeric
> prefix for sorting is quite cumbersome isn'it? (It makes me remind of
> my first BASIC program :) )

:) I guess is more a common practice than everything else. For instance
it is used by sysv-like bootstrap procedures in *nix systems, or by
popular tools like run-parts to execute in some filesystem changeable
order hook scripts.

>> Stefano Zacchiroli -*- PhD in Computer Science ............... now
>> what?
>
^^^^^^^^^
> That's the question!

:)

PS after all this trouble, now I discover that even the simplest example
available from the luatex website is not working :( bah. /me is a bit
discouraged ...

--

Stefano Zacchiroli -*- PhD in Computer Science ............... now what?

Michaël Grünewald

unread,
Oct 31, 2007, 9:12:31 AM10/31/07
to
Stefano Zacchiroli <za...@bononia.it> writes:

> On Tue, 30 Oct 2007 14:28:11 +0100, Michaël Grünewald wrote:
>> This is not totally true, since PDFTEX will output a DVI file if you do
>> not explicitely ask for PDF output (see PDFTEX manual).
>
> Right, /me has just finished reading the manpage. However the manual
> says that there exists a DVI mode and a PDF mode, and that (quoting)
> "The typical use of pdfTeX is with a pregenerated formats for which PDF
> output has been enabled." From this I guess that PDF mode should be
> enabled at format dump time, even because I don't see any other option
> to explicitly enable PDF mode at typesetting time ...

There is also an actual PDTEX manual (more than a manpage), you can
find it under

http://www.tug.org/texlive/Contents/live/texmf/doc/pdftex/manual

--
Best wishes,
Michaël

0 new messages