Text Formattingminted: error when numbering lines

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
sasasamamama
Posts: 8
Joined: Mon Dec 13, 2010 9:20 pm

minted: error when numbering lines

Post by sasasamamama »

Hi!

I'm having a problem with the minted package. When I try to add line numbering to the minted command, I get the following error:

Code: Select all

! Package keyval Error: stepnumber undefined.

See the keyval package documentation for explanation.
Type H <return> for immediate help.
 ...
l.1 ...,numbers=left,firstnumber=1,stepnumber=1 ]
Minimal example:

Code: Select all

\documentclass[12pt]{article}
\usepackage{minted}

\begin{document}

\inputminted[linenos=true]{java}{file_with_code}

\end{document}
Without the lineos=true property, it works fine.

Does someone know how to fix that?

Thank you in advance!
Last edited by sasasamamama on Sun Jun 05, 2011 12:08 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

minted: error when numbering lines

Post by localghost »

Provide a minimal example that is compilable as provided for everybody else and reproduces the undesired behaviour clearly. Otherwise the problem is not comprehensible (as you can see from missing anwers).


Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
sasasamamama
Posts: 8
Joined: Mon Dec 13, 2010 9:20 pm

minted: error when numbering lines

Post by sasasamamama »

minex.tex:

Code: Select all

\documentclass[12pt]{article}
\usepackage{minted}

\begin{document}

\inputminted[linenos=true]{java}{file_with_code.java}

\end{document}
file_with_code.java:

Code: Select all

class SomeClass{}
The log file is attached.

This example compiles, but produces the error (see previous post or log file). The line numbering is being added, but begins with 2 (see PDF output).
Attachments
minex.pdf
(20.18 KiB) Downloaded 264 times
minex.log
(6.18 KiB) Downloaded 310 times
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

minted: error when numbering lines

Post by localghost »

Seems that you've got a development version of the minted package (v1.7 dated 2010/03/16). It works flawlessly with v1.6 (dated 2010/01/27) officially available on CTAN.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
klmr
Posts: 1
Joined: Tue May 31, 2011 10:44 am

minted: error when numbering lines

Post by klmr »

localghost wrote:Seems that you've got a development version of the minted package (v1.7 dated 2010/03/16). It works flawlessly with v1.6 (dated 2010/01/27) officially available on CTAN.
Actually, I strongly recommend the development version since the last release contains a bug which effectively prevents it from working properly. I’m completely baffled by this bug. I’ve just diff’d the two versions and there should not be any change that concerns the displaying of line numbers.

Furthermore, this should work. The error message is wrong: this key does exist (in the \Verbatim environment, where it’s used).

If everything else fails, try putting the following lines immediately after the loading of the minted package, they effectively rewind one of the changes from the 1.7 version (not that I think this will help):

Code: Select all

\makeatletter
\define@booleankey{minted@opt}{linenos}
  {\@namedef{minted@opt@linenos}{-P linenos}}
  {\@namedef{minted@opt@linenos}{}}}
\makeatother
However, I’m starting to believe the issue is caused by the fact that both pygments and minted independently try to define a `stepnumber` key. I’m not yet sure how this interferes.

[I’m the maintainer of the minted package.]
sasasamamama
Posts: 8
Joined: Mon Dec 13, 2010 9:20 pm

Re: minted: error when numbering lines

Post by sasasamamama »

Thank you for your answers. klmr, I have tried adding your code, but it produces the same error.
sasasamamama
Posts: 8
Joined: Mon Dec 13, 2010 9:20 pm

Re: minted: error when numbering lines

Post by sasasamamama »

Oh, great, I reinstalled the package and now it works. Thank you so much!
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

minted: error when numbering lines

Post by localghost »

klmr wrote:Actually, I strongly recommend the development version since the last release contains a bug which effectively prevents it from working properly. I’m completely baffled by this bug. I’ve just diff’d the two versions and there should not be any change that concerns the displaying of line numbers. […]
So, what keeps you from uploading it to CTAN?
klmr wrote:[…] However, I’m starting to believe the issue is caused by the fact that both pygments and minted independently try to define a `stepnumber` key. I’m not yet sure how this interferes. […]
Could it then be related to the Python version installed? I have 2.6.6 on Wind0ws and 2.7 on Linux.


Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply