
我喜歡 minted 的語法突出顯示,但無法讓它模仿列表中長代碼字串的“更令人愉悅”的換行符。
在下面的範例中,我有三個片段:第一個是我想要的外觀,但只能在列表中實現;第二個是 minted 如何顯示程式碼;第三,嘗試更改 minted 中的breakafter變數(但仍然無濟於事)。我特別想要的是,不要在長 URL 和前面的正斜杠之後的空格之間再次中斷。
任何幫助表示讚賞。謝謝。
\documentclass{article}
\usepackage[english]{babel}
\usepackage{minted}
\usepackage{pifont}
\usepackage{color}
\usepackage{listings}
\lstset{
breaklines=true,
prebreak=\raisebox{0ex}[0ex][0ex]{\footnotesize\color{red}\ensuremath{_\rfloor}},
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}
}
\begin{document}
\begin{lstlisting}
RUN curl -L -o /tmp/${package_name}.zip http://www.bioinformatics.babraham.ac.uk/projects/fastqc/${package_name}.zip \
&& cd /usr/local \
&& unzip /tmp/${package_name}.zip \
&& chmod 755 /usr/local/FastQC/fastqc \
&& rm -rf /tmp/*
\end{lstlisting}
\begin{minted}[breaklines]{text}
RUN curl -L -o /tmp/${package_name}.zip http://www.bioinformatics.babraham.ac.uk/projects/fastqc/${package_name}.zip \
&& cd /usr/local \
&& unzip /tmp/${package_name}.zip \
&& chmod 755 /usr/local/FastQC/fastqc \
&& rm -rf /tmp/*
\end{minted}
\begin{minted}[breaklines,breakafter=/]{text}
RUN curl -L -o /tmp/${package_name}.zip http://www.bioinformatics.babraham.ac.uk/projects/fastqc/${package_name}.zip \
&& cd /usr/local \
&& unzip /tmp/${package_name}.zip \
&& chmod 755 /usr/local/FastQC/fastqc \
&& rm -rf /tmp/*
\end{minted}
\end{document}