我正在为我的论文写附录,并且正在插入代码,但希望环境minted
中的代码tcolorbox
是单倍行距。
这是我突出显示的代码tex
文件:
%%% ====================================================================
%%% Custom code highlighting using Minted and tikz
%%% ====================================================================
\usepackage{tikz}
%%% ====================================================================
%%% Specific colors used for code highlighting
%%% ====================================================================
\definecolor{matlabcodebg}{rgb}{0.99,0.99,1}
\definecolor{pythoncodebg}{rgb}{0.99,1,0.99}
%\usepackage{minted} % Already charged with tcblibrary minted
\usepackage{tcolorbox}
\tcbuselibrary{minted,skins,breakable,hooks}
\usemintedstyle[python]{default} % Specific color scheme
\usemintedstyle[matlab]{default} % Specific color scheme
%%% ====================================================================
%%% Custom code highlighting using Minted
%%% ====================================================================
% Python footnotesize
\newtcbinputlisting{\pythoninput}[2][]{%
listing file={#2},
minted language=python,
minted style=default,
minted options={
fontsize=\normal,
linenos,
numbersep=1mm,
breaklines=true,
},% <-- put other minted options inside the brackets
overlay={%
\begin{tcbclipinterior}
\fill[gray!25] (frame.south west) rectangle ([xshift=5mm]frame.north west);
\end{tcbclipinterior}
},
colback=pythoncodebg,
colframe=black!70,
before skip=5pt plus 2pt,
breakable,
enhanced,% <-- put other tcolorbox options here
listing only,#1
}
在我的附录中,下面是我调用脚本进行格式化的方法:
%%% -*-LaTeX-*-
\documentclass[../Dissertation]{subfiles}
\doublespacing
\begin{document}
\chapter{The Third}
\section{Elastic Moduli}
\subsection{Python Elastic Moduli Curve Fitting}
Python script used to fit a two-term standard linear solid model to creep
data.
\pythoninput{\subfix{Python/LmFit_Example_Lin2020.py}}
\section{Prony Series}
\subsection{Python Prony Series Curve Fitting}
Python script used to fit an n'th-term Prony series model to creep data.
\pythoninput{\subfix{Python/LmFit_Example.py}}
\end{document}
我希望代码块是单倍行距的,但我不确定最好的方法是什么。
谢谢!
答案1
在列表环境中插入以下命令:
code={\singlespacing}