2

I am using tcolorbox package for creating attractive definition and theorem blocks. But I am facing a problem right now.

If tcolorbox is placed immediately after chapter, section, subsection everything is ok. However, other tcolorboxes in the document have "paragraph-style" left spacing.

enter image description here

How to remove these spaces (they look awful and also generate a lot of "bad box" warnings)?

Example:

\subsection{Синус и тангенс}
%%% Okay here
\begin{definition}[label={def:sinalpha}]
    \textbf{Синус} острого угла $\alpha$ прямоугольного треугольника --- отношение катета, лежащего напротив этого угла, к гипотенузе.
\end{definition}

\begin{equation}
\boxed{\sin(\alpha) = \frac{BC}{AB}}
\end{equation}
%%% Awful spacing
\begin{definition}[label={def:sinalpha}]
    \textbf{Синус} острого угла $\alpha$ прямоугольного треугольника --- отношение катета, лежащего напротив этого угла, к гипотенузе.
\end{definition}
CMTV
  • 219
  • @Dr.ManuelKuehner Thank you! Both variants work fine but the first one removes paragraph spaces at all (well it is guessable from package's name). – CMTV Nov 06 '16 at 12:17
  • I will turn the comment into an answer and then you can accept it. Next time provide a better example please (with documentclass and so on, see http://meta.tex.stackexchange.com/questions/228). – Dr. Manuel Kuehner Nov 06 '16 at 12:25

2 Answers2

1

I assume that your problem is related to parskip and parindent.

  1. If \usepackage{parskip} helps than that's an indication that the assumption is correct.
  2. You could alternatively put an \noindent before each box

See also this and that question.

1

For a more scalable approach, you can try to define your tcolorbox environment with the option before upper={\parindent0em}. An even more global approach would be:

\tcbset{before upper={\parindent0em}}

before defining any new tcolorbox environment.