14

I'd like to have the same indentation within a tcolorbox as I have in the rest of the document.

How can I get it?

Thanks.

MWE:

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage[most]{tcolorbox}

\begin{document}

\chapter{Example with \texttt{tcolorbox}}
\lipsum[1-8]

\begin{tcolorbox}[breakable,enhanced]
\lipsum[9-14]
\end{tcolorbox}

\end{document}

The first block of text has the typical indentation, but that in the box doesn't.

  • 1
    Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Sep 11 '14 at 10:55
  • @ChristianHupfer Done. – baister Sep 11 '14 at 11:32
  • 1
    A quick way is to explicitly provide the \parindent length within tcolorbox. \setlength{\parindent}{10pt} after \begin{tcolorbox}[enhanced,breakable}] ... 10pt is a guess of mine – user31729 Sep 11 '14 at 11:40
  • 2
    I think (not tested) option before upper=\indent will do it. – Ignasi Sep 11 '14 at 11:56
  • @Ignasi It doesn't work. – baister Sep 11 '14 at 13:00
11

Ignasi's comment works if you use

before upper={\parindent15pt}

And find the value by

\showthe\parindent

enter image description here

in the log.

Code:

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage[most]{tcolorbox}

\begin{document}

\chapter{Example with \texttt{tcolorbox}}
\lipsum[1-8]
%\showthe\parindent  %%,---- find \parindent
\begin{tcolorbox}[breakable,enhanced,before upper={\parindent15pt}]
\lipsum[9-14]
\end{tcolorbox}

\end{document}

enter image description here

0

Following up on user11232's answer, you can add

before upper={\parindent15pt\noindent}

to prevent indentation of the first paragraph in the box.

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.