37

I'm currently using ubuntu13.10, TeXlive and Texmaker editor, and I found out that minted package is the best way to get source code highlighting on LaTeX.

So I installed python-pygments via terminal (sudo apt-get install python-pygments), it actually installed correctly, but when I start Texmaker and type \usepackage{minted} the log displays:

! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

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

and it gives me this error as well:

LaTeX Error: File `mytexts.pyg' not found.

I'd appreciate some help on that, I'm learning C atm and minted would be really helpful.

EDIT:

Mmm, I chek out tm settings>fast comp. and I have selected latex + dvips + ps2pdf + see pdf option, so I should add the -shell-escape line to dvips at settings>commands or to ps2pdf or both of them?

That's what I'm not really getting, where I should add the shell escape lines...

(python-pigments + texlive are already installed)

thanks

1
  • 1
    The first error message is quite clear. You need to add -shell-escape to the command line options for the compiler in your TeXmaker settings. Commented Nov 21, 2013 at 20:58

3 Answers 3

31

with running apt-cache search pygments you'll get the needed packages:

voss@ubuntu:~$ apt-cache search pygments
python-pygments - syntax highlighting package written in Python
python-sphinx - documentation generator for Python projects (implemented in Python 2)
python3-pygments - syntax highlighting package written in Python 3
python3-sphinx - documentation generator for Python projects (implemented in Python 3)
texlive-latex-extra - TeX Live: LaTeX additional packages
python-django-debug-toolbar - Embedded debugging toolbar for Django projects
ruby-albino - Ruby wrapper for pygmentize
trac-wikiprint - Make Trac wiki pages printable, exporting to PDF or printable HTML

Install the package(s) with

voss@ubuntu:~$ sudo apt-get install python-pygments

and maybe that you also need to install the texlive package. Anf when everything is installed you need the pdflatex --shell-escape <file> command

2
  • 4
    In Ubuntu 19.10, I needed python3-pygments
    – Rasmus
    Commented May 21, 2020 at 6:49
  • @Rasmus I found the same for Ubuntu 20.04 LTS.
    – Galen
    Commented Mar 6, 2022 at 22:18
11

If you are using TeXStudio under Ubuntu or other GNU/Linux distribution, the answer is simple,

  1. Install Pygments: sudo easy_install Pygments (make sure you have python installed)

  2. In TeXStudio Options > Configure TeXStudio > Completion > (select minted related packages)[minted.cwl etc] and press OK. If you can't find minted there, install it by yourseelf: go to http://code.google.com/p/minted/, download minted, unzip, run latex minted.ins and it will generate minted.sty; move the sty file to your desired location

  3. After having installed/found minted, in the same TeXStudio window go to Commands and put -shell-escape in the PdfLaTeX/LaTeX compilation commands.

0
8

I recently had the same problem in ubuntu 20.04 and solved it by installing Pygments (as rasmus say)

sudo apt-get install python3-pygments

And, of course, adding -shell-escape in the configuration of the editor

Note: sudo apt-get install python-pygments didn't work

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .