我尝试对该部分进行样式设置以获得:
- 框框部分编号
- 章节标题之前和之后的规则
- 框应位于规则之间的中间位置
目前我有此代码,但未应用我的部分样式。但即使成功应用样式,我认为规则可能会出现在单独的页面上,但运气不好。如何保护块位于同一页面?
谢谢
梅威瑟:
%!TeX encoding = utf8
%!TeX spellcheck = fr_FR
\documentclass[a4paper,12pt,twoside,openright,openbib,final]{memoir}
\usepackage{luatextra}
\usepackage[usenames,dvipsnames,svgnames]{xcolor}
\usepackage[skins,most,listings,skins]{tcolorbox}
\checkandfixthelayout
\definecolor{bluegray}{HTML}{90C3D4}
\newcommand{\ruledsec}[1]{%
\vskip 1em
{\color{MidnightBlue}\hrule}
\vskip 1em
{\normalfont\Large\bfseries#1}
\vskip 1em
{\color{MidnightBlue}\hrule}
}
\newtcbox{\mybox}{
nobeforeafter,
colframe=bluegray!40,
colback=bluegray!40,
colupper=white,
boxrule=0.5pt,
arc=4pt,
boxsep=0pt,
right=6pt,
top=6pt,
bottom=6pt,
box align=center
}
\makepagestyle{BlueBox}
\makeheadstyles{BlueBox}{
\setsecheadstyle{\ruledsec}
}
\setsecnumformat{\csname #1secnumformat\endcsname} % numbering format
\newcommand\sectionsecnumformat{
\hspace{-5mm}
\mybox{\fontsize{2cm}{3.5cm}\selectfont\thesection}
\hspace{-2mm}
}
\headstyles{BlueBox}
\begin{document}
\chapter{chapter}
\section{section}
\subsection{subsection}
\end{document}