minted icon indicating copy to clipboard operation
minted copied to clipboard

Mint fails when file name contains with '#' on macOS

Open Cee opened this issue 6 years ago • 4 comments

The name of my tex file is Problem Set #1.tex.

And when compiling this tex file, it comes an error saying that ifplatform.sty:93: ! Package catchfile Error: File 'Problem Set #1.w18' not found.

Ref: https://github.com/gpoore/minted/issues/85

Cee avatar Sep 15 '17 04:09 Cee

Have you tried renaming the file to Problem Set 1.tex to make sure that the # is the problem? I don't have access to an OS X machine, but a # in the filename is working fine for me under Windows and Linux. What TeX distribution are you using? How old is your installation?

gpoore avatar Sep 15 '17 11:09 gpoore

Yes. I've tried to rename this file to Problem Set 1.tex or other filename exclude symbol # and all of these filename will not cause any build error. When it comes to having the symbol # in the filename, the compile process crashes.

And finding that there are two different error behaviors.

  1. filename = #.tex: ./#.tex:140: Package minted Error: You must have 'pygmentize' installed to use this package.
  2. filename = Problem Set #1.tex: /usr/local/texlive/2017/texmf-dist/tex/latex/ifplatform/ifplatform.sty:93: Package catchfile Error: File '"Problem Set #1".w18' not found.

My LaTeX environment, and TexLive is newly installed (it should be the latest version):

$ /usr/local/texlive/2017/bin/x86_64-darwin/pdflatex --version                                                                                                                                                                                                       [10:16:46]
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.29; using libpng 1.6.29
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 3.04

Cee avatar Sep 15 '17 14:09 Cee

I've uploaded the smallest TeX project that would meet this error under macOS.

Test.zip

Cee avatar Sep 15 '17 15:09 Cee

The file name #.tex always gives fatal errors under Linux. The file name file #1.tex was actually giving errors, but compiling could still complete under Linux.

This is due to a combination of issues. The best option for now is avoiding # in file names.

  • If the file name starts with #, the test for pygmentize fails, and pygmentize itself will fail. This could be fixed by further sanitization of \minted@jobname.
  • If the file name contains # but doesn't start with #, and also contains a space, then the catchfile package appears to be running incorrectly quoted system commands. It is possible to work around this by redefining \jobname while catchfile is being used to detect the operating system.

The changes required to get # working involve a number of changes in how minted works, and I will have to think through all the implications. Because of that, it probably won't be possible to get # working in the near future.

gpoore avatar Sep 16 '17 15:09 gpoore