标题部分采用 tikz

标题部分采用 tikz

使用 TikZ 包为书籍部分创建如下图所示的样式?

在此处输入图片描述

答案1

我相信我已经变得更有条理了。

\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{shapes,shadows,calc}
\usetikzlibrary{positioning,calc}
\usepackage{lipsum}
\usepackage[hmargin=0.5in,bmargin=1in,tmargin=1in,centering]{geometry}

\definecolor{cor1}{HTML}{57C3CF}
\definecolor{cor2}{HTML}{4EA8B1}


\newcommand\SecTitle[4]{%
\begin{tikzpicture}

    \node (A) [rectangle,minimum width=\textwidth, minimum height=1cm,color=white,fill=cor2, text width=\textwidth-3cm,align=left] {\hspace{1.5cm}\parbox{\textwidth}{\huge\textbf{\textsf{#4}}}};
    \fill[fill=cor1] (A.north west) -- ($(A.north west)+(1.5cm,0)$) -- ($0.5*(A.north west)-0.5*(A.north west)-(0.5*\textwidth-2.5cm,0)$)--($(A.south west)+(1.5cm,0)$)--(A.south west);
    \node [color=white](A.north west) at ($0.5*(A.north west)-0.5*(A.north west)-(0.5*\textwidth-1cm,0)$) {\Huge\textbf{\textsf{\thesection}}};

\end{tikzpicture}

}
\titleformat{\section}
{\normalfont}{}{0em}
{\SecTitle{east}{west}{0\paperwidth}{#1}}

\begin{document}

\chapter{Teste}

\section{Test Section One}
\lipsum[2]
\section{Test Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Tt Section Two}
\lipsum[2]
\clearpage
\section{Test Section Three}
\lipsum[2]
\section{Test Section Four}
\lipsum[2]

\end{document}

在此处输入图片描述

相关内容