5

I'm using Windows 7, latest windows update etc.

Recently I decided to start using the minted package in LaTeX. For this, I was redirected to install pygments, which I installed through pip:

I'll run you through quickly what I did (to make sure I didn't do anything wrong):

  1. Installed python 3.4 from this page.
  2. easy_install pip in the windows command prompt.
  3. pip install pygments in command prompt.
  4. I've added the %PYTHONPATH% as well as %PYTHONPATH%\Scripts (which is where pygments operates from I've been led to believe), to the system PATH environment.

I'm typing source code from R into LaTeX, but the releases I could find do not offer the capital R syntax. If I use LaTeX code as such:

\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{R} % Capital R won't function as intended with recent release
c(1,2,5,7,8)
\end{minted}
\end{document}

It won't recognise the capital R argument in minted.

Now, the lower case \begin{minted}{r} works just fine, so I've looked around on how to fix this, and found this answer.

Here it is suggested to adjust the math.py lexer (at %PYTHONPATH%\Lib\site-packages\pygments\lexers) to add an alias 'R' to current aliases. It also suggests to run _mapping.py in the same directory (%PYTHONPATH%\Lib\site-packages\pygments\lexers). Running _mapping.py has two effects:

  1. It completely empties the file, the file size is reduced to 0 bytes and editing it with IDLE confirms an empty file.
  2. It also yields this error message.

Not running _mapping.py won't apply my new alias to pygments. Running it, breaks pygments entirely. The error code is shown below.

I ran the LaTeX code again (with changes and _mapping.py also run), with pdfLaTeX, with arguments: $synctexoption, --enable-write18, -interaction=nonstopmode and $fullname (also in this order), I get the following error in LaTeX:

LaTeX Error: File `temp.out.pyg' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: out.pyg)

Enter file name: 
! Emergency stop.
<read *> 

l.64 \end{minted}^^M

After running _mapping.py on a clean installation even (no changes made to any lexer or anything), I also run into the same problem. I'm uncertain whether the initial changes I made, changed registry values and whatnot, but I'm having serious issues applying this simple change to the pygments lexer.

Euryris
  • 250
  • 2
  • 10

0 Answers0