如何在 fncychap 中更改章节样式的背景颜色?(\usepackage[Bjornstrup]{fncychap})

如何在 fncychap 中更改章节样式的背景颜色?(\usepackage[Bjornstrup]{fncychap})

我正在做一个大学项目,我想改变包Bjornstrup中chapterstyle 获得的框的颜色fncychap。我现在有以下内容:

在此处输入图片描述

我非常希望灰色框是一个带有颜色的框\definecolor{aaublue}{RGB}{33,26,82}。理想情况下,由于颜色很暗,文本应该是白色的。

文档类如下:\documentclass[12pt,a4paper,openright]{report}

所使用的文档模板可在此站点找到:https://da.overleaf.com/latex/templates/aalborg-university-aau-report-template/ckfhtmfkpjvv

我确实不是乳胶专家,所以我希望我提供的信息足以解决这个问题。

答案1

添加下面的代码\usepackage[Bjornstrup]{fncychap}(并选择您喜欢的颜色):

\newcommand{\colortitlechap}{\color[rgb]{0.9,0.9,0.9}} % color of the chapter title <<<
\newcommand{\colornumberchap}{\color[rgb]{0.6,0.6,0.6}} % color of the chapter number <<<<
\newcommand{\colorbackchap}{\colorbox[rgb]{.129,0.1,0.82}} % color of the background rules <<<

\makeatletter

\renewcommand{\DOCH}{%
    \settowidth{\py}{\CNoV\thechapter}
    \addtolength{\py}{-10pt}% 
    \fboxsep=0pt%
    \colorbackchap{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
    \kern-\py\raise20pt%
    \hbox{\colornumberchap\CNoV\thechapter}\\%
}

\renewcommand{\DOTI}[1]{%
    \nointerlineskip\raggedright%
    \fboxsep=\myhi%
    \vskip-1ex%
    \colorbackchap{\parbox[t]{\mylen}{\CTV\FmTi{\colortitlechap#1}}}\par\nobreak%
    \vskip 40\p@%
}

\renewcommand{\DOTIS}[1]{%
    \fboxsep=0pt%
    \colorbackchap{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
    \nointerlineskip\raggedright%
    \fboxsep=\myhi%
    \colorbackchap{\parbox[t]{\mylen}{\CTV\FmTi{\colortitlechap#1}}}\par\nobreak%
    \vskip 40\p@%
}

\makeatother

d

C

这是完整的代码。

\documentclass[a4paper,12pt]{report}

\usepackage[Bjornstrup]{fncychap}
%%%% ******************************************************* added
\newcommand{\colortitlechap}{\color[rgb]{0.9,0.9,0.9}} % color of the chapter title <<<
\newcommand{\colornumberchap}{\color[rgb]{0.6,0.6,0.6}} % color of the chapter number <<<<
\newcommand{\colorbackchap}{\colorbox[rgb]{.129,0.1,0.82}} % color of the background rules <<<

\makeatletter

\renewcommand{\DOCH}{%
    \settowidth{\py}{\CNoV\thechapter}
    \addtolength{\py}{-10pt}% 
    \fboxsep=0pt%
    \colorbackchap{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
    \kern-\py\raise20pt%
    \hbox{\colornumberchap\CNoV\thechapter}\\%
}

\renewcommand{\DOTI}[1]{%
    \nointerlineskip\raggedright%
    \fboxsep=\myhi%
    \vskip-1ex%
    \colorbackchap{\parbox[t]{\mylen}{\CTV\FmTi{\colortitlechap#1}}}\par\nobreak%
    \vskip 40\p@%
}

\renewcommand{\DOTIS}[1]{%
    \fboxsep=0pt%
    \colorbackchap{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
    \nointerlineskip\raggedright%
    \fboxsep=\myhi%
    \colorbackchap{\parbox[t]{\mylen}{\CTV\FmTi{\colortitlechap#1}}}\par\nobreak%
    \vskip 40\p@%
}

\makeatother
%%*******************************************************************************
\begin{document}

    \tableofcontents   
    \chapter{Introduccion}
    \section{One}   
    \chapter{Technical content}
    \section{Two}
    
\end{document}

相关内容