我在处理多行标题时遇到了问题,它们会根据标题所占的行数强制将标题规则向下移动。我希望我的标题规则得到修复,这样当我写多行标题时它就不会移动。以下是我的 MWE:
\documentclass[11pt,openany,twoside]{book}
\usepackage{geometry}
\usepackage{parskip}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage[dotinlabels]{titletoc}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{hhline}
\fancypagestyle{fancy}{%
\fancyhf{}
\fancyhead[OL]{\myheaderfooterfont\leftmark}
\fancyhead[ER]{\myheaderfooterfont\rightmark}
}
\fancypagestyle{plain}{%
\fancyhf{}%
}
\pagestyle{fancy}
\usepackage[noindentafter,calcwidth]{titlesec}
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesubsection}{1em}{}
\usepackage{calc,pifont}
\usepackage{multirow}
\newcommand*\myheaderfooterfont{\normalfont\bfseries\sffamily}
\usepackage[nottoc]{tocbibind}
\usepackage[ragged]{sidecap}
\usepackage[marginal]{footmisc}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
}
\begin{document}
\frontmatter
\tableofcontents
\listoffigures
\listoftables
\mainmatter
\chapter{Outline of The Uonw HAUnn HUAH}
\chapter{Typing Equations and matrices in LATEX and Special keyboard characters in LATEX shshhw eeehuwhuw wjwjwj whij3ooeok i3jijei ejeejedijeejo
}
\section{Equations and Matrices}
\subsection{Equations}
\AmS{} package is loaded to typeset Higher Mathematics equations. A single equation can be on one line, several lines (no alignment) and several lines (with alignment). Also equation groups can be without alignment, with simple alignment and or multiple alignment. Equations can also be in cases.
\begin{equation}\label{eq:1}
\begin{split}
\lvert I_2 \rvert &= \left\lvert \int_{0}^T \psi(t)
\left\{ u(a, t) - \int_{\gamma(t)}^a \frac{d\theta}{k}
(\theta, t) \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi
\right\} dt \right\rvert \\
&\le C_6 \Biggl\lvert
\left\lvert f \int_\Omega \left\lvert
\widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)
\right\rvert \ \right\rvert
\left\lvert \lvert u \rvert
\overset{\circ}{\to} W_2^{\widetilde{A}} (\Omega; \Gamma_r,T)
\right\rvert \Biggr\rvert
\end{split} \end{equation}
\subsection{Matrices}
Here are samples of the matrix environments,
\verb+matrix+, \verb+pmatrix+, \verb+bmatrix+, \verb+Bmatrix+, \verb+vmatrix+
and \verb+Vmatrix+:
\begin{equation}\label{eq:2}
\begin{matrix}
\vartheta& \varrho\\\varphi& \varpi
\end{matrix}\quad
\begin{pmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{pmatrix}\quad
\begin{bmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{bmatrix}\quad
\begin{Bmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{Bmatrix}\quad
\begin{vmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{vmatrix}\quad
\begin{Vmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{Vmatrix}
\end{equation}
\section{Special keyboard characters}
\LaTeX{} has many symbols at its disposal. The majority of them are within the mathematical domain as shown in \eqref{eq:1} and \eqref{eq:2}. The ten special keyboard characters are: \verb|#|, \verb|$|, \verb|%|, \verb|&|, \verb|~|, \verb|_|, \verb|^|, \verb|\| and \verb|{}|. If you simply want the character to be printed just as any other letter, include a \verb|\ | in front of the character. For example, \verb|\$| will produce \verb|$| in your output.
The exception to the rule is the \verb|\ | itself because \verb|\\ | has its own special meaning. A \verb|\ | is produced by typing \verb|$\backslash$| in your file.
\end{document}
答案1
使用geometry
包可以为标题提供更大的空间。例如:
\usepackage[
%showframe,% show margins
includehead,
top=10mm, % with includehead from page top to head
headheight = 3\baselineskip,% header's height
headsep = 5mm,% from header to body text
]{geometry}
简称
长标题
这是完整的代码。
% !TeX TS-program = pdflatex
\documentclass[11pt,openany,twoside]{book}
\usepackage[
%showframe,% show margins
includehead,
top=10mm, % with includehead from page top to head
headheight = 3\baselineskip,% header's height
headsep = 5mm,% from header to body text
]{geometry} % changed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\usepackage{kantlipsum} % dummy text
\usepackage{parskip}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage[dotinlabels]{titletoc}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{hhline}
\fancypagestyle{fancy}{%
\fancyhf{}
\fancyhead[OL]{\myheaderfooterfont\leftmark}
\fancyhead[ER]{\myheaderfooterfont\rightmark}
\fancyfoot[C]{\thepage}% added <<<<<<<<<<<<<<<<
}
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[C]{\thepage}% added <<<<<<<<<<<<<<<<
\renewcommand{\headrulewidth}{0pt}% added <<<<<<<<<<<<<<<<
}
\pagestyle{fancy}
\usepackage[noindentafter,calcwidth]{titlesec}
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesubsection}{1em}{}
\usepackage{calc,pifont}
\usepackage{multirow}
\newcommand*\myheaderfooterfont{\normalfont\bfseries\sffamily}
\usepackage[nottoc]{tocbibind}
\usepackage[ragged]{sidecap}
\usepackage[marginal]{footmisc}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
}
\begin{document}
\frontmatter
\tableofcontents
\listoffigures
\listoftables
\mainmatter
\chapter{Outline of The Uonw HAUnn HUAH}
\kant[2-10]
\chapter{Typing Equations and matrices in LATEX and Special keyboard characters in LATEX shshhw eeehuwhuw wjwjwj whij3ooeok i3jijei ejeejedijeejo}
\section{Equations and Matrices}
\subsection{Equations}
\AmS{} package is loaded to typeset Higher Mathematics equations. A single equation can be on one line, several lines (no alignment) and several lines (with alignment). Also equation groups can be without alignment, with simple alignment and or multiple alignment. Equations can also be in cases.
\begin{equation}\label{eq:1}
\begin{split}
\lvert I_2 \rvert &= \left\lvert \int_{0}^T \psi(t)
\left\{ u(a, t) - \int_{\gamma(t)}^a \frac{d\theta}{k}
(\theta, t) \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi
\right\} dt \right\rvert \\
&\le C_6 \Biggl\lvert
\left\lvert f \int_\Omega \left\lvert
\widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)
\right\rvert \ \right\rvert
\left\lvert \lvert u \rvert
\overset{\circ}{\to} W_2^{\widetilde{A}} (\Omega; \Gamma_r,T)
\right\rvert \Biggr\rvert
\end{split} \end{equation}
\subsection{Matrices}
Here are samples of the matrix environments,
\verb+matrix+, \verb+pmatrix+, \verb+bmatrix+, \verb+Bmatrix+, \verb+vmatrix+
and \verb+Vmatrix+:
\begin{equation}\label{eq:2}
\begin{matrix}
\vartheta& \varrho\\\varphi& \varpi
\end{matrix}\quad
\begin{pmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{pmatrix}\quad
\begin{bmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{bmatrix}\quad
\begin{Bmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{Bmatrix}\quad
\begin{vmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{vmatrix}\quad
\begin{Vmatrix}
\vartheta& \varrho\\\varphi& \varpi
\end{Vmatrix}
\end{equation}
\section{Special keyboard characters}
\LaTeX{} has many symbols at its disposal. The majority of them are within the mathematical domain as shown in \eqref{eq:1} and \eqref{eq:2}. The ten special keyboard characters are: \verb|#|, \verb|$|, \verb|%|, \verb|&|, \verb|~|, \verb|_|, \verb|^|, \verb|\| and \verb|{}|. If you simply want the character to be printed just as any other letter, include a \verb|\ | in front of the character. For example, \verb|\$| will produce \verb|$| in your output.
The exception to the rule is the \verb|\ | itself because \verb|\\ | has its own special meaning. A \verb|\ | is produced by typing \verb|$\backslash$| in your file.
\end{document}