插入颜色框后,段落之间出现很多意外空格

插入颜色框后,段落之间出现很多意外空格

我遇到了一个问题,如附图所示。我猜测是colorbox内部问题minipage。我的文档是一篇150多页的论文。当我单独测试这一段latex代码时,它工作正常。但我把它添加到大文件(即我的论文)中,就出现了如图所示的错误。
你以前见过这个虫子吗?

以下是我的 MWE:


\documentclass[a4paper,10pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{color}
\usepackage{eqparbox}

\begin{document}
\subsection{Determining MCSs}
The MCS algorithm devised by Klamt and Gilles relies on the 
fact that:
\begin{itemize}
 \item any feasible steady state flux distribution in a given network, 
expressed by a vector of the net reaction rates, $r$, can be represented by a 
non-negative linear combination of EFMs as illustrated in 
\Cref{eq:steady-state2} (reused from Klamt2006):
\begin{equation}\label{eq:steady-state2}
 r = \sum_{i=1}^{N}\alpha_{i}E_{i}, (\alpha_{i} \geq 0)
\end{equation}
 \item where $N$ is the number of EFMs.
 \item the removal of reactions from the network results in a new set of EFMs 
constituted by those EFMs that do not involve the deleted reactions.
\end{itemize}
\paragraph{}Before MCSs are computed, the set of $EFMs$ is split into 
two disjoint sets:
\begin{itemize}
 \item the set of target modes ($EFM^t$), i.e., all EFMs ($e^{t,j}$) involving 
the objective reactions $t$.
 \item the set of non-target modes ($EFM^{nt}$), i.e., EFMs not involving the 
objective reaction $nt$.
\end{itemize}
\paragraph{}
\paragraph{}This MCS algorithm can be divided into two phases as follows:
\paragraph{}

\noindent\colorbox{TeaGreen}{%
\begin{minipage}{\dimexpr\textwidth-1\fboxsep}
\paragraph{Preparatory phase}
\small{
\begin{enumerate}[(1)]
 \item Calculate the EFMs in the given networks.
 \item Define the objective reaction \texttt{obR}.
 \item Choose all EFMs where the reaction \texttt{obR} is non-zero and store it 
in the binary array \texttt{efms\_obR}.
 \item Initialise the arrays \texttt{mcss} and \texttt{precutsets} as follows:\;
Append $\{j\}$ to \texttt{mcss} if the reaction $j$ is essential, otherwise to 
\texttt{precutsets}.
\end{enumerate}
}
\paragraph{Main phase}
\small{
\begin{enumerate}[(5)]
 \item FOR i = 2 TO MAX\_CUTSETSIZE
  \begin{enumerate}[(5.1)]
   \item $new\_precutsets = \varnothing $;
   \item FOR j = 1 TO q
    \begin{enumerate}[(5.2.1)]
     \item Remove all sets from \texttt{precutsets} where the reaction
$j$ participates;
     \item Find all sets of reactions in \texttt{precutsets} that do not
cover any EFM in \texttt{efms\_obR} where reaction $j$ participates. Combine 
each
of these sets with reaction $j$ and store the new preliminary cut sets in
\texttt{temp\_precutsets};
     \item Drop all \texttt{temp\_precutsets} which are a superset of any of
the already determined minimal cut sets stored in \texttt{mcss};
     \item Find all retained \texttt{temp\_precutsets} which do now cover all
EFMs and append them to \texttt{mcss}. Append all others to
\texttt{new\_precutsets};
    \end{enumerate}
   \item IF \texttt{isEmpty(new\_precutsets)} BREAK; ELSE \texttt{precutsets} = 
\texttt{new\_precutsets};
  \end{enumerate}
 \begin{enumerate}[(6)]
  \item return \texttt{mcss};
 \end{enumerate}
\end{enumerate}
}
\end{minipage}
}
\end{document}

压/冲:我的目的是填充颜色框。我想在文档中创建几个填充颜色的框。

答案1

“MWE” 有几个问题(缺少包、命令、未知的颜色定义、缺少算法环境)

这使用了包breakable的功能tcolorbox

\documentclass[a4paper,10pt]{report}
\usepackage{enumerate}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames]{xcolor}
\usepackage{eqparbox}

\usepackage[breakable]{tcolorbox}

\usepackage{cleveref}

\usepackage{blindtext}
\tcbuselibrary{skins,breakable}

\begin{document}

\chapter{First}
\section{First}

\subsection{Determining MCSs}
The MCS algorithm devised by Klamt and Gilles relies on the 
fact that:
\begin{itemize}
 \item any feasible steady state flux distribution in a given network, 
expressed by a vector of the net reaction rates, $r$, can be represented by a 
non-negative linear combination of EFMs as illustrated in 
\Cref{eq:steady-state2} (reused from Klamt2006):
\begin{equation}\label{eq:steady-state2}
 r = \sum_{i=1}^{N}\alpha_{i}E_{i}, (\alpha_{i} \geq 0)
\end{equation}
 \item where $N$ is the number of EFMs.
 \item the removal of reactions from the network results in a new set of EFMs 
constituted by those EFMs that do not involve the deleted reactions.
\end{itemize}
\paragraph{}Before MCSs are computed, the set of $EFMs$ is split into 
two disjoint sets:
\begin{itemize}
 \item the set of target modes ($EFM^t$), i.e., all EFMs ($e^{t,j}$) involving 
the objective reactions $t$.
 \item the set of non-target modes ($EFM^{nt}$), i.e., EFMs not involving the 
objective reaction $nt$.
\end{itemize}
\paragraph{}
\paragraph{}This MCS algorithm can be divided into two phases as follows:
\paragraph{}


\begin{tcolorbox}[breakable,colback=LimeGreen,width=\textwidth-1\fboxsep,arc=0mm,auto outer arc]
\paragraph{Preparatory phase}
\small{
\begin{enumerate}[(1)]
 \item Calculate the EFMs in the given networks.
 \item Define the objective reaction \texttt{obR}.
 \item Choose all EFMs where the reaction \texttt{obR} is non-zero and store it 
   in the binary array \texttt{efms\_obR}.
 \item Initialise the arrays \texttt{mcss} and \texttt{precutsets} as follows: 
   Append $\{j\}$ to \texttt{mcss} if the reaction $j$ is essential, otherwise to 
   \texttt{precutsets}.
 \end{enumerate}
}
\paragraph{Main phase}
\small{%
\begin{enumerate}[(5)]
 \item FOR i = 2 TO MAX\_CUTSETSIZE
  \begin{enumerate}[(5.1)]
%  \item $new\_ precutsets = \varnothing $;
   \item FOR j = 1 TO q
    \begin{enumerate}[(5.2.1)]
     \item Remove all sets from \texttt{precutsets} where the reaction
$j$ participates;
     \item Find all sets of reactions in \texttt{precutsets} that do not
cover any EFM in \texttt{efms\_obR} where reaction $j$ participates. Combine 
each
of these sets with reaction $j$ and store the new preliminary cut sets in
\texttt{temp\_precutsets};
     \item Drop all \texttt{temp\_precutsets} which are a superset of any of
the already determined minimal cut sets stored in \texttt{mcss};
     \item Find all retained \texttt{temp\_precutsets} which do now cover all
EFMs and append them to \texttt{mcss}. Append all others to
\texttt{new\_precutsets};
    \end{enumerate}
   \item IF \texttt{isEmpty(new\_precutsets)} BREAK; ELSE \texttt{precutsets} = %
\texttt{new\_precutsets};
  \end{enumerate}
 \begin{enumerate}[(6)]
  \item return \texttt{mcss};
 \end{enumerate}
\end{enumerate}
}%
\end{tcolorbox}

\blindtext

\end{document}

在此处输入图片描述

相关内容