# XeLaTeX and ifplatform/catchfile (loaded by “minted”): Errors on compilation [closed]

FOR THE RECORD

I was unable to test any of the solutions provided, as I changed my main system last year. After that, no more problems arose. I suspect the old system had problems with the hard drive. Either that or the operating system was failing.

I'm using minted along with XeLaTeX, but recently I've run into strange problems. To illustrate what I mean, consider the following MWE (the filename is main.tex):

\documentclass{minimal}

\usepackage{minted}

\begin{document}
\begin{minted}[autogobble]{c}
#include <stdio.h>
int main() {
printf("Hello World!\n");
return 0;
}
\end{minted}
\end{document}


Compiling it with pdflatex --shell-escape generates the document correctly. Not so with xelatex --shell-escape, which outputs the following error:

! Package catchfile Error: File main.w18' not found.

See the catchfile package documentation for explanation.
Type  H <return>  for immediate help.
...

l.93     \CatchFileDef\@tempa{\ip@file}{}


Am I missing something specific to XeLaTeX that makes minted work as expected?

Thanks in advance!

EDIT: I have discovered that logging out or rebooting the computer temporarily solves the problem. I attach general information about the system I'm currently using and the log here for more details:

This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015) (preloaded format=xelatex 2015.8.10)  22 SEP 2015 19:01
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**proba.tex
(./proba.tex
LaTeX2e <2015/01/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/local/texlive/2015/texmf-dist/tex/latex/minted/minted.sty
Package: minted 2015/09/09 v2.1 Yet another Pygments shim for LaTeX

(/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
)))
(/usr/local/texlive/2015/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2008/02/07

Style option: fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)
\FV@CodeLineNo=\count79
\FV@InFile=\read1
\FV@TabBox=\box26
\c@FancyVerbLine=\count80
\FV@StepNumber=\count81
\FV@OutFile=\write3
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count82
\float@exts=\toks15
\float@box=\box27
\@float@everytoks=\toks16
\@floatcapt=\box28
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count83
\calc@Bcount=\count84
\calc@Adimen=\dimen102
\calc@Bdimen=\dimen103
\calc@Askip=\skip41
\calc@Bskip=\skip42
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count85
\calc@Cskip=\skip43
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/ifplatform/ifplatform.sty
Package: ifplatform 2010/10/22 v0.4 Testing for the operating system

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is not detected.
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: pdfTeX >= 1.30 not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode not found.
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/catchfile.sty
Package: catchfile 2011/03/01 v1.6 Catch the contents of a file (HO)
)
runsystem(uname -s > "proba.w18")...executed.

! Package catchfile Error: File proba.w18' not found.

See the catchfile package documentation for explanation.
Type  H <return>  for immediate help.
...

l.93     \CatchFileDef\@tempa{\ip@file}{}

? x

Here is how much of TeX's memory you used:
1071 strings out of 493708
17078 string characters out of 6145891
71205 words of memory out of 5000000
4449 multiletter control sequences out of 15000+600000
3640 words of font info for 14 fonts, out of 8000000 for 9000
1328 hyphenation exceptions out of 8191
37i,0n,19p,243b,18s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.

• Xubuntu 15.04
• TeXLive 2015
• minted 2.1

EDIT 2: I could trick xelatex into thinking main.w18 had been created by executing uname -s > main.w18 beforehand. However, this new error appears:

! Package minted Error: You must have pygmentize' installed to use this package.


Of course, I have pygmentize installed, as I can compile sometimes.

EDIT 3: After fiddling around, it seems XeLaTeX is unable to write files to the filesystem. I tried reinstalling TeXLive with no luck.

## closed as unclear what you're asking by egreg, CarLaTeX, Troy, TeXnician, ZarkoJul 1 '17 at 7:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Adding information about your operating system, TeX installation, and version of minted, plus the complete log, might help. This is coming from ifplatform line 93 (83 in the docs, due to comments), which is using catchfile. Neither of those packages has been changed in years according to CTAN, and the recent releases of minted haven't changed anything that should affect those packages (minted just loads ifplatform to get \ifwindows). So this is strange. – G. Poore Sep 21 '15 at 2:11
• Thanks for the feedback. I'm using Xubuntu 15.04, with TeXLive 2015 and minted 2.1. And about the log, as I started fiddling around, I deleted it and started from scratch again! I have some more information, though: only after rebooting my computer, this MWE started working as expected! Pretty strange, indeed. By the way, I'm having this annoying error once in a while, with no apparent reason. – logo_writer Sep 21 '15 at 5:11
• I tried the example document with an Lubuntu 14.04 virtual machine with a completely updated TeX Live 2015, and couldn't get any errors. Tracking this down will probably be tricky. – G. Poore Sep 21 '15 at 16:30
• It looks like uname is failing sometimes. I have no idea what would cause that. I've added ifplatform and catchfile to your question title. Maybe someone with more Linux knowledge will see that and have some ideas. – G. Poore Sep 23 '15 at 0:51
• I tried a Xubuntu virtual machine and got no problem (but TeX Live is still 2014). The file <filename>.w18 is read in with no issue. – egreg Sep 23 '15 at 9:09

## 1 Answer

Add \usepackage{shellesc} in main.tex before \usepackage{minted}

• A little more explanation would be nice. – Heiko Oberdiek Jul 5 '16 at 17:44
• Thanks for answering! I'll check trying that and get back to you as soon as possible. A little more explanation, as @HeikoOberdiek said, would be nice, though. – logo_writer Jul 7 '16 at 1:29
• Worked for me; I think it works because lualatex --shell-escape doesn't work anymore. – Ayberk Özgür Feb 19 '18 at 18:34