在我的脚本样式文档中,章节、节等都使用 titlesec 进行格式化。它配置为\cleardoublepage
在新章节前插入命令,\clearpage
在新节前插入命令。但是,该\clearpage
命令似乎使其\titlespacing{\section}
不起作用。我想增加节标题和页面顶部之间的间距。
我尽力创建了一个最小工作示例,该示例仍能显示我的问题。它似乎很长,但我认为它只包含相关信息。
\documentclass[
11pt,
a4paper,
DIV=calc,
headinclude, footincude,
headsepline, footsepline,
twoside,
openright,
british
]{scrreprt} %scrreprt/scrartcl
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[bindingoffset=8mm, left=2.1cm,right=2.1cm,top=2.5cm,bottom=2cm]{geometry}
\setlength{\footskip}{11mm}
\usepackage{scrlayer-scrpage}
\setlength{\headheight}{17pt}
\pagestyle{scrheadings}
\usepackage{setspace}
\setstretch{1.2}
\usepackage{apptools}
\usepackage{titlesec}
% Chapter def
\newcommand{\chapterbreak}{\cleardoublepage}
\titleformat{\chapter} % command
[display] % shape
{\fontfamily{qag}\selectfont\huge\raggedleft\scshape} % format
{\filleft\fontfamily{qag}\selectfont
\IfAppendix{}{\bfseries\large\chaptername}\,\scalebox{5}{\color{lightgray}\thechapter}}%
{-2ex} % sep between label and title
{
\color{darkgray}\rule{\textwidth}{2pt}
\vspace{1ex}
} % before-code
%[] %after-code
\titlespacing{\chapter}
{0pc} %left margin
{-4ex} %before sep
{4pc} %after sep
% Section def
\newcommand{\sectionbreak}{\clearpage} % <------- This sets the clearpage before a new section
\titleformat{\section} %command
[hang] %shape
{\normalfont\Large\bfseries} %format
{\thesection.}
{0.5em}
{}
%[]
\titlespacing{\section}{0pc}{70px}{70px} %<----------- Here is the problem !!
\begin{document}
\chapter{Chuck Norris}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\section{First Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\section{Second Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\chapter{NoAppendix - Normal Chapter}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\appendix
\chapter{Appendix}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\end{document}
答案1
不确定我是否理解正确...但为了在之后使用空格,\cearpage
您可能需要一个\null
命令,以便它为vspace
清除的页面中即将到来的内容“创建一个初始点”:
\documentclass[
11pt,
a4paper,
DIV=calc,
headinclude, footincude,
headsepline, footsepline,
twoside,
openright,
british
]{scrreprt} %scrreprt/scrartcl
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[bindingoffset=8mm, left=2.1cm,right=2.1cm,top=2.5cm,bottom=2cm]{geometry}
\setlength{\footskip}{11mm}
\usepackage{scrlayer-scrpage}
\setlength{\headheight}{17pt}
\pagestyle{scrheadings}
\usepackage{setspace}
\setstretch{1.2}
\usepackage{apptools}
\usepackage{titlesec}
% Chapter def
\newcommand{\chapterbreak}{\cleardoublepage}
\titleformat{\chapter} % command
[display] % shape
{\fontfamily{qag}\selectfont\huge\raggedleft\scshape} % format
{\filleft\fontfamily{qag}\selectfont
\IfAppendix{}{\bfseries\large\chaptername}\,\scalebox{5}{\color{lightgray}\thechapter}}%
{-2ex} % sep between label and title
{
\color{darkgray}\rule{\textwidth}{2pt}
\vspace{1ex}
} % before-code
%[] %after-code
\titlespacing{\chapter}
{0pc} %left margin
{-4ex} %before sep
{4pc} %after sep
% Section def
\newcommand{\sectionbreak}{\clearpage\null} % <------- This sets the clearpage before a new section (koleygr: edited)
\titleformat{\section} %command
[hang] %shape
{\normalfont\Large\bfseries} %format
{\thesection.}
{0.5em}
{}
%[]
\titlespacing{\section}{0pc}{70px}{70px} %<----------- Here is the problem !!
\begin{document}
\chapter{Chuck Norris}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\section{First Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\section{Second Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\chapter{NoAppendix - Normal Chapter}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\appendix
\chapter{Appendix}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...
\end{document}