
다음 MWE를 사용하면:
\documentclass{article}
\usepackage{xcolor}
\usepackage{minted}
\begin{document}
\begin{minted}[bgcolor=black,formatcom=\color{white}]{bash}
#! /bin/bash
# script to turn the screen blue
setterm -background blue
echo It is a blue day
\end{minted}
\end{document}
나는 다음과 같은 렌더링을 얻습니다.
보시다시피 formatcom
옵션은 소스 코드 하단에 추가 빈 줄을 만듭니다.
그럼 어떻게 삭제하나요?
답변1
Minted는 내부적으로 fancyvrb를 사용합니다. 옵션 으로 텍스트 색상을 변경하려면 다음과 같이 formatcom
재정의하는 함수를 정의해야 합니다.\FancyVerbFormatLine
\newcommand{\shellfgcolor}{%
\def\FancyVerbFormatLine##1{\textcolor{white}{##1}}%
}
formatcom
다음과 같이 minted 옵션 에 전달합니다 .formatcom=\shellfgcolor
따라서 MWE는 다음과 같습니다.
\documentclass{article}
\usepackage{xcolor}
\usepackage{minted}
\newcommand{\shellfgcolor}{%
\def\FancyVerbFormatLine##1{\textcolor{white}{##1}}%
}
\begin{document}
\begin{minted}[bgcolor=black,formatcom=\shellfgcolor]{bash}
#! /bin/bash
# script to turn the screen blue
setterm -background blue
echo It is a blue day
\end{minted}
\end{document}