2

Starting from this MWE,

    \documentclass[12pt,fleqn]{book} 
    \usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm,headsep=10pt,a4paper]{geometry} % Page margins

    \usepackage{graphicx} % Required for including pictures
    \usepackage{tikz} % Required for drawing custom shapes
    \usepackage{xcolor} % Required for specifying colors by name
    \definecolor{ocre}{RGB}{243,102,25} % Define the orange color used for highlighting throughout the book

    %----------------------------------------------------------------------------------------
    %   SECTION NUMBERING IN THE MARGIN
    %----------------------------------------------------------------------------------------

    \makeatletter
    \renewcommand{\@seccntformat}[1]{\llap{\textcolor{ocre}{\csname the#1\endcsname}\hspace{1em}}}                    
    \renewcommand{\section}{\@startsection{section}{1}{\z@}
    {-4ex \@plus -1ex \@minus -.4ex}
    {1ex \@plus.2ex }
    {\normalfont\large\sffamily\bfseries}}
    \renewcommand{\subsection}{\@startsection {subsection}{2}{\z@}
    {-3ex \@plus -0.1ex \@minus -.4ex}
    {0.5ex \@plus.2ex }
    {\normalfont\sffamily\bfseries}}
    \renewcommand{\subsubsection}{\@startsection {subsubsection}{3}{\z@}
    {-2ex \@plus -0.1ex \@minus -.2ex}
    {.2ex \@plus.2ex }
    {\normalfont\small\sffamily\bfseries}}                        
    \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}
    {-2ex \@plus-.2ex \@minus .2ex}
    {.1ex}
    {\normalfont\small\sffamily\bfseries}}


    %----------------------------------------------------------------------------------------
    %   CHANGE THIS STYLE CHAPTER
    %----------------------------------------------------------------------------------------

% A switch to conditionally include a picture, implemented by  Christian Hupfer
    \newif\ifusechapterimage
    \usechapterimagetrue
    \newcommand{\thechapterimage}{}%
    \newcommand{\chapterimage}[1]{\ifusechapterimage\renewcommand{\thechapterimage}{#1}\fi}%
    \newcommand{\autodot}{.}
    \def\@makechapterhead#1{%
    {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
    \begin{tikzpicture}[remember picture,overlay]
    \node at (current page.north west)
    {\begin{tikzpicture}[remember picture,overlay]
    \node[anchor=north west,inner sep=0pt] at (0,0) {\ifusechapterimage\includegraphics[width=\paperwidth]{\thechapterimage}\fi};
    \draw[anchor=west] (\Gm@lmargin,-9cm) node [line width=2pt,rounded corners=15pt,draw=ocre,fill=white,fill opacity=0.5,inner sep=15pt]{\strut\makebox[22cm]{}};
    \draw[anchor=west] (\Gm@lmargin+.3cm,-9cm) node {\huge\sffamily\bfseries\color{black}\thechapter\autodot~#1\strut};
    \end{tikzpicture}};
    \end{tikzpicture}
    \else
    \begin{tikzpicture}[remember picture,overlay]
    \node at (current page.north west)
    {\begin{tikzpicture}[remember picture,overlay]
    \node[anchor=north west,inner sep=0pt] at (0,0) {\ifusechapterimage\includegraphics[width=\paperwidth]{\thechapterimage}\fi};
    \draw[anchor=west] (\Gm@lmargin,-9cm) node [line width=2pt,rounded corners=15pt,draw=ocre,fill=white,fill opacity=0.5,inner sep=15pt]{\strut\makebox[22cm]{}};
    \draw[anchor=west] (\Gm@lmargin+.3cm,-9cm) node {\huge\sffamily\bfseries\color{black}#1\strut};
    \end{tikzpicture}};
    \end{tikzpicture}
    \fi\fi\par\vspace*{270\p@}}}

    %-------------------------------------------

    \def\@makeschapterhead#1{%
    \begin{tikzpicture}[remember picture,overlay]
    \node at (current page.north west)
    {\begin{tikzpicture}[remember picture,overlay]
    \node[anchor=north west,inner sep=0pt] at (0,0) {\ifusechapterimage\includegraphics[width=\paperwidth]{\thechapterimage}\fi};
    \draw[anchor=west] (\Gm@lmargin,-9cm) node [line width=2pt,rounded corners=15pt,draw=ocre,fill=white,fill opacity=0.5,inner sep=15pt]{\strut\makebox[22cm]{}};
    \draw[anchor=west] (\Gm@lmargin+.3cm,-9cm) node {\huge\sffamily\bfseries\color{black}#1\strut};
    \end{tikzpicture}};
    \end{tikzpicture}
    \par\vspace*{270\p@}}
    \makeatother
    \begin{document}
    \chapterimage{example-image-a}
    \chapter{Text Chapter}
    \section{Paragraphs of Text}\index{Paragraphs of Text}
    \end{document}

looking carefully at this code, there is a rounded rectangle, ochre color, with opacity that provides a good contrast with the image below.

enter image description here

Using the same identical structural code I am not able to operate a variant, with TikZ. In fact, to create that rounded rectangle where the text is present and the ochre border is used a code complex for me of TikZ.

I'd like to have something different of this shape. How can I get this same image, for example,

enter image description here

using the same identical code of my MWE operating the variant only of the graphic part?

I kindly ask for your precious help.

  • Could you please try to clarify the question? The first screen shot is the output that you get from running the code. So far, so good. But what this the question? What role do the other two screen shots play in the question? (BTW, I think many users told you not to use the Legrand Orange Book. We wouldn't recommend running a marathon with high heel shoes either. The recommendation not to run a marathon with high heel shoes does not mean that high heel shoes are crap, it just means you shouldn't use them for that purposes. The analogous statements apply to LOB and your book.) – user121799 Apr 5 at 22:38
  • @marmot I'll answer you immediately: the source of inspiration is Legrand Orange Book but many other settings will be changed by the publishing house. I would simply like to replace the orange curvature indicated by the yellow arrow with something original that is not the one that Christian added. I finally gave 2 examples of how I would like the orange curvature to be changed by inserting a text on two lines. I hope I was clear. You can edit my question. Translated with www.DeepL.com/Translator – Sebastiano Apr 5 at 22:44
1

I still don't know if I get the message but this is something that is based on this answer. It does some orange boxes whose size adjusts to the multiline chapter titles. While the TeX code is not particularly interesting, the chapter titles contain a deep philosophical message, which is why I fully understand that some users may need styles that allow them to run chapter titles over several lines. ;-)

\documentclass[12pt,fleqn]{book} 
\usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm,headsep=10pt,a4paper]{geometry} % Page margins
\usepackage{lmodern}
\usepackage[explicit]{titlesec}
\usepackage{microtype}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\definecolor{myblue}{RGB}{0,82,155}
% from https://tex.stackexchange.com/a/169435/121799
\titleformat{\chapter}[display]
  {\normalfont\bfseries\color{myblue}}
  {%\filleft%
    \begin{tikzpicture}
    \node[inner xsep=0.5em,text 
    width={\textwidth-2em-2.5cm},align=left,font=\Large\sffamily]
    (CC){#1};
    \path let \p1=($(CC.north)-(CC.south)$) in
    node[minimum width=2.5cm,minimum height={min(2.5cm,\y1)},left=1em of CC,
    fill=orange,font=\Huge\sffamily\bfseries,text=blue] (TC)    {\thechapter};  
    %{\chaptertitlename~\thechapter};
    \end{tikzpicture}%
  }
  {10pt}
  {}

\begin{document}
\pagestyle{empty}
\chapter{Those who can hibernate on a Monday can also hibernate on a Tuesday.}
\chapter{Those who can hibernate on a Monday can also hibernate on a Tuesday and
even on a Wednesday.}

\end{document}

enter image description here

  • @Dear and courteous marmot, in the meantime I thank you for your kind answer. The link you entered has no reference to my question. I'm so sorry that you did an extra job that I return it. My question is another. That is, within the code I entered there is a rounded rectangle of ochre color that I highlighted with the yellow arrow. I would always like the same code that has a white shadow (rectangular) as the background above figure A of my MWE. – Sebastiano Apr 6 at 15:53
  • Inside my same MWE I don't know how to operate in TikZ because there are a lot of strange codes all linked together. If I change something I personally make a salad :-) – Sebastiano Apr 6 at 15:53
  • @Sebastiano Sorry, I (still) do not understand what you want me to do. You have a code. Do you want to modify it? If so, what should the modified code achieve? – user121799 Apr 6 at 16:17
  • 1
    @Sebastiano Sorry, I give up. I asked you several times to kindly consider making your question clearer. I fully believe that you have a clear question in mind, but I do not have most of the information and context, and you only give me fragments, Maybe this conversation may help others to find out what you are after, so I leave the post for a short while before I delete it. Sorry. – user121799 Apr 6 at 17:05
  • 1
    @Sebastiano I guess we have a problem: you say you are not good at English and I am not good at guessing. Can you at least partly understand why it is not a good idea to have two target (?) screen shots and not much of an explanation? It may be that it will cost you slightly more time to make the question clearer, but you will save a lot of time of those who are trying to answer. – user121799 Apr 6 at 18:53

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.