You are not logged in.

#1 2015-04-09 16:28:19

muon
Member
Registered: 2013-03-20
Posts: 26

LaTeX and minted errors

I'm not sure exactly when this stopped working for me, but I'm having trouble with the minted package in LaTeX. I have installed the texlive-most group, which includes
texlive-core 2014.36709-1
texlive-latexextra 2014.36706-1

as well as
python2-pygments 2.0.2-2
python-pygments 2.0.2-2

Sample document, test.tex

\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{python}
import os
\end{minted}
\end{document}

When I try to compile with

$ pdflatex -shell-escape test.tex

I get

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

When I install pygmentize 2.0.2-2, the file compiles, but formated source code is corrupted, and looks like

k+knimport n+nnos

Possibly related: https://bbs.archlinux.org/viewtopic.php?id=121397
However, I don't think I have the same syntax issues.

Offline

#2 2015-04-09 17:19:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: LaTeX and minted errors

Try this (note the space before "import os":

\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{python}
 import os
\end{minted}
\end{document}

I can confirm your error here, and I don't know anything about minted (this was my first use of it - "oh nice") so I don't know if this is documented somewhere, but after trying some samples available I quickly noticed that if the full code block is indented by at least one space, everything works, if that space is removed, everything (even otherwise working examples) fail in the same way yours does.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2015-04-09 18:43:03

muon
Member
Registered: 2013-03-20
Posts: 26

Re: LaTeX and minted errors

Curious. Thanks for the suggestion, but I still get the same output (but shifted to the right by a space).

Offline

#4 2015-04-09 18:48:23

muon
Member
Registered: 2013-03-20
Posts: 26

Re: LaTeX and minted errors

Also, by the way, looking at the documentation (minimal complete example pg 7), it doesn't look to me like they always indent the block.

Offline

#5 2015-04-09 21:28:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: LaTeX and minted errors

Odd.  I do consistently get the same errors as you with any sample documents if I don't indent, but they all work fine if I do.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2015-04-09 21:56:16

muon
Member
Registered: 2013-03-20
Posts: 26

Re: LaTeX and minted errors

So you get the correct results only when you have all three of python-pygments, python2-pygments, and pygmentize installed? Do you have suggestions for how to determine what may be different, or perhaps I should go upstream?

Offline

#7 2015-04-09 22:03:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: LaTeX and minted errors

I never had python2-pygments - but pygmentize is required for this to work at all and python-pygments is a dependency.  If you don't have those installed then this should not be expected to work.  Having the required packages is a given.

The only issue seems to be even with the right packages installed, this fails (for me) if there is not a leading blank space/indent of the code but succeeds if there is.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2015-04-09 22:20:09

muon
Member
Registered: 2013-03-20
Posts: 26

Re: LaTeX and minted errors

Thanks for the clarification. As extra information, I just downgraded the texlive packages to texlive-core-2014.34872-1 and texlive-latexextras-2014.34865-1, and with the older packages, the test document works for me with and without the leading blank space/indent (still using the 2.0.2-2 versions of pygmentize and python-pygments).

Offline

#9 2015-04-19 08:18:19

Factionwars
Member
Registered: 2015-01-18
Posts: 3

Re: LaTeX and minted errors

I can confirm having the same error. Seems like it became broken this month.

Offline

#10 2015-04-27 19:31:29

Nimlot
Member
Registered: 2013-02-12
Posts: 24

Re: LaTeX and minted errors

I can confirm having the error as well.

Pygmentize is no longer in python2-pygments, and was never included in python-pygments.

Offline

#11 2015-04-27 19:56:24

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: LaTeX and minted errors

Pygmentize is no longer in python2-pygments, and was never included in python-pygments.

it has been recently moved to its own package: pygmentize

oddly enough, I've been using minted a lot the last months and never had any problems - the example in OP (without an extra space) compiles fine here with the latest packages.

Last edited by hokasch (2015-04-27 20:10:01)

Offline

#12 2015-04-27 21:28:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: LaTeX and minted errors

It works fine here as well now.  It looks like something was fixed.  Muon, can you confirm?  If so, you could mark the thread as solved.  If not, are there any new or different errors?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#13 2015-11-18 08:00:35

goodmami
Member
Registered: 2013-01-14
Posts: 7

Re: LaTeX and minted errors

I had the same problem. I think those spurious k+kn and n+n bits in the code are the color codes for pygmentize, but somehow the \PY latex command wasn't defined (or something) so they just came out as text.

In any case, I tried updating python-pygments, pygmentize, several texlive packages, but nothing worked until I updated my copy of minted.sty (I just got it from the GitHub page (https://github.com/gpoore/minted/blob/m … minted.sty) and moved it to /usr/share/texmf-dist/tex/latex/minted/minted.sty, which is where my original copy was). Everything worked well with the new version of minted.sty. No need for initial spaces or anything.

Offline

Board footer

Powered by FluxBB