2

Problem:

I get multiple undefined control sequences when using the package minted and I believe it is caused by pygmentize.

Background

I use the software Texpad and the active LaTeX distribution is set to:

  • /usr/local/texlive/2016/bin/x86_64-darwin

I then check both python and pygmentize:

  • which python results in /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
  • which pygmentize results in /opt/local/bin/pygmentize

I have MacPorts installed and I check the active version by using:

  • port select --list python which results in python34 (active)

Question 1

This is where I get confused, shouldn't which python also point to /opt/local/bin/python?

Paths

I check my paths by doing nano ~/.bash_profile, which results in:

export PATH=/System/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH
export PATH=/usr/local/texlive/2016/bin/x86_64-darwin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/:$PATH

##
# Your previous /Users/Batman/.bash_profile file was backed up as /Users/Batman/.bash_profile.macports-saved_$
##

# MacPorts Installer addition on 2017-02-12_at_00:07:31: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

Question 2

What is required given the above information in order for pygmentize to work?

Minimal Working Example (MWE):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{minted}

\usemintedstyle[php]{autumn}

\begin{document}
\begin{minted}{php}
<?php
    try {
        // Connect to SQL database
        $dsn = new PDO('mysql:host=servername;dbname=databasename', 'username', 'password');
    }
    catch (PDOException $e) {
        // Prints out error message
        echo 'Error: ' . $e->getMessage();
    }
?>
\end{minted}
\end{document}
1

So after some searching I found the answer here:

https://github.com/gpoore/minted/issues/81#issuecomment-125685237

and the solution was:

\usepackage[cache=false]{minted}

If the errors continue one might try:

\usepackage[cache=false,outputdir=.texpadtmp]{minted}

The issue seems to be with the minted package and not associated with pygmentize.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.