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}
  • @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 6 '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 meta.tex.stackexchange.com/questions/228). – Dr. Manuel Kuehner Nov 6 '16 at 12:25
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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.