关于 Bjornstrup 的疑问

关于 Bjornstrup 的疑问

\documentclass{scrbook}使用\usepackage[Bjornstrup]{fncychap}

我怎样才能将其设计成partpage类似于chapterpage-style的样子Bjornstrup

另外,我想将Bjornstrup另一个盒子的颜色改为灰色。这怎么可能呢?

答案1

这里有一个可能的解决方案:我重新定义了\partformat和 内部命令\@part( from scrbook.cls) 来模仿Bjornstrup章节的样式;我还重新定义了和\DOCH,如 所定义的那样,以允许可变颜色。现在,您可以控制部分和章节的背景颜色,只需重新定义(通过)颜色、 和 即可;使用和可以类似地更改所用数字的颜色:\DOTI\DOTISBjornstrup\colorletpartbgcolorchapbgcolorpartnumcolorchapnumcolor

\documentclass{scrbook}
\usepackage[Bjornstrup]{fncychap}
\usepackage{xcolor}

\colorlet{partbgcolor}{gray!30}% shaded background color for parts
\colorlet{partnumcolor}{gray}% color for numbers in parts
\colorlet{chapbgcolor}{gray!30}% shaded background color for chapters
\colorlet{chapnumcolor}{gray}% color for numbers in chapters

\renewcommand*\partformat{%
  \fontsize{76}{80}\usefont{T1}{pzc}{m}{n}\selectfont%
  \hfill\textcolor{partnumcolor}{\thepart}}

\makeatletter
\renewcommand*{\@part}{}
\def\@part[#1]#2{%
  \ifnum \c@secnumdepth >-2\relax
    \refstepcounter{part}%
    \@maybeautodot\thepart%
    \addparttocentry{\thepart}{#1}%
  \else
    \addparttocentry{}{#1}%
  \fi
  \begingroup
    \setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative
    \raggedpart
    \interlinepenalty \@M
    \normalfont\sectfont\nobreak
    \setlength\fboxsep{0pt}
    \colorbox{partbgcolor}{\rule{0pt}{40pt}%
    \makebox[\linewidth]{%
    \begin{minipage}{\dimexpr\linewidth+20pt\relax}
      \ifnum \c@secnumdepth >-2\relax
        \vskip-25pt
        \size@partnumber{\partformat}%
      \fi      %
      \vskip\baselineskip
      \hspace*{\dimexpr\myhi+10pt\relax}%
      \parbox{\dimexpr\linewidth-2\myhi-20pt\relax}{\raggedleft\LARGE#2\strut}%
      \hspace*{\myhi}\par\medskip%
    \end{minipage}%
      }%
    }%
    \partmark{#1}\par
  \endgroup
  \@endpart
}

\renewcommand\DOCH{%
  \settowidth{\py}{\CNoV\thechapter}
  \addtolength{\py}{-10pt}
  \fboxsep=0pt%
  \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


\begin{document}

\part{Test Part}
\chapter{Test Chapter}

\end{document}

各部分现在看起来如下:

在此处输入图片描述

并使用

\colorlet{partbgcolor}{LightSkyBlue}% shaded background color for parts
\colorlet{partnumcolor}{NavyBlue}% color for numbers in parts

你会得到:

在此处输入图片描述

相关内容