TransWikia.com

Indentation in tcolorbox with plain theorem style

TeX - LaTeX Asked by Zooky on January 12, 2021

Could someone tell me how to get proper indentation in my tcolorbox environment (created with newtcbtheorem)? I got from other questions that we can use before upper, but apparently when using newtcbtheorem and a plain style this is not helpful as before upper already contains the label, which is erased by the added code. I’ve seen in the doc that there are related options such as before upper app, but I don’t see how to use that properly (and configure it only once for all the document).

MWE:

documentclass{article}
usepackage{polyglossia}
usepackage[most,theorems,skins,listings]{tcolorbox}
tcbset{
  proofstyleone/.style={
    theorem style=plain,
    coltitle=black,
  },
  proofstyletwo/.style={
    theorem style=plain,
    coltitle=black,
    before upper=setlength{parindent}{1em}everypar{{setbox0lastbox}everypar{}},
  }
}
newtcbtheorem[]{tcbproofone}{Proof}{proofstyleone}{p}
newtcbtheorem[]{tcbprooftwo}{Proof}{proofstyletwo}{p}

begin{document}
begin{tcbproofone*}{}
This is a paragraph to test.

There should be an indent here.
end{tcbproofone*}

begin{tcbprooftwo*}{}
This is a paragraph to test.

There should be an indent here.
end{tcbprooftwo*}
end{document}

One Answer

From comments, with tcolorbox library hooks loaded, setting

before upper app={setlength{parindent}{1em}}

is sufficient.

Correct answer by muzimuzhi Z on January 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP