精美的章节标题样式

精美的章节标题样式

我想制作一个如图所示的精美章节。

期望输出

但是我编写了这个代码

\documentclass[12pt,a4paper]{book}


\usepackage{lmodern}
\usepackage{titlesec}
\usepackage{microtype}
\usepackage{tikz}



\titleformat{\chapter}[display]
  {\normalfont\bfseries\color{black}}
  {%\filleft%
    \begin{tikzpicture}
    \node[
      outer sep=-10pt,
      text width=2.5cm,
      minimum height=3cm,
      fill=black,
      font=\color{white}\fontsize{80}{90}\selectfont,
      align=center
      ] (num) {\thechapter};
    \node[
      rotate=0,
      anchor=south,
      font=\color{black}\Large\normalfont
      ] at ([yshift=43pt,xshift=30]num.west)  {\textls[180]{\textsc{\chaptertitlename}}};  
    \end{tikzpicture}%
 } 
  {-90pt}
  {\titlerule[2.5pt]\vskip3pt\titlerule\vskip4pt\LARGE\sffamily \raggedright }

  \begin{document}
\chapter{The Singular Sturm-Liouville Problems in Spectral Parameter}

  \end{document}  

产生了这个

期望输出

我怎样才能制作出像第一幅图那样的章节?

答案1

这是你想要的吗?

在此处输入图片描述

\documentclass[12pt,a4paper]{book}
\usepackage{lipsum} % dummy text

\usepackage{lmodern}
\usepackage[explicit]{titlesec}
\usepackage{microtype}
\usepackage{tikz}

\titleformat%
{\chapter}[hang]%
{\bfseries}{%
\begin{minipage}[t]{0.3\linewidth}  
\vspace{0pt}% do not remove
\begin{tikzpicture}
\node[
outer sep=0pt,
text width=2.5cm,
minimum height=2.5cm,
fill=black,
font=\color{white}\fontsize{80}{90}\selectfont,
align=center
] (num) {\thechapter};
\node[
outer sep=0pt,
inner sep=0pt,
anchor=south,
font=\color{black}\Large\normalfont
] at ([yshift=3pt]num.north) {\textls[180]{\textsc{\chaptertitlename}}};
\end{tikzpicture}  
\end{minipage}%
}
{0pt}%
{%
\begin{minipage}[t]{.7\linewidth}%
    \vspace{2pt} % do not remove
    \rule{\linewidth}{2.5pt}\\\vskip -1.75\baselineskip%
    \rule{\linewidth}{.7pt}\vskip 5pt
    {\LARGE\raggedright\textsf{#1}}
\end{minipage}%

}


\begin{document}
    \chapter{The Singular Sturm-Liouville Problems in Spectral Parameter}
    \lipsum[1]
\end{document}  

相关内容