改变 Bjornstrup 章节样式,使其具有圆边

改变 Bjornstrup 章节样式,使其具有圆边

我希望您能帮助我改变此文档的章节样式,使灰色背景的边缘略微呈圆角,并且可以改变背景右边缘和单词“A chapter”之间的水平空间。

\documentclass[11pt,a4paper]{report}
\usepackage[margin=2.5cm]{geometry}
\usepackage{xcolor}
\usepackage[calcwidth]{titlesec}
\usepackage{blindtext}
\usepackage{scrextend}
\usepackage{microtype}
\usepackage[leqno]{amsmath}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage[Bjornstrup]{fncychap} % <===================================



\colorlet{chapbgcolor}{gray!50}% shaded background color for chapters
\colorlet{chapnumcolor}{black!55}% color for numbers in chapters

\begin{document}
\sloppy
\chapter{A chapter}
Some text

\end{document}

答案1

以下是快速尝试生成类似内容的尝试。

\documentclass[11pt,a4paper]{report}
\usepackage[margin=2.5cm]{geometry}
\usepackage{xcolor}
\usepackage[calcwidth]{titlesec}
\usepackage{microtype}
%\usepackage[Bjornstrup]{fncychap} % <===================================
\usepackage{tikz}


\colorlet{chapbgcolor}{gray!50}% shaded background color for chapters
\colorlet{chapnumcolor}{black!55}% color for numbers in chapters
%from https://tex.stackexchange.com/a/233830/121799
\newcommand{\chaptitle}[1]{%
\begin{tikzpicture}
\fill[chapbgcolor!70,rounded corners=5pt] (0,2.5) rectangle (\linewidth,0);
\node[align=right,anchor=south east,inner sep=6pt,font=\Large\bfseries\sffamily] at (\linewidth,0) {#1};
\node[font=\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont\itshape\bfseries,text=chapnumcolor] at 
(\linewidth,2.5) {\thechapter};
\end{tikzpicture}
}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\sffamily}{}{25pt}{\chaptitle}
\titlespacing*{\chapter} {0pt}{110pt}{20pt}


\begin{document}
\sloppy
\chapter{A chapter}


Some text

\end{document}

在此处输入图片描述

相关内容