2

I have a environment solution created with xparse and tcolorbox. I do not understand why package \usepackage{indentfirst} does not work inside 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}
  • as your image shows parindent is zero inside the box, so there is effectively no indentation for any paragraph, so it's hard to know what you expect indentfirst to do??? – David Carlisle Dec 14 '14 at 20:51
  • @David Carlisleshows "parindent is zero inside the box" In what line of code you see it? – sergiokapone Dec 14 '14 at 20:59
  • I didn't look too hard at the code, but the output shows several paragraphs with no indentation (which is the default for \parbox so not that surprising. – David Carlisle Dec 14 '14 at 21:03
  • 1
    @ David Carlisle "which is the default for \parbox" Ok, now it is clear for me, I should to use parbox=false . Tnx, You helped me again. – sergiokapone Dec 14 '14 at 21:09
  • did I:-) If it's solved perhaps you should post a self-answer:-) – David Carlisle Dec 14 '14 at 21:10
4

For paragraph indentation inside tcolorbox it is necesary to switch off the options parbox, e.g. parbox=false (by default it is true). Thus:

\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,
}
  • Easier for other user to see the solution that way ;-) – Johannes_B Feb 15 '15 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.