On 08/22/2017 02:52 AM, Guenter Milde wrote: > On 2017-08-21, Dr Eberhard Lisse wrote: >> Hi, >> would it be unexpected that an included listing file without extension, >> ie something like >> filename >> would throw an error that filename.tex is not found? > At least, I am not surprised. > > I would expect this as a LaTeX error when the file "filename" is not present. > LaTeX tries to append the standard extension for a given context. > If "filename.tex" is searched even if "filename" exists (at the given path), > then this is not good for included listings. The listings package > documentation should show countermeasures (if not, this is a listings > package documentation bug) and LyX should work around this (as actually, > there should be no standard extension for listings).
The relevant code from listings.sty is: \newcommand\lst@inputlisting[2][]{% \endgroup \def\lst@set{#1}% \IfFileExists{\lst@inputpath#2}% {\expandafter\lst@InputListing\expandafter{\lst@inputpath#2}}% {\filename@parse{\lst@inputpath#2}% \edef\reserved@a{\noexpand\lst@MissingFileError {\filename@area\filename@base}% %%%% LOOK HERE! {\ifx\filename@ext\relax tex\else\filename@ext\fi}}%%%%% LOOK HERE! \reserved@a}% \lst@doendpe \@newlistfalse \ignorespaces} If I'm reading this right: If it can't find the file actually given, then it tries adding "tex", if the file had no extension. (Actually, you need also to look at \lst@MissingFileError to see this, but I won't copy that.) Richard