那么如何进行修订其样式,下面网友给了一个方案另辟蹊径,抛开了该宏包,自己动手来实现,实际其代码复杂度也很一般。
% openany to make a side by side picture
\documentclass[11pt,a4paper,openany]{book}
\usepackage{titlesec}
\usepackage{titleps}
\usepackage{tikz}
\newcommand{\chapnumfont}{%
\fontsize{100}{100}\usefont{T1}{ptm}{b}{n}%
}
\colorlet{chapbgcolor}{gray!75}
\colorlet{chapnumcolor}{black!60}
\newcommand{\chaptitlenumbered}[1]{%
\begin{tikzpicture}
\fill[chapbgcolor!70,rounded corners=0pt] (0,2.3) rectangle (\linewidth,0);
\node[
align=right,
anchor=south east,
inner sep=8pt,
font=\huge\normalfont\bfseries
] at (0.987\linewidth,0) {\strut#1};
\node[
align=right,
font=\fontsize{60}{62}\usefont{OT1}{ptm}{b}{it},
text=chapnumcolor
] at (0.975\linewidth,2.1) {\thechapter};
\end{tikzpicture}%
}
\newcommand{\chaptitleunnumbered}[1]{%
\begin{tikzpicture}
\fill[chapbgcolor!70,rounded corners=0pt] (0,2.3) rectangle (\linewidth,0);
\node[
align=right,
anchor=south east,
inner sep=8pt,
font=\huge\normalfont\bfseries
] at (0.987\linewidth,0) {\strut#1};
\end{tikzpicture}%
}
\titleformat{name=\chapter}[display]
{\normalfont\huge\bfseries\sffamily}
{}
{0pt}
{\chaptitlenumbered}
\titleformat{name=\chapter,numberless}[display]
{\normalfont\huge\bfseries\sffamily}
{}
{25pt}
{\chaptitleunnumbered}
\titlespacing*{\chapter}
{0pt}
{-126pt}
{33pt}
\setlength\headheight{15pt}
\begin{document}
\tableofcontents
\chapter{A chapter}
\mbox{}
\newpage
More text...
\newpage
Even more text...
\end{document}样式效果图如下,显示效果也是非常不错:
其代码修正版本看看这个链接:https://tex.stackexchange.com/questions/463598/title-spacing-in-bjornstrup-chapter-removing-chapter-number-from-contents


发表评论 取消回复