1

I have a quite similar problem as this one:

error with LuaLaTeX, lstinputlisting and an extension-less file

Compilation of the MWE below fails with this error message:

! Package Listings Error: File `coucou(.tex)' not found.

The double-braces hack works fine with the plain listings package. However I'm stuck with the same problem using the tcolorbox package and the listings library:

\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{listings}

\begin{document}

coucou

\tcbinputlisting
{
    listing file = {{coucou}} ,
    listing only ,
}

\end{document}

Any idea?

2
  • 2
    On windows the other answer in the old question works for me: \tcbinputlisting { listing file = {testnoext.} , listing only , }. Sep 11 '17 at 16:58
  • I'm using UNIX (NetBSD) with TeX Live 2017 and this doesn't work. Sep 11 '17 at 16:59
3

In cygwin texlive which I think should act in a similar way it works to use

    listing file = {{coucou} } ,

with an extra space

5
  • I would never have thought of such an awful hack. But it just works! Thanks a lot David! Sep 11 '17 at 18:25
  • 1
    @MarcBaudoin I am sure what you meant to say was "thank you for your insightful and elegant code contribution" :-) Sep 11 '17 at 18:32
  • Well of course! Even tough I still don't understand how such an elegant and awful hack can work... Sep 11 '17 at 18:36
  • @MarcBaudoin always in tex if you have an argument that consists of a single {} group the {} is stripped. which is why \fbox{a} is \fbox a it seems listings passes the argument through two levels of macro expansion so needs the braces doubled, but with tcolorbox it is more than 2 and possibly variable number depending on the code path rather than use multiple {{{{coucou}}} and guess the exact number needed I added the space to ensure the argument does not consist just of a brace group, as it is a brace group and a space the group will survive any number of macro expansion steps Sep 11 '17 at 18:40
  • So that's more than juste a hack, awesome! And thanks again because I was really stuck with this. Sep 11 '17 at 18:46
0

With the recent update to the LaTeX kernel, that allows using spaces in file names, the {{file} } hack doesn't work anymore. Is there a solution, other than adding a dummy extension (.whatever) to all my extension-less file names?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.