[luatex] \openin and files without extensions

Vladimir Lomov lomov.vl at gmail.com
Thu May 2 03:46:25 CEST 2013


Hello,
** Ulrike Fischer [2013-05-01 18:50:01 +0200]:

> In february there was a discussion about how \input handles files
> without extension
> (http://tug.org/mailman/htdig/luatex/2013-February/004042.html).

> The problem popped up again in a tex.sx question today
> http://tex.stackexchange.com/questions/111747/error-with-lualatex-lstinputlisting-and-an-extension-less-file

> So I tried to identify the source of the problem.

> When using \input{foo} LaTeX checks for the existence of a file with
> \openin and \ifeof and this test fails for files without extension.
> On the other side the primitive \input foo works without problem. 


> \openin0 makefile % makefile exist in the folder
>   \ifeof0         % gives: don't exist  
>    don't exist
>   \else
>    exist
>   \fi
> \closein0

> \openin0 {makefile} %with braces
>   \ifeof0        % gives: exist
>    don't exist
>   \else
>    exist
>   \fi
> \closein0

> \input makefile %works

> \openin0 test-1 % test-1.tex exists
>   \ifeof0       % gives: exist
>    don't exist
>   \else
>    exist
>   \fi
> \closein0

> \input test-1   %works
> \bye


> I tested with
> LuaTeX, Version beta-0.70.2-2012080612 (TeX Live 2012/W32TeX)
> and Version beta-0.77.0-2013041621 (rev 4633) (Context)

> Is this behaviour of \openin a bug or intended?

I'm not TeX expert but I did some extended tests based on your example in
TeX Live 2012 (Linux x86_64) using pdftex, xetex and luatex engines.

ex1: full copy of Ulrike example;
ex2: my dummy example, here I use macros for file names;
ex3: slightly modified version of ex1;

Results:

ex1
===

   block / engine   |    pdftex   |   xetex     | luatex
--------------------+-------------+-------------+-------------
\openin0 makefile   |    exist    |     exist   | don't exist
\openin0 {makefile} | don't exist | don't exist |    exist
\openin0 test-1     |    exist    |     exist   |    exist
--------------------+-------------+-------------+-------------

File 'makefile' included into document in all cases, as well as
'test-1.tex'.

ex2
===

Here I define two macros for file names: '\flI' and '\flII'.

 block / engine  |    pdftex   |   xetex     | luatex
-----------------+-------------+-------------+---------
\openin0 \flI    |    exist    |      -      |  exist
\openin0 {\flI}  | don't exist | don't exist |  exist
\openin0 \flII   |    exist    |      -      |  exist
-----------------+-------------+-------------+---------

xetex don't show message for first and third '\ifeof0' but still
includes both files.

ex3
===

This test file is essential the same as ex1 but I added some test to
'if' branches to distinguish all three blocks.

   block / engine   |    pdftex   |   xetex     | luatex
--------------------+-------------+-------------+-------------
\openin0 makefile   |    exist    |     exist   | don't exist
\openin0 {makefile} | don't exist | don't exist |    exist
\openin0 test-1     |    exist    |     exist   |    exist
--------------------+-------------+-------------+-------------

As I told I'm not TeX expert but from my PoV enclosing file name in {}
or defining a macro for it is fine and works in all cases.

I attach test TeX files and corresponding PDF files.

---
WBR, Vladimir Lomov

-- 
OS/2 must die!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openin-test-files.tar.xz
Type: application/octet-stream
Size: 38236 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20130502/47f8972e/attachment-0001.obj>


More information about the luatex mailing list