标题字体,章节,节

标题字体,章节,节

我正在努力获取像下图这样的章节部分。

到目前为止,我得到的基本上没有产生我想要的切片

在此处输入图片描述

我的代码如下;

\usepackage{titlesec,geometry,lipsum}
\usepackage[export]{adjustbox}
\geometry{a4paper, portrait, margin=1in}
%Chapter Headers
\titleformat{\chapter}[display]
  {\normalfont\Large\raggedleft}
  {\adjustbox{lap=.7\width}{\MakeUppercase{\chaptertitlename}%
    \resizebox{!}{1.5cm}{\thechapter} \rule{7cm}{1.5cm}}}
  {10pt}{\huge\bfseries\raggedright}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}


\begin{document}

\chapter{Introduction}

\end{document}

答案1

一种可能的方法:

\documentclass{book}

\usepackage[T1]{fontenc}
\usepackage{newtxtext}


\usepackage{titlesec,geometry}
\geometry{a4paper, portrait, margin=1in}

\titleformat{\chapter}[display]
  {\huge}
  {\filleft\textsc{\large\chaptertitlename}%
      \makebox[0pt]{\hspace{2em}\fontsize{40}{48}\selectfont\sffamily\bfseries\thechapter}}
  {1ex}
  {\titlerule \vspace{1ex}%
      \filleft\bfseries\sffamily}

\begin{document}
\chapter{Introduction}

\end{document}

输出:

在此处输入图片描述

答案2

利用一些 tikz 帮助实现覆盖:

\documentclass{book}
\usepackage{titlesec,geometry,lipsum}
\usepackage[export]{adjustbox}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\chaptikzmark}{\begin{tikzpicture}[remember picture,overlay] \coordinate (Chap\arabic{mychapter});\end{tikzpicture}}
\newcounter{mychapter}
\newcommand\AddNumber{\begin{tikzpicture}[remember picture,overlay,baseline=0] \node[shift={(6mm,0.55cm)}] at (Chap\arabic{mychapter}) {\resizebox{1cm}{!}{\bfseries\arabic{chapter}}};\end{tikzpicture}}

\geometry{a4paper, portrait, margin=1in}
%Chapter Headers
\titleformat{\chapter}[display]
  {\normalfont\Large\raggedleft}
  {\MakeUppercase{\chaptertitlename}%
    \refstepcounter{mychapter}\chaptikzmark}
  {10pt}{\raggedleft\rule{\textwidth}{0.35mm}\linebreak\huge\bfseries\AddNumber}



\titlespacing*{\chapter}{0pt}{30pt}{20pt}

\titleformat{name=\chapter,numberless}[display]
  {\normalfont\Large\raggedleft}
  {\MakeUppercase{\chaptertitlename}%
  }
  {10pt}{\raggedleft\rule{\textwidth}{0.35mm}\linebreak\huge\bfseries}  

\begin{document}

\chapter{Introduction}
\chapter*{Test}
\chapter{A new chapter}

\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容