TransWikia.com

Different picture for each heading chapter?

TeX - LaTeX Asked by kmmm on June 7, 2021

I found a free template as they called “tstextbook” and I believed it was derived from Legrand orange book as a template. It has minitoc on each chapter page while Legrand template does not. Inversely, Legrand template can change chapter heading picture while tstextbook can not do it. I like to have minitoc and be able to chang chapter heading picture at the same time. So, I started with my MWE hopefully I can put them together. I changed picture to example-image-a but it will apply to all chapter heading picture. Please help.

Thanks in advance.

% Chapter styling
%--------------------------------------------------------------------------
makeatletter
% Numbered chapters (with minitoc)
renewcommand{@makechapterhead}[1]{
    begin{tikzpicture}[remember picture,overlay]
    node at (current page.north west)
    {
        begin{tikzpicture}[remember picture,overlay]
        % Background image
        node[anchor=north west,inner sep=0pt] at (0,0)
        {includegraphics[width=paperwidth]{example-image-a}};
        % Chapter heading
        draw[anchor=west, inner sep=0pt] (-0.1cm,-1.5cm) node
        [black,
        ultra thick,
        fill=tsorange!10,
        fill opacity=.6,
        inner sep=10pt]
        (0,0)
        {parbox[t][1.6cm][t]{paperwidth}
            {hugebfseriessffamilyflushleftthechapter. #1}};
        % Chapter contents
        draw[anchor=west,inner sep=0pt] (8.8cm,-7cm) node
        [tssteelblue,
        ultra thick,
        fill=white,
        fill opacity=.8,
        draw=tssteelblue,
        draw opacity=1,
        line width=1.5pt,
        rounded corners,
        inner sep=0pt]
        (0,0)
        {hspace{1cm}parbox[t][7.1cm][t]{11cm}
            {vspace{-1cm}hugebfseriessffamilyflushleft
                textcolor{black}{sffamilyminitoc}}};
        end{tikzpicture}
    };
end{tikzpicture}
vspace{7.5cm}
}

% Unnumbered chapters (without minitoc)
renewcommand{@makeschapterhead}[1]{
begin{tikzpicture}[remember picture,overlay]
node at (current page.north west)
{
    begin{tikzpicture}[remember picture,overlay]
    % Background image
    node[anchor=north west,inner sep=0pt] at (0,0)
    {includegraphics[width=paperwidth]{example-image-b}};
    % Chapter heading
    draw[anchor=west,inner sep=0pt] (-0.1cm,-1.5cm) node
    [black,
    ultra thick,
    fill=tsorange!10,
    fill opacity=.6,
    inner sep=10pt]
    (0,0)
    {parbox[t][1.6cm][t]{paperwidth}
        {hugebfseriessffamilyflushleft #1}};
    end{tikzpicture}
};
end{tikzpicture}
vspace{8cm}
}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP