我使用标题格式来更改我的部分命令的外观等,在创建新部分后,由于某种原因,itemize 使用的间距被破坏,并且没有留下适当的空白量。我在下面留下了一张我正在谈论的图片和重新创建它所需的代码。任何帮助解决此问题的帮助都将不胜感激。
\documentclass{book}
%Packages
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{geometry}
\RequirePackage{titling}
\RequirePackage{fancyhdr}
\RequirePackage[many]{tcolorbox}
\RequirePackage{titlesec}
\RequirePackage{enumitem}
\definecolor{r}{rgb}{0.9,.3,.5}
\newtcbtheorem[number within=section]{thrm}{Theorem}%
{enhanced, breakable,
colback=r!7, colbacktitle=r!17, coltitle=RedViolet,
frame hidden, parbox=false,
arc=1.85pt, titlerule=0pt, toptitle=2pt, bottomtitle=2pt,
fonttitle=\bfseries,separator sign= : \hspace{0.005cm},
segmentation style={solid, draw=r!55, line width=1pt}}{th}
%\begin{thrm}{Rank-Nullity Theorem}{env}
\titleformat{\section}[hang]{\LARGE}{\fbox{\thesection}}{12pt}{}
\begin{document}
test
\chapter{awd}
\section{adww}
\begin{thrm}{w}{w}
woluygfouyesgvfuyesvfkluYSv
\begin{itemize}
\item awd
\item dwa
\end{itemize}
\end{thrm}
\begin{thrm}{w}{w}
woluygfouyesgvfuyesvfkluYSv
\begin{itemize}
\item awd
\item dwa
\end{itemize}
\end{thrm}
\end{document}
答案1
您想\@nobreakfalse
在环境的开头设置。如果thrm
环境直接跟在章节标题后面,则\if@nobreak
返回 true,这会对内部产生不良影响itemize
。
\documentclass{book}
%Packages
\usepackage[dvipsnames]{xcolor}
\usepackage{geometry}
\usepackage{titling}
\usepackage{fancyhdr}
\usepackage[many]{tcolorbox}
\usepackage{titlesec}
\usepackage{enumitem}
\definecolor{r}{rgb}{0.9,.3,.5}
\newtcbtheorem[number within=section]{thrm}{Theorem}{
enhanced,
breakable,
colback=r!7,
colbacktitle=r!17,
coltitle=RedViolet,
frame hidden,
parbox=false,
arc=1.85pt,
titlerule=0pt,
toptitle=2pt,
bottomtitle=2pt,
fonttitle=\bfseries,
separator sign={ : },
segmentation style={solid, draw=r!55, line width=1pt},
before upper=\csname @nobreakfalse\endcsname
}{th}
\titleformat{\section}[hang]{\LARGE}{\fbox{\thesection}}{12pt}{}
\begin{document}
\chapter{awd}
\section{adww}
\begin{thrm}{w}{A}
woluygfouyesgvfuyesvfkluYSv
\begin{itemize}
\item awd
\item dwa
\end{itemize}
\end{thrm}
\begin{thrm}{w}{B}
woluygfouyesgvfuyesvfkluYSv
\begin{itemize}
\item awd
\item dwa
\end{itemize}
\end{thrm}
\end{document}