The following is example beamer file:
\documentclass[notheorems,serif,11pt]{beamer}
\usepackage{algorithm}
\usepackage{float}
\usepackage{minted}
\renewcommand{\listingscaption}{Python code}
\newminted{python}{
fontsize=\footnotesize,
escapeinside=||,
mathescape=true,
numbersep=5pt,
linenos=true,
gobble=2,
framesep=3mm}
\begin{document}
\begin{frame}[fragile]{Mesh Data Strucrure}
\begin{listing}[H]
\begin{pythoncode}
import numpy as np
point = np.array(
[(0.0, 0.0),
(1.0, 0.0),
(1.0, 1.0),
(0.0, 1.0)], dtype=np.float)
cell = np.array([
(1, 2, 0),
(3, 0, 2)], dtype=np.int)
N = point.shape[0] # the number of triangle points
NC = cell.shape[0] # the number of triangle cells
\end{pythoncode}
\caption{The basic data structure of triangle mesh.}
\end{listing}
\end{frame}
\end{document}
Finally, I get the following result in my slide:
My problem is that the blank space between the line number and code is too wide, and I want to reduce it. So how to do it? Thanks very much!
Best Answer
The
autogobble
option is the way to go. Here is the excerpt from the manual:By utilizing this,
will produce