我有一個用和solution
創建的環境。我不明白為什麼包在裡面不起作用。xparse
tcolorbox
\usepackage{indentfirst}
solution
\documentclass[12pt]{book}
\usepackage{xparse}
\usepackage{indentfirst}
\usepackage{lipsum}
\def\Solution{Solution}
\usepackage[most, breakable, many]{tcolorbox}
\NewTColorBox[auto counter,number within=section]{solution}{+O{}}{%
breakable, enhanced,colframe=gray,colback=white,coltitle=green!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
\draw[help lines,step=5mm,blue!20!white,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={\Solution},
label={},
attach title to upper=\quad,
after upper={\par\hfill\textcolor{green!40!black}%
{}},
lowerbox=ignored,
#1,
}
\begin{document}
\chapter{One}
\begin{solution}
\lipsum[1-35]
\end{solution}
\end{document}
答案1
對於內部段落縮排,tcolorbox
需要關閉選項parbox
,例如parbox=false
(預設是true
)。因此:
\NewTColorBox[auto counter,number within=section]{solution}{+O{}}{%
breakable,
enhanced,
colframe=gray,
colback=white,
coltitle=green!40!black,
fonttitle=\bfseries,
parbox = false,
underlay={\begin{tcbclipinterior}
\draw[help lines,step=5mm,blue!20!white,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={\Solution},
label={},
attach title to upper=\quad,
after upper={\par\hfill\textcolor{green!40!black}%
{}},
lowerbox=ignored,
#1,
}