和titlesec

和titlesec

section我将更改文档的字体subsection。我已经使用类创建了它book。我将使用以下字体:

在此处输入图片描述

根据 Adob​​e pdf 专有性,此字体为 AvantGarde-Demi。如何在 Latex 中使用它。我应该使用什么命令在 latex 中重新创建它。我想我应该使用titlesec包,对吗?

答案1

您还可以使用sectsty

\documentclass{book}
%\usepackage{avant}
%\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}
%\renewcommand{\sfdefault}{pag} %% To make only sf fonts to be avant garde.
\usepackage{sectsty}
%\chapterfont{\fontfamily{pag}\selectfont} %% for chapter if you want
\sectionfont{\fontfamily{pag}\selectfont}
\subsectionfont{\fontfamily{pag}\selectfont} %% Similarly for others. see the manual of sectsty, section 5.
\begin{document}
\setcounter{secnumdepth}{3}
\chapter{Some chapter}
\section{Event Monitor Pattern}
\subsection{Some sub-section}
\subsubsection{Some sub sub section}

\end{document}

在此处输入图片描述

titlesec

\documentclass{book}
%\usepackage{avant}
%\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}
%\renewcommand{\sfdefault}{pag} %% To make only sf fonts to be avant garde.
\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\fontfamily{pag}\selectfont\huge\bfseries}
  {\chaptertitlename\ \thechapter}
  {20pt}
  {\Huge}
\titleformat{\section}
  {\fontfamily{pag}\selectfont\bfseries\Large}
  {\thesection}
  {1em}
  {}
\titleformat{\subsection}
  {\fontfamily{pag}\selectfont\bfseries\Large}
  {\thesection}
  {1em}
  {}
\begin{document}
\setcounter{secnumdepth}{3}
\chapter{Some chapter}
\section{Event Monitor Pattern}
\subsection{Some sub-section}
\subsubsection{Some sub sub section}

\end{document}

相关内容