如果我输入一个段落然后枚举,则项目和段落之间没有空格。如果有两个段落然后枚举,则有两个段落。我希望当我只输入一个段落时也有空格。我使用了 [parbox=false],因为我希望框内的 parskip 与外面的相同。
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\setlength{\parskip}{1em}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[parbox=false,width=\textwidth]
The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph.
\begin{enumerate}
\item
item item item item item item item item item
\item
item item item item item item item item item
\end{enumerate}
\end{tcolorbox}
\begin{tcolorbox}[parbox=false,width=\textwidth]
The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph.
The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph.
\begin{enumerate}
\item
item item item item item item item item item
\item
item item item item item item item item item
\end{enumerate}
\end{tcolorbox}
\end{document}
答案1
\parskip
我建议用特殊风格重复设置parskipsetting
,而不是使用parbox=false
。
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\setlength{\parskip}{1em}
\usepackage{tcolorbox}
\tcbset{parskipsetting/.style={before upper={\parskip=1em}}}
\begin{document}
\begin{tcolorbox}[parskipsetting]
\the\parskip
The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph.
\begin{enumerate}
\item
item item item item item item item item item
\item
item item item item item item item item item
\end{enumerate}
\end{tcolorbox}
\begin{tcolorbox}[parskipsetting]
\the\parskip
The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph.
The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph. The paragraph.
\begin{enumerate}
\item
item item item item item item item item item
\item
item item item item item item item item item
\end{enumerate}
\end{tcolorbox}
\end{document}