\章节标题样式

\章节标题样式

昨天,我看到了一篇关于我喜欢的章节标题样式的帖子。我想知道您是否可以帮助我实现相同的模型(尽管与我想要的模型存在某些差异)。提前谢谢您。

章节标题书

 \documentclass[a4paper]{book}
 \usepackage[T1]{fontenc}
 \usepackage{libertine}
 \usepackage[table]{xcolor}
 \makeatletter
 \def\@part[#1]#2{%
  \ifnum \c@secnumdepth >-2\relax
  \addcontentsline{toc}{chapter}{\thechapter\hspace{1em}#1}%
 \else
  \addcontentsline{toc}{chapter}{#1}%
 \fi
\markboth{}{}%
\reset@font
\parindent \z@ 
\vspace*{10\p@}%
\hbox{%
 \vbox{%
  \hsize=7mm%
  \begin{tabular}{@{}p{7mm}@{}}
    \makebox[7mm]{\scshape\strut\small\chaptername}\\
    \makebox[7mm]{\cellcolor{black}\Huge\color{white}\bfseries\strut\thechapter\rule[-4cm]{0pt}{4cm}}%
  \end{tabular}%
  \makebox(0,0){\put(-10,-100){\fbox{\phantom{\rule[-4cm]{7mm}{4cm}}}}}
  }%
\kern-2pt
\vbox to 0pt{%
   \tabular[t]{@{}p{1cm}p{\dimexpr\hsize-2.1cm}@{}}\hline
      & \Huge\itshape\rule{0pt}{1.5\ht\strutbox}#1\endtabular}%
   }%
  \cleardoublepage
%  \vskip 100\p@
}
       \makeatother

   \begin{document}
   \chapter{Books in \LaTeX}


text text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.

      \end{document}

答案1

\documentclass[a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[table]{xcolor}
\makeatletter
\def\@chapter[#1]#2{%
  \cleardoublepage
  \refstepcounter{chapter}%
  \ifnum \c@secnumdepth >-2\relax
    \addcontentsline{toc}{chapter}{\chaptername~\thechapter\hspace{1em}#1}%
  \else
    \addcontentsline{toc}{chapter}{#1}%
  \fi
\markboth{}{}%
\reset@font
\parindent \z@ 
\vspace*{10\p@}%
    \hbox{%
        \vbox{%
            \hsize=7mm%
            \begin{tabular}{@{}p{7mm}@{}}
                \makebox[7mm]{\scshape\strut\small\chaptername}\\
                \makebox[7mm]{\cellcolor{black}\Huge\color{white}\bfseries\strut\thechapter\rule[-4cm]{0pt}{4cm}}%
            \end{tabular}%
            \makebox(0,0){\put(-10,-100){\fbox{\phantom{\rule[-4cm]{7mm}{4cm}}}}}
        }%
        \kern-2pt
        \vbox to 0pt{%
            \tabular[t]{@{}p{1cm}p{\dimexpr\hsize-2.1cm}@{}}\hline
            & \Huge\itshape\rule{0pt}{1.5\ht\strutbox}#1\endtabular}%
    }%
    \vskip 100\p@
} \makeatother

\usepackage{blindtext}
\begin{document}
    \tableofcontents
    \chapter{Books in \LaTeX}

    text text text text text text text text text text text text text text text text text text text 
    text text text text text text text text text text text text text text text text text text text 
    text text text text text text text text text text text text text text text text text text text 
    text text text text text text text text text text text text text text text text text. 

\blinddocument
\end{document}

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

相关内容