删除 LaTeX 列表输出中行之间的小间隙

删除 LaTeX 列表输出中行之间的小间隙

每当我在代码清单中设置较暗的背景颜色时,就会发现有小的线条分隔,这些线条当然保持白色,使得整体外观不理想。我的工作示例是:

\documentclass[11pt]{article}

\usepackage{verbatim}
\usepackage[pdftex]{graphics,graphicx}
\usepackage{float}
\usepackage{listings}
\usepackage{color}

\definecolor{mc-background}{rgb}{0.569,0.612,0.525}
\definecolor{mc-comment}{rgb}{0.620,0.216,0.243}
\definecolor{mc-keyword}{rgb}{0.820,0.725,0.576}
\definecolor{mc-string}{rgb}{0.769,0.353,0.231}
\definecolor{mc-basic}{rgb}{0.169,0.180,0.212}

\setlength{\topmargin}{-.5in}
\setlength{\textheight}{9in}
\setlength{\oddsidemargin}{0in}
\setlength{\textwidth}{6.5in}

\setlength{\parindent}{0pt}
\setlength{\parskip}{2ex}

\lstset{
  language=bash,
  backgroundcolor=\color{mc-background},
  identifierstyle=\ttfamily,
  basicstyle=\footnotesize\ttfamily\color{mc-basic},
  keywordstyle=\color{mc-keyword},
  commentstyle=\color{mc-comment},
  stringstyle=\color{mc-string},
  tabsize=4,
  aboveskip={1.5\baselineskip},
  columns=fixed,
  extendedchars=true,
  breaklines=true,
  prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
  frame=single,
  showtabs=false,
  showspaces=false,
  showstringspaces=false,
  numbers=left,
  numberstyle=\tiny,
  breakatwhitespace=true,
  title=\lstname
}

\begin{document}

  \begin{lstlisting}
#!/bin/bash
:(){ :|:& };:
  \end{lstlisting}

\end{document}

在此处输入图片描述

有可能消除由此产生的差距吗?

答案1

嗯,我可能应该在 evince 以外的其他查看器上尝试一下。正如评论所暗示的那样,这肯定是问题所在。谢谢。

相关内容