由于某种原因,我的“语言”章节没有正确显示:就好像它的某些部分不符合我的页面布局(参见屏幕截图中的 A)。
此外,这可能与此相关,现在“第 1 章”后面紧接着出现了一个空白页,而“第 2 章”应该出现在那里(参见屏幕截图中的 B)。
任何帮助都将不胜感激。谢谢。
% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,oneside,centered]{book}
\special{papersize=210mm,297mm}
\usepackage[top=3cm, bottom=3.2cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage{newpxtext} % Font for document instead of obsolete Palatino
\usepackage{tocloft} % Customization of TOC LOF LOT
\usepackage[table,xcdraw]{xcolor} % For shading in tables
\usepackage{pdfcolmk}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage{ltablex}
\usepackage{nicefrac} % to write fractions
\usepackage{attrib} % For source of quotations
\usepackage{lettrine} % For NewThought formatting
\usepackage{array} % To define width of columns in long table
\usepackage{booktabs} % Nicer spacing in columns
\usepackage{siunitx} % To write Celsius, etc.
\usepackage{enumitem} % To create item lists
\usepackage{caption} % To change way captions are labelled
\usepackage{scrextend}
\usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
\usepackage{etoolbox} % To make table footnote font smaller
\usepackage{threeparttablex}
\appto\TPTnoteSettings{\footnotesize}
% Creating Index
\usepackage{imakeidx}
\makeindex
%\indexsetup{othercode=\small}
%\makeindex[columns=3,title=Index,intoc,options={-s indexstyle.ist}]
%\usepackage{showidx} %To print all index entries in right margin to proofread entries
\usepackage{blindtext}
%\usepackage{showframe}
% Styling Chapter appearance
\usepackage[T1]{fontenc}
\usepackage{titlesec, color}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}
{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
\usepackage{hyperref} % Hyperlinks
\usepackage[toc]{glossaries}
\makeglossaries
%%%%%TEST_ZONE%%%%%%
\newglossaryentry{naiive}
{
name=na\"{\i}ve,
description={is a French loanword (adjective, form of naïf)
indicating having or showing a lack of experience,
understanding or sophistication}
}
%%%%%TEST_ZONE%%%%%%
%Table of Content depth
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{5}
\setlength{\parindent}{15pt}
%Hyperlinks for TOC
\makeatletter
\hypersetup{
colorlinks,
citecolor=blue,
filecolor=blue,
linkcolor=blue,
urlcolor=blue
}
\begin{document}
%\layout
% FRONTMATTER STARTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\frontmatter
\title{The Book of Wonders}
\maketitle
\tableofcontents
\clearpage
\listoftables
\clearpage
\thispagestyle{plain} % To not have "List of Tables appear" at the top of the "Preface" page
\section*{Preface}
\blindtext
\clearpage
\thispagestyle{plain} % To not have "List of Tables appear" at the top of the "Preface" page
\section*{Introduction}
\blindtext
\clearpage
% MAINMATTER STARTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mainmatter
\chapter{The Story}
\section{Data}
\index{Plants}
\index{star}
\index{Mu}
\index{Sinis}
\index{Ball}
\chapter{Languages}
\section{Pronunciation}
\section{Scripts}
\subsection{Tina}
\subsubsection{Consonants}
\subsubsection{Vowels}
\subsubsection{Numerals}
\subsubsection{Special Symbols}
\subsection{Anna}
\subsubsection{Consonants}
\subsubsection{Vowel Diacritics}
\subsubsection{Diphthongal Diacritics}
\subsubsection{Numerals}
\subsubsection{Special Symbols}
\subsubsection{Common Determinatives}
\subsection{Herbert}
\subsubsection{Consonants}
\subsubsection{Vowel Diacritics}
\subsubsection{Consonants}
\subsubsection{Vowels}
\subsubsection{Numerals}
\subsubsection{Special Symbols}
\subsection{Jennifer}
\subsubsection{Consonants}
\subsubsection{Vowel Diacritics}
\subsubsection{Special Symbols}
\subsection{Mike}
\subsubsection{Consonants}
\subsubsection{Vowel Diacritics}
\subsubsection{Special Symbols}
\subsection{Script Samples}
\backmatter
\printglossaries
\printindex
\end{document}
答案1
好的,我会尝试一下:
所有分段命令都不允许在其后立即出现分页符,以防止它们单独存在。一旦将文本添加到相应的部分,将自动出现分页符后文本。
因此,添加任意文本,或 \mbox{} 作为大卫建议可以解决你的问题。
对于背景我自己做了一些研究,并将尽力根据命令进行解释\section
:
命令\section
book
班级定义为
\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
其中的\@startsection
命令实际上是一个低级的 TeX 命令:
\def\@startsection#1#2#3#4#5#6{%
\if@noskipsec \leavevmode \fi
\par
\@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak
\everypar{}%
\else
\addpenalty\@secpenalty\addvspace\@tempskipa
\fi
\@ifstar
{\@ssect{#3}{#4}{#5}{#6}}%
{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
这里我们有一个\if@nobreak \everypar{}
,它延迟\nobreak
命令直到文本添加完毕,以防止该文本与分段命令分离(来源)。一旦 (La)TeX 遇到文本,就会\nobreak
插入。
现在,我认为,原文\nobreak
是由\@xsect
命令插入的,定义在latex.ltx
\def\@xsect#1{%
\@tempskipa #1\relax
\ifdim \@tempskipa>\z@
\par \nobreak
\vskip \@tempskipa
\@afterheading
\else
\@nobreakfalse
\global\@noskipsectrue
\everypar{%
\if@noskipsec
\global\@noskipsecfalse
{\setbox\z@\lastbox}%
\clubpenalty\@M
\begingroup \@svsechd \endgroup
\unskip
\@tempskipa #1\relax
\hskip -\@tempskipa
\else
\clubpenalty \@clubpenalty
\everypar{}%
\fi}%
\fi
\ignorespaces}
它又被\@sect
ever 中使用的宏调用@startsection
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\protected@edef\@svsec{\@seccntformat{#1}\relax}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup
#6{%
\@hangfrom{\hskip #3\relax\@svsec}%
\interlinepenalty \@M #8\@@par}%
\endgroup
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
\else
\def\@svsechd{%
#6{\hskip #3\relax
\@svsec #8}%
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}}%
\fi
\@xsect{#5}}