Bjornstrup 章节中的标题间距,从目录中删除章节编号

Bjornstrup 章节中的标题间距,从目录中删除章节编号

在此处输入图片描述我想在使用 Bjornstrup 包时使每个章节标题下方的垂直间距相同(即,降部不会影响间距 - 如下图红色箭头所示)。我认为我对“A chapter”周围的间距相当满意,因此我真的希望没有降部的标题(例如“Contents”)具有与标题下方的“A chapter”相同的垂直间距。我还想删除内容标题中的大“0”。一如既往,任何帮助都值得感激。

\documentclass[11pt,a4paper]{book}

% Packages[![enter image description here][1]][1]

\usepackage[left=3.5cm, right=3.5cm, top=4.3cm, bottom=4.25cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{MnSymbol}
\usepackage{xcolor}
\usepackage{scrextend}
\usepackage[calcwidth]{titlesec}
\usepackage{titleps}
\usepackage{microtype}
\usepackage[Bjornstrup]{fncychap} 
\usepackage{tikz}
\usepackage{lettrine}
\usepackage{enumitem}
\usepackage{type1cm} 
\usepackage{amsthm,thmtools}
\usepackage[framemethod=tikz,%
innerleftmargin=0pt
skipabove=0pt,
skipbelow=0pt,
innertopmargin=0pt,
innerrightmargin=0pt,
topline=false,
rightline=false,
bottomline=false,
topline=false,
leftline=false,
innerbottommargin=0pt]{mdframed}

\setlength{\parindent}{0.67cm}

% Section

% Fonts 

\protected\def\mathbb#1{\text{\usefont{U}{msb}{m}{n}#1}} 

% Header and Footer

% Chapter

\newcommand{\chapnumfont}{
  \usefont{T1}{pnc}{b}{n}
  \fontsize{100}{100}
  \selectfont
}

\renewcommand\DOCH{
  \settowidth{\py}{\CNoV\thechapter}
  \addtolength{\py}{0pt}
  \fboxsep=40pt
  \colorbox{chapbgcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}
  \kern-\py\raise20pt
  \hbox{\color{chapnumcolor}\CNoV\thechapter}\\
}

\renewcommand\DOTI[1]{
  \nointerlineskip\raggedright
  \fboxsep=\myhi
  \vskip-1ex
  \colorbox{chapbgcolor}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak
  \vskip 40pt
}

\renewcommand\DOTIS[1]{
  \fboxsep=0pt
  \colorbox{chapbgcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\
  \nointerlineskip\raggedright
  \fboxsep=\myhi
  \colorbox{chapbgcolor}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak
  \vskip 40pt
 }
\makeatother


\colorlet{chapbgcolor}{gray!75}
\colorlet{chapnumcolor}{black!60}

\newcommand{\chaptitle}[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) {#1};
\node[font=\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont\itshape\bfseries,text=chapnumcolor] at 
(0.975\linewidth,2.1) {\sloppy\thechapter};
\end{tikzpicture}
}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\sffamily}{}{25pt}{\chaptitle}
\titlespacing*{\chapter} {0pt}{-126pt}{33pt}

\setlength\headheight{15pt}

\begin{document}
\tableofcontents
\chapter{A chapter}
\mbox{}
\newpage
More text...
\newpage
Even more text...
\end{document}

答案1

我会避免写两个不同的命令。如果你想调整外观,你必须做两次。TiZ 有 pgfkeys,允许您使用 来打开编号,使用 来\tikzset{title number=true}关闭编号\tikzset{title number=false}。要保持距离相同,您只需添加适当的文本深度。

\documentclass[11pt,a4paper]{book}

% Packages[![enter image description here][1]][1]

\usepackage[left=3.5cm, right=3.5cm, top=4.3cm, bottom=4.25cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{MnSymbol}
\usepackage{xcolor}
\usepackage{scrextend}
\usepackage[calcwidth]{titlesec}
\usepackage{titleps}
\usepackage{microtype}
\usepackage[Bjornstrup]{fncychap} 
\usepackage{tikz}
\usepackage{lettrine}
\usepackage{enumitem}
\usepackage{type1cm} 
%\usepackage{amsthm,thmtools} % see https://tex.stackexchange.com/a/41551/121799
\usepackage[framemethod=tikz,%
innerleftmargin=0pt
skipabove=0pt,
skipbelow=0pt,
innertopmargin=0pt,
innerrightmargin=0pt,
topline=false,
rightline=false,
bottomline=false,
topline=false,
leftline=false,
innerbottommargin=0pt]{mdframed}

\setlength{\parindent}{0.67cm}

% Section

% Fonts 

\protected\def\mathbb#1{\text{\usefont{U}{msb}{m}{n}#1}} 

% Header and Footer

% Chapter

\newcommand{\chapnumfont}{
  \usefont{T1}{pnc}{b}{n}
  \fontsize{100}{100}
  \selectfont
}

\renewcommand\DOCH{
  \settowidth{\py}{\CNoV\thechapter}
  \addtolength{\py}{0pt}
  \fboxsep=40pt
  \colorbox{chapbgcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}
  \kern-\py\raise20pt
  \hbox{\color{chapnumcolor}\CNoV\thechapter}\\
}

\renewcommand\DOTI[1]{
  \nointerlineskip\raggedright
  \fboxsep=\myhi
  \vskip-1ex
  \colorbox{chapbgcolor}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak
  \vskip 40pt
}

\renewcommand\DOTIS[1]{
  \fboxsep=0pt
  \colorbox{chapbgcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\
  \nointerlineskip\raggedright
  \fboxsep=\myhi
  \colorbox{chapbgcolor}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak
  \vskip 40pt
 }
\makeatother


\colorlet{chapbgcolor}{gray!75}
\colorlet{chapnumcolor}{black!60}

\newif\ifShowTitleNo
\tikzset{title number/.is if=ShowTitleNo} 
\tikzset{title number=false} 

\newcommand{\chaptitle}[1]{
\begin{tikzpicture}
\fill[chapbgcolor!70,rounded corners=0pt] (0,2.3) rectangle (\linewidth,0);
\node[align=right,text depth=0.25ex,anchor=south east,inner sep=8pt,font=\huge\normalfont\bfseries] at (0.987\linewidth,0) {#1};
\ifShowTitleNo
\node[font=\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont\itshape\bfseries,text=chapnumcolor] at 
(0.975\linewidth,2.1) {\sloppy\thechapter};
\fi

\end{tikzpicture}
}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\sffamily}{}{25pt}{\chaptitle}
\titlespacing*{\chapter} {0pt}{-126pt}{33pt}

\setlength\headheight{15pt}

\begin{document}
\tableofcontents
\tikzset{title number=true}
\chapter{A chapter}
\mbox{}
\newpage
More text...
\newpage
Even more text...
\end{document}

在此处输入图片描述

在此处输入图片描述

答案2

没有必要加载fncychap(永远不需要?),因为您正在用 完全重新定义章节标题titlesec

可以通过为编号和未编号的章节定义不同的样式来消除编号。

% 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}

在此处输入图片描述

相关内容