1

I created a tcolorbox environment to write summaries by adapting the code on page 15 of the manual. In this environment \newtcolorbox{resume}, the title is detached and placed in its own tcolorbox.

I would like to enlarge only the title frame withboxrule=10pt,colframe=black and I can't do it. I tried to adapt the code of this question tcolorbox, subtitle style, but I did not succeed.

The code is this:

\documentclass[a4paper, 11pt]{article}  
\usepackage{ae,lmodern}                 
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}  
\usepackage[most]{tcolorbox}

\tcbset{soustitre/.style={subtitle style={colback=gray!15!white,
fontupper={\sffamily\bfseries\large\selectfont\color{black!25!gray}}}}}

\tcbset{titre/.style={title style={boxrule=10pt,colframe=black
}}}

\newtcolorbox{resume}[2][]{colframe=gray!50,colback=white,
beforeafter skip=0pt,
lower separated=false,
leftrule=3mm,rightrule=3mm,toprule=2pt,bottomrule=2pt,
fonttitle=\sffamily\bfseries\large,
enhanced,
attach boxed title to top center={yshift=-2mm,xshift=-\linewidth/5},
title=#2,#1}

\begin{document}
\begin{resume}[soustitre,titre]{Title}
\tcbsubtitle{Subtitle\hfill }
\tcblower

\lipsum[1]
\end{resume}
\end{document}

The result is this:

enter image description here

How do I customize the boxrule width and its colframe color only for the title and not for the rest of the box?

  • Are you sure you want to use boxrule=10pt ? – user31729 Sep 17 '17 at 17:59
  • @Christian Hupfer No, actually, I want 2 or 3 pt but during the tests, I exaggerate to see more easily the effect of the change. – AndréC Sep 17 '17 at 18:01
  • Well, see the output of the exaggerate version in my answer below ;-) – user31729 Sep 17 '17 at 18:02
  • Happy TeXing and TColorBoxing ;-) – user31729 Sep 17 '17 at 18:09
  • Even the color was exaggerated, I think I adopt boxrule=2pt, colframe=black!15 – AndréC Sep 17 '17 at 19:04
2

The boxed title which is added by one of the attached boxed title... options uses the style set with boxed title style and not title style, so change the titre style to from title style=... to boxed title style=....

For more information see page 157 of the current (v. 4.11) tcolorbox manual.

The boxrule=10pt setting seems to be weird, however....

\documentclass[a4paper, 11pt]{article}  
\usepackage{ae,lmodern}                 
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}  
\usepackage[most]{tcolorbox}

\tcbset{soustitre/.style={subtitle style={colback=gray!15!white,
      fontupper={\sffamily\bfseries\large\selectfont\color{black!25!gray}}}}}

\tcbset{titre/.style={boxed title style={boxrule=10pt,colframe=black}}}

\newtcolorbox{resume}[2][]{
  colframe=gray!50,colback=white,
  beforeafter skip=0pt,
  lower separated=false,
  leftrule=3mm,rightrule=3mm,toprule=2pt,bottomrule=2pt,
  fonttitle=\sffamily\bfseries\large,
  enhanced,
  attach boxed title to top center={yshift=-2mm,xshift=-\linewidth/5},
  title=#2,
  #1
}

\begin{document}
\begin{resume}[soustitre,titre]{Title}
\tcbsubtitle{Subtitle\hfill }
\tcblower

\lipsum[1]
\end{resume}
\end{document}

enter image description here

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.