gpoore / minted

minted is a LaTeX package that provides syntax highlighting using the Pygments library. Highlighted source code can be customized using fancyvrb.
1.73k stars 125 forks source link

xelatex gives duplicate snippets after changing outputdir #298

Open hyjz2018 opened 3 years ago

hyjz2018 commented 3 years ago

after changing the output-directory and outputdir cmd line is

xelatex -shell-escape -output-directory="C:/Users/hy-jz/tmp/tex" demo.tex

demo.tex is like

\documentclass[12pt,openany]{book}
\usepackage[outputdir="C:/Users/hy-jz/tmp/tex"]{minted}
%\usepackage{minted}
% cachedir="C:/Users/hy-jz/tmp/tex"

\newminted{sh}{frame=single}
\begin{document}

\chapter{chap 1 }
text 
\section{sec 1}
\begin{shcode}
#!/bin/bash
echo 1
\end{shcode}

\begin{shcode}
#!/bin/bash
echo 2
\end{shcode}

\begin{minted}{shell}
#!/bin/bash
echo 3
\end{minted}

\begin{minted}{shell}
#!/bin/bash
echo 4
\end{minted}
\end{document}

but demo.pdf shows duplicate snippets: dirchanged

full logs:

This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
(./demo.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(c:/texlive/2020/texmf-dist/tex/latex/base/book.cls
Document Class: book 2019/12/20 v1.4l Standard LaTeX document class
(c:/texlive/2020/texmf-dist/tex/latex/base/bk12.clo))
(c:/texlive/2020/texmf-dist/tex/latex/minted/minted.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2020/texmf-dist/tex/latex/kvoptions/kvoptions.sty
(c:/texlive/2020/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(c:/texlive/2020/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty))
(c:/texlive/2020/texmf-dist/tex/latex/fvextra/fvextra.sty
(c:/texlive/2020/texmf-dist/tex/latex/base/ifthen.sty)
(c:/texlive/2020/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(c:/texlive/2020/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty)
(c:/texlive/2020/texmf-dist/tex/latex/upquote/upquote.sty
(c:/texlive/2020/texmf-dist/tex/latex/base/textcomp.sty))
(c:/texlive/2020/texmf-dist/tex/latex/lineno/lineno.sty))
(c:/texlive/2020/texmf-dist/tex/latex/tools/calc.sty)
(c:/texlive/2020/texmf-dist/tex/latex/tools/shellesc.sty)
(c:/texlive/2020/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(c:/texlive/2020/texmf-dist/tex/latex/pdftexcmds/pdftexcmds.sty
(c:/texlive/2020/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(c:/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty))
(c:/texlive/2020/texmf-dist/tex/generic/catchfile/catchfile.sty
(c:/texlive/2020/texmf-dist/tex/generic/etexcmds/etexcmds.sty))
(c:/texlive/2020/texmf-dist/tex/generic/iftex/ifluatex.sty))
(c:/texlive/2020/texmf-dist/tex/generic/xstring/xstring.sty
(c:/texlive/2020/texmf-dist/tex/generic/xstring/xstring.tex))
(c:/texlive/2020/texmf-dist/tex/latex/framed/framed.sty)
(c:/texlive/2020/texmf-dist/tex/latex/float/float.sty))
(c:/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(c:/texlive/2020/texmf-dist/tex/latex/graphics-def/xetex.def))
C:\Users\hy-jz\Desktop\textest\vscode\shell>set  /p x=C:\Users\hy-jz\AppData\Local\Programs\Python\Python39\Scripts\pygmentize.exe 0<nul: 1>>demo.aex

C:\Users\hy-jz\Desktop\textest\vscode\shell>set  /p x= 0<nul: 1>>demo.aex

C:\Users\hy-jz\Desktop\textest\vscode\shell>set  /p x= 0<nul: 1>>demo.aex
system returned with code 1

(c:/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def)
(C:/Users/hy-jz/tmp/tex/demo.aux)
(c:/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)
Chapter 1.
(c:/Users/hy-jz/tmp/tex/_minted-demo/default-pyg-prefix.pygstyle)
(c:/Users/hy-jz/tmp/tex/_minted-demo/default.pygstyle)
(c:/Users/hy-jz/tmp/tex/_minted-demo/B684ACF90234A48CA82C3CF0A9CB8C9E.pygtex)
(c:/Users/hy-jz/tmp/tex/_minted-demo/B684ACF90234A48CA82C3CF0A9CB8C9E.pygtex)
(c:/Users/hy-jz/tmp/tex/_minted-demo/7619C0272230676D65FA21867CF044A4.pygtex)
(c:/Users/hy-jz/tmp/tex/_minted-demo/7619C0272230676D65FA21867CF044A4.pygtex)
[1] (C:/Users/hy-jz/tmp/tex/demo.aux) )
(see the transcript file for additional information)
Output written on C:/Users/hy-jz/tmp/tex/demo.pdf (1 page).
Transcript written on C:/Users/hy-jz/tmp/tex/demo.log.

while changing to

pdflatex -shell-escape -output-directory="C:/Users/hy-jz/tmp/tex" demo.tex it gives correct result.

xelatex on both windows and linux(Fedora) have the same problem.

muzimuzhi commented 3 years ago

xelatex 3.14159265-2.6-0.999992 works here on macOS.

May not be related: Do the double quotation marks in \usepackage[outputdir="C:/Users/hy-jz/tmp/tex"]{minted} necessary?

hyjz2018 commented 3 years ago

xelatex 3.14159265-2.6-0.999992 works here on macOS.

May not be related: Do the double quotation marks in \usepackage[outputdir="C:/Users/hy-jz/tmp/tex"]{minted} necessary?

The output directory should be specified using an absolute path or a path relative
to the document root directory. Paths should use forward slashes, even under
Windows. Special characters must be escaped, while spaces require quoting and
need the entire hdirectoryi to be wrapped in curly braces {}

from the manual

gpoore commented 3 years ago

@hyjz2018 Try using \usepackage[outputdir=C:/Users/hy-jz/tmp/tex]{minted}, without quotation marks. It looks like pdflatex and xelatex are handling file paths differently, and for some reason xelatex can't process quotation marks. The manual will need to be updated unless there's a way to get things to work uniformly across TeX engines.

hyjz2018 commented 3 years ago

@hyjz2018 Try using \usepackage[outputdir=C:/Users/hy-jz/tmp/tex]{minted}, without quotation marks. It looks like pdflatex and xelatex are handling file paths differently, and for some reason xelatex can't process quotation marks. The manual will need to be updated unless there's a way to get things to work uniformly across TeX engines.

thanks for reply. yes it works without quotation marks.

thomwiggers commented 1 year ago

This also affects LuaLaTeX