1

I have a custom chapter heading working fine but I want to add a box and a text to it. It looks like this right now

Now

Here is the code I used

\definecolor{myblue}{RGB}{0,82,155}
\titleformat{\chapter}[display]
      {\normalfont\bfseries\color{myblue}}
      {\filleft\hspace*{-60pt}%
        \rotatebox[origin=c]{90}{%
          \normalfont\color{black}\Large%
            \textls[180]{\textsc{\chaptertitlename}}%
        }\hspace{10pt}%
        {\setlength\fboxsep{0pt}%
        \colorbox{myblue}{\parbox[c][3cm][c]{2.5cm}{%
          \centering\color{white}\fontsize{80}{90}\selectfont\thechapter}%
        }}%
      }
      {10pt}
      {\titlerule[2.5pt]\vskip3pt\titlerule\vskip4pt\LARGE\sffamily}

I want to add a box to the left that can have some text inside it :

This

How can I obtain this please :) ?

2
  • Welcome to TeX.SE. Please provide your full input file. What about the definition of myblue?
    – mmr
    Commented Nov 24, 2021 at 17:37
  • Thanks for pointing that, forgot to add myblue : \definecolor{myblue}{RGB}{0,82,155} Commented Nov 24, 2021 at 17:57

1 Answer 1

3

Try this code.

b

\documentclass[12pt,a4paper]{book}

\usepackage{graphicx}
\usepackage[french]{babel}
\usepackage{xcolor}     
\definecolor{myblue}{RGB}{0, 82, 155}

\usepackage{titlesec}
    
\titleformat{\chapter}[display]
{\normalfont\bfseries\color{myblue}}
{\setlength{\fboxrule}{1.5pt} % <<<<<<<<<<<<<<<
    \fbox{\parbox[c][3cm][c]{2.5cm}{\centering Some \\text}} % <<<<<<<<<<<<<<<
    \hfill % <<<<<<<<<<<<<<<
    \rotatebox[origin=c]{90}{%
        \normalfont\color{black}\Large%
        {\textsc{\chaptertitlename}}%
    }\hspace{10pt}%
    {\setlength\fboxsep{0pt}%
        \colorbox{myblue}{\parbox[c][3cm][c]{2.5cm}{%
                \centering\color{white}\fontsize{80}{90}\selectfont\thechapter}%
    }}%
}
{10pt}
{\titlerule[2.5pt]\vskip3pt\titlerule\vskip4pt\LARGE\sffamily}


\begin{document}
    
    \chapter{Oscillateus amortis en r\'egime libre}
    
\end{document}
1
  • Works perfectly fine, thanks! Commented Nov 24, 2021 at 18:06

You must log in to answer this question.

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