2

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

4
  • I think it's tcolorbox normal behavior. Take a look at egreg's comment in tex.stackexchange.com/a/212020/1952
    – Ignasi
    Commented Dec 5, 2014 at 13:47
  • @ Ignasi I know, it is the normal behaviour of 'tcolorbox'. I also know that with 'parskip' you can turn off the identation (saldy for the entire document). Since im writing a pretty large document i would love to have a non manual solution.
    – Josh
    Commented Dec 5, 2014 at 13:53
  • Sure. I will also wait for an answer.
    – Ignasi
    Commented Dec 5, 2014 at 13:57
  • @ Ignasi: It has to be possible, figures and tables also can do it.
    – Josh
    Commented Dec 5, 2014 at 14:20

2 Answers 2

9

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

0
5

This is an old question, but still.

Another solution would be to use the package noindentafter.

\newtcoloredbox creates a new environment, so it is pretty straightforward. In the preamble, call the package and add the box you created:

\usepackage{noindentafter}
\NoIndentAfterEnv{empheqboxed}

The noindentafter package is awesome and I use it a lot. If it interests you, make sure to check out \NoIndentAfterCmd{...} to disable indentation after commands rather than environments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .