Open goyalyashpal opened 11 months ago
Hey @goyalyashpal thx for the issue! 🩵
Could you provide a MWE for me to test things out? Also could you share the output when using xelatex
?
provide a MWE share the output when using xelatex
sure! here's full reproduction details:
% ./src/document.tex
\begin{filecontents}[noheader]{./test.psql}
mysql-> select * from thistable;
\end{filecontents}
\documentclass{article}
\usepackage{minted}
\begin{document}
% \inputminted{psql}{test.psql}
% \inputminted{psql -F keywordcase:case=upper}{test.psql} % <- Naked: works in tectonic
\inputminted{"psql -F keywordcase:case=upper"}{test.psql} % <- "Quoted": works in {pdf,xe}latex
\end{document}
So far I can't reproduce on macOS/Linux, maybe @vlasakm has some ideas;)
i.e. for you, tectonic was working on "Quoted" one, and not on naked one; right?
@goyalyashpal so far only \inputminted{psql}{test.psql}
compiles, and both \inputminted{psql -F keywordcase:case=upper}{test.psql}
and \inputminted{"psql -F keywordcase:case=upper"}{test.psql}
seem to fail.
Thanks for the MWE, it got me started.
I think the problem is your usage of \inputminted
. According to the documentation, the syntax is as follows:
\inputminted[⟨options⟩]{⟨language⟩}{⟨filename⟩}
So the first mandatory argument is the language. The fact that it gets literally input into the command line invocation of pygmentize
is just a side effect, you shouldn't be passing any other options there. The minted
package is striving to provide a higher level interface, and it is best to not sidestep it.
But, you want -F keywordcase:case=upper
as part of the command line. So I searched for -F
in the documentation, and found this:
\minted@def@optcl{keywordcase}{-F keywordcase:case}{#1}
It's from the implementation part, and the details are not important, but it essentially tells us that the keywordcase
option is available, and sure enough it is actually documented (in the user part of the documentation) and can take upper
as an argument. To use it, we would do:
\inputminted[keywordcase=upper]{psql}{test.psql}
Full MWE:
\begin{filecontents}[noheader]{./test.psql}
mysql-> select * from thistable;
\end{filecontents}
\documentclass{article}
\usepackage{minted}
\begin{document}
\inputminted[keywordcase=upper]{psql}{test.psql}
\end{document}
In any case the quoted use is wrong, -F keywordcase:case=upper
would be regarded as a single argument by the shell, while two arguments are desired (-F
and keywordcase:case=upper
).
Now, it is actually interesting that the following works:
\begin{minted}{psql -F keywordcase:case=upper}
mysql-> select * from thistable;
\end{minted}
While this does not (neither quoted nor bare) as also reproduced by @Neved4 :
\begin{filecontents}[noheader]{./test.psql}
mysql-> select * from thistable;
\end{filecontents}
\inputminted{psql -F keywordcase:case=upper}{test.psql}
In the first case minted
creates a temporary file itself and the paths work out correctly. In the second case the file resides in the same directory as the input file and under the current rules cannot be found by any program ran with -Z shell-escape
. For this -Z shell-escape-cwd=...
must be used. For example I compiled with tectonic -Z shell-escape -Z shell-escape-cwd=$(pwd) test-1114.tex
to run programs executed by Tectonic in the same directory as the test.psql
file.
The help message actually mentions this exact use case:
$ tectonic -Z help test-1114.tex
Available unstable options:
[...]
-Z shell-escape Enable \write18
-Z shell-escape-cwd Working directory to use for \write18. Use $(pwd) for same behaviour as
most other engines (e.g. for relative paths in \inputminted).
Implies -Z shell-escape
[...]
While this does not (neither quoted nor bare)
i wonder why it worked for me. anyhow, thanks a lot for such digging in the minted documentation.
and also, what's the conclusion? should this behave same as {xe,pdf}latex or how?
While this does not (neither quoted nor bare)
i wonder why it worked for me. anyhow, thanks a lot for such digging in the minted documentation.
It very likely worked for you because you are Windows, whereas I tested only on Linux.
and also, what's the conclusion? should this behave same as {xe,pdf}latex or how?
For me personally, anything that doesn't behave exactly as xelatex is a bug (minus of course the intended differences, like here the need to set -Z shell-escape-cwd
). Here, the behaviour actually differs (at least on Linux) in that the bare variant works in Tectonic, and doesn't in xelatex. IMO we should check why Tectonic behaves differently in this case, and get the same behavior.
IMO we should check why Tectonic behaves differently in this case, and get the same behavior
so, i leave up to you (and others) to decide when to close this issue 😃 thanks a lot for all the work and diagnostics 😇
You uncovered the different behavior and that needs fixing. I suggest to keep the issue open, until we decide whether to do something about it. We could probably start a new issue, but the context is already here.
details
pdflatex
treats the unquotedpsql ...
as a whole as the alias nametectonic
interprets the quoted"psql ..."
aspygmentize -l "psql -F keywordcase:case=upper" -f latex ...
the syntax for command is:
\inputminted[⟨options⟩]{⟨language⟩}{⟨filename⟩}
it seems that:
{<language>}
in quotes, and so, on using a quoted argument, the quotes matches up and the supplied argument essentially becomes naked one.pygmentize -l "<language>" ...
which with quoted \pygmentize -l ""<language>"" ...
discussion
logs
Console logs _(click to expand)_
`tectonic` on quoted