5

I would like to understand why the text go out of the box in the "Résutats & Intégrations" According to the documentation of tcolorbox package section 4.7.4, the text should be just in the box with no padding by using :

boxsep=0pt , top=0pt, bottom=0pt

so, I don't understand.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage[table,x11names]{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{titletoc}
\usepackage{titlesec}
\usepackage{multicol}
\usepackage[paper=a4paper, margin={1cm,3cm},
headsep=0.5cm, headheight=2.2cm,]{geometry}
%
\titleformat
    {\section} % command
    [display] % shape
    {\bfseries\Huge} % format
    {} % label
    {0pt} % sep
    {
      \begin{tcolorbox}[enhanced,colframe=white, colback=DeepSkyBlue1!80,
        valign=center, nobeforeafter, halign=center,
        boxsep=0pt , top=0pt, bottom=0pt
]
      } % before-code
      [
    \end{tcolorbox}
    ] % after-code

\begin{document}
\noindent
\setlength{\columnseprule}{.5pt}
\setlength{\columnsep}{1cm}
\begin{multicols}{2}
  \section{Résultats \& Intégrations}
\end{multicols}
\end{document}

enter image description here enter image description here

1 Answer 1

6

It seems that you misunderstood the manual ... You need to add top distance (as follows from figures on very begining of manual. With

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage[table,x11names]{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{titletoc}
\usepackage{titlesec}
\usepackage{multicol}
\usepackage[paper=a4paper, margin={1cm,3cm},
headsep=0.5cm, headheight=2.2cm,]{geometry}
%
\titleformat
    {\section} % command
    [display] % shape
    {\bfseries\Huge} % format
    {} % label
    {0pt} % sep
    {
      \begin{tcolorbox}[enhanced,colframe=white, colback=DeepSkyBlue1!80,
        valign=center, nobeforeafter, halign=center,
        boxsep=0pt , top=0.5ex, bottom=0pt
]
      } % before-code
      [
    \end{tcolorbox}
    ] % after-code

\begin{document}
\noindent
\setlength{\columnseprule}{.5pt}
\setlength{\columnsep}{1cm}
\begin{multicols}{2}
  \section{Résultats \& Intégrations}
\end{multicols}
\end{document}

I got

enter image description here

2
  • Could you tell me where I could find the point " need to add top distance" in the tcolorbox documentation. I didn't succeeded to find it
    – flav
    Commented Apr 3, 2016 at 6:09
  • 2
    See "quick reference", page 10, the second image. There are shown and named all distances and lines (borders) regarding tcolorboxes. From both pictures there you can see, how all boxes, provided by package,are designed.
    – Zarko
    Commented Apr 3, 2016 at 6:17

You must log in to answer this question.

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