`tcolorbox` 背景颜色改变

`tcolorbox` 背景颜色改变
\documentclass[fleqn, 12pt] {article}
\usepackage{epsf}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{enumerate}
\usepackage[shortlabels]{enumitem}
\usepackage[dvips]{graphics}
\usepackage[dvipsnames]{xcolor}
\usepackage{fancyhdr}
\usepackage{blindtext}
\usepackage{color}
\usepackage[breakable]{tcolorbox}

\begin{document}
   There are too many sentences and hence the following box starts from the lower part of the page.
   \begin{center}
        \begin{tcolorbox}[breakable][colback=white, sharp corners]
            This text is quite large.
        \end{tcolorbox}
\end{center}
\end{document}

当我不使用 时breakable,背景会变成白色,但The text is quite large会转到下一页。而且边角很锐利。但使用 时breakable,背景会变成默认颜色灰色,但The text is quite large会分成两页。而且边角会变圆。

我想使用 将分页符与白色背景颜色和尖角结合在一起tcolorbox

答案1

您应该将所有选项都放在单个方括号中,例如,您使用了 as\begin{tcolorbox}[breakable][colback=white, sharp corners]但它应该是 as \begin{tcolorbox}[breakable,colback=blue!5, sharp corners],并且修改后MWE的是:

\documentclass[fleqn, 12pt] {article}
\usepackage{epsf}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{enumerate}
\usepackage[shortlabels]{enumitem}
\usepackage[dvips]{graphics}
\usepackage[dvipsnames]{xcolor}
\usepackage{fancyhdr}
\usepackage{blindtext}
\usepackage{color}
\usepackage[breakable]{tcolorbox}

\begin{document}
   There are too many sentences and hence the following box starts from the lower part of the page.
   \begin{center}
        \begin{tcolorbox}[breakable,colback=blue!5, sharp corners]
            This text is quite large.

\lipsum[1-5]
        \end{tcolorbox}
\end{center}
\end{document}

除此之外,我不确定你的目的是什么\begin{center}...\end{center},希望这不是必要的......

相关内容