tcolorbox 内部缩进

tcolorbox 内部缩进

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,
}

相关内容