I use for listings minted package, and can reduce line spacing in case of using minted environment. But can't reduce listing line space in case of using external source code file via \inputminted command. How can I deal with it?
\documentclass{article}
\usepackage{minted}
\begin{document}
Try to reduce line spacing with inputminted command
\AtBeginEnvironment{minted}{\linespread{0.15}}
\inputminted[breaklines=true]{c}{main.cpp}
Reduce line spacing with minted environment use.
\AtBeginEnvironment{minted}{\linespread{0.15}}
\begin{minted}{cpp}
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
for(int i=0; i<argc; i++)
printf("%s\n", argv[i]);
system("PAUSE");
return EXIT_SUCCESS;
}
\end{minted}
\end{document}
The content of main.cpp and minted environment the same.

\setminted{baselinestretch=0.5}works well. – Konstantin Jul 07 '22 at 05:59