TransWikia.com

I can't get minted package to work under Ubuntu (pygments error)

TeX - LaTeX Asked by jcifuentes on August 19, 2021

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

3 Answers

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

Answered by user2478 on August 19, 2021

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.

Answered by Billal Begueradj on August 19, 2021

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

Answered by wmora2 on August 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP