0

When using minted on Linux, I get the following error:

./out/master.out.pyg:2: Undefined control sequence.
\PYG #1#2->\FV@PYG 
                   {#1}{\FancyVerbBreakStart #2\FancyVerbBreakStop }
l.2 ... \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np}

The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

PDF output is also messed up:

sadge

I tried looking at this question here, and after following the instructions to use cache=false, I still have the same error - the symbols are out of place and syntax highlighting doesn't work. This was not a problem on WSL on my current and previous computers, but once I switched to Linux, this appeared.

If anyone knows how to fix this, it would be very helpful. I would hate to have to go back to lstlistings package as it is a lot more of a hassle to work with.

Revise
  • 365
  • 1
    Please post a complete MWE and log file. Linux problems often stem from outdated package versions. – schtandard Aug 19 '22 at 08:12
  • For the first part, will do. However, an outdated package version would not really make sense - I was using TeX Live 2019 on my old computer (or whichever version sudo apt install texlive got me) and previous WSL and minted worked just fine, whereas I installed TeX Live 2022 on this computer. Unless you mean other packages that may be tangentially related to Linux? – Revise Aug 19 '22 at 08:15
  • 2
    No, I just mean that apt will often install old texlive versions. Another possibility is installed packages being shadowed by older ones somewhere on your machine. The log file will tell us if that's the case. – schtandard Aug 19 '22 at 08:18
  • 1
    I assume you already tried deleting the _minted* directory, as suggested in the answer to the linked question? – schtandard Aug 19 '22 at 08:19
  • Yup, I did. I was creating a MWE but it seems like it works fine there, but it does not work with my preamble attached. My preamble did not change (from the time I was using WSL) though, so I am confused. – Revise Aug 19 '22 at 08:23
  • Then you haven't found an MWE yet. ;-) Try starting with the whole preamble and removing things piece by piece, deleting the _minted* file and compiling every time. (Alternatively you can start with an empty preamble and build it up.) That way you should find the relevant bits. – schtandard Aug 19 '22 at 08:40
  • Yup, that's what I'm doing right now. I think it might have something to do with the theme I set. Will update the results as I go depending on how annoying Neovim decides to be with yanking and pasting. – Revise Aug 19 '22 at 08:42

1 Answers1

1

After way too much fussing with the preamble, it turns out it wasn't an error with minted but rather as I had thought - perhaps something with the style. And indeed, a capitalization error in the Pygments style caused the problem.

I tested my preamble line by line and the strange symbols appeared whenever I set the style and promptly disappeared otherwise. Testing with echo hello | pygmentize -P style=style also made it clear that this was the problem.

In my case, I failed to name my Pygments style "stylename" : "stylename::ClassNameStyle".

That being said, I believe minted should fall back to the regular style if there is a problem with the given style (e.g. not being found), which is a question for another day.

Revise
  • 365