4.10 How to use minted

First install this

sudo apt-get install python-pygments
 

The above installed old version 1.6, so next I tried this

sudo pip install --upgrade pygments
 

Anow the version is 2.1.3

Then call pdflatex like this

pdflatex --shell-escape foo.tex
 

Where foo.tex is

\documentclass[11pt]{article}%ext 
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc} %DO NOT USE WIT LUALATEX, only with pdflatex 
\usepackage[tracking,protrusion=true,expansion=true]{microtype} 
\usepackage[margin=1in]{geometry} 
 
\usepackage{minted} 
\usepackage{upquote} %to fix string quotes 
 
\begin{document} 
\begin{minted}[mathescape,linenos=true,fontfamily=tt,fontsize=\normalsize] 
                {matlab} 
clear all; close all; 
t   = 0:0.05:50; 
s   = tf('s'); 
sys = 1/(s^2+0.2*s+1); 
y   = step(sys,t); 
plot(t,y,'-r') 
hold on 
y  = impulse(sys,t); 
plot(t,y,'-k') 
title('Step and Impulse responses'); 
xlabel('t'); 
ylabel('y(t)'); 
xlim([0 50]); 
ylim([-0.8 2]); 
legend('step','impulse'); 
grid on; 
set(gcf,'Position',[10,10,310,310]); 
\end{minted} 
\end{document}
 

To compile with tex4ht do this

htlatex foo.tex "" "" "" -shell-escape

To compile with make4ht do make4ht foo.tex "--shell-escape"