tcolorbox 內的縮排

tcolorbox 內的縮排

我有一個用和solution創建的環境。我不明白為什麼包在裡面不起作用。xparsetcolorbox\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,
}

相關內容