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{{\setbox0\lastbox}\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}
1em
indentation before the first paragraph starting with "Proof: "?before upper app={\setlength{\parindent}{1em}}
?before upper app
is provided by libraryhooks
oftcolorbox
package. In your MWE, it is loaded by package optionmost
.before upper app
was the correct option, but I misinterpreted the error message (I thought I just could not use this option with\newtcbtheorem
, but of course if it was not loaded this explains everything).