tcolorbox 垂直对齐

tcolorbox 垂直对齐

我是不是漏掉了什么?似乎没有其他人有可破坏的 tcolorbox,它在第二页居中对齐。我希望它只是顶部对齐,就像普通文本一样

\documentclass[11pt,twoside]{report}
\usepackage[breakable,skins]{tcolorbox}
\usepackage{lipsum}
\usepackage[parfill]{parskip}

\newtcolorbox[auto counter,number within=chapter]{pabox}[2][!ht]{colbacktitle=black!70!white, colback=black!2!white, floatplacement=#1, float, enhanced jigsaw, breakable, height fill, fonttitle=\bfseries, parbox=false, toptitle=2mm, bottomtitle=2mm, title=Box.~\thetcbcounter: #2} %removed possibility of specifying other options, just position

\begin{document}

\begin{pabox}[t!]{Extremely annoying tcolorbox}\label{box:accuracy}
\lipsum[1-4]
\end{pabox}

\end{document}

在此处输入图片描述

答案1

删除floatplacement=#1, float,并相应地更正pabox选项:

\documentclass[11pt,twoside]{report}
\usepackage[breakable,skins]{tcolorbox}
\usepackage{lipsum}
\usepackage[parfill]{parskip}

\newtcolorbox[auto counter,number within=chapter]{pabox}[1][!ht]{% <-- chanded from 2 to 1
    colbacktitle=black!70!white, colback=black!2!white,
    %floatplacement=#1, float, % commented (remove)
    enhanced jigsaw,
    breakable,
    height fill,
    fonttitle=\bfseries, parbox=false, toptitle=2mm, bottomtitle=2mm,
    title=Box.~\thetcbcounter: #1} %removed possibility of specifying other options, just position

\begin{document}

\begin{pabox}{Extremely annoying tcolorbox}\label{box:accuracy}
\lipsum[1-4]
\end{pabox}
\end{document}

在此处输入图片描述

相关内容