[Tex/LaTex] tcolorbox, equations and indentation

tcolorbox

I have used the tcolorbox to highlight my equations, the problem i have i that the indentation does somehow not work properly. If i use regular equations i just have to remove the lines before and after the equation to get no indentation. Nevertheless with tcolorbox this does not seem to work.

Here is an example:

This is the definition for the colorbox:

\newtcolorbox{empheqboxed}[1][]{colback=gray!20, 
 colframe=white,
 width=\textwidth,
 sharpish corners,
 top=-3mm, % default value 2mm
 bottom=3pt
}

In the document:

    ...  response of the medium can be considered linear, leading to the following expression for the polarizability:
%
\begin{empheqboxed} 
\begin{align}%
        \mathbf{P}(\mathbf{r},t)=\varepsilon_0\int\limits_{-\infty}^{\infty}\!\!\mbox{d}\tau\int \!\mbox{d}^3r'\:\boldsymbol{\chi}(\mathbf{r},\mathbf{r}',\tau)\cdot\mathbf{E}(\mathbf{r},\mathbf{r}',-\tau) +  \mathbf{P}_N(\mathbf{r},t)
        \label{eq:langevin_1}
\end{align} %
\end{empheqboxed}
%
here, $\boldsymbol{\chi}$ represents...

Which looks like this:

enter image description here

Best Answer

Per default, a tcolorbox is set as paragraph. You can change this by removing the default setting for after which contains a \par:

\documentclass[a4paper]{article}
\usepackage[many]{tcolorbox}

\newtcolorbox{empheqboxed}[1][]{colback=gray!20,
 colframe=white,
 width=\textwidth,
 sharpish corners,
 top=-3mm, % default value 2mm
 bottom=3pt,
 after=,% <----- remove the default \par
}

\begin{document}

...  response of the medium can be considered linear, leading to the following expression for the polarizability:
%
\begin{empheqboxed}
\begin{align}%
        \mathbf{P}(\mathbf{r},t)=\varepsilon_0\int\limits_{-\infty}^{\infty}\!\!\mbox{d}\tau\int \!\mbox{d}^3r'\:\boldsymbol{\chi}(\mathbf{r},\mathbf{r}',\tau)\cdot\mathbf{E}(\mathbf{r},\mathbf{r}',-\tau) +  \mathbf{P}_N(\mathbf{r},t)
        \label{eq:langevin_1}
\end{align} %
\end{empheqboxed}
%
here, $\boldsymbol{\chi}$ represents...

\end{document}

enter image description here