
Mit folgendem 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}
Ich erhalte diese Darstellung:
Wie Sie sehen, formatcom
ermöglicht die Option, unten im Quellcode eine zusätzliche Leerzeile einzufügen.
Also, wie lösche ich es?
Antwort1
Minted verwendet im Hintergrund fancyvrb. Um die Textfarbe mit der formatcom
Option zu ändern, müssen Sie eine Funktion definieren, die neu definiert \FancyVerbFormatLine
wie in
\newcommand{\shellfgcolor}{%
\def\FancyVerbFormatLine##1{\textcolor{white}{##1}}%
}
und übergeben Sie es an die formatcom
Option „geprägt“ wie informatcom=\shellfgcolor
Ihr MWE wird also:
\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}