![文档类书中的水平间距](https://linux22.com/image/438903/%E6%96%87%E6%A1%A3%E7%B1%BB%E4%B9%A6%E4%B8%AD%E7%9A%84%E6%B0%B4%E5%B9%B3%E9%97%B4%E8%B7%9D.png)
这是我从一开始的文档:
\documentclass[11pt, openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz-cd}
\usepackage{makecell}
\usepackage{mathtools}
\usepackage{commath}
\usepackage{bbm}
\usetikzlibrary{babel}
\usetikzlibrary{shapes.geometric}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{circledsteps}
\usepackage{ relsize, stackengine}
\usepackage[all,cmtip]{xy}
\usepackage[english]{babel}
\usepackage{xurl}
\usepackage{stmaryrd}
\usepackage[backend=biber,style=alphabetic,sorting=ynt]{biblatex}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usetikzlibrary{intersections}
\newtheorem{theorem}{Theorem}
\newtheorem{prop}{Proposition}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{example}{Example}
\newtheorem{cor}{Corollary}
\newtheorem{question}{Question}
\usepackage[nottoc]{tocbibind} % For adding List of Tables and List of Figures to Table of Contents
\usepackage[titles]{tocloft}
\makeatletter
\def\ps@headings{%
\def\@oddfoot{\normalfont\hfil\thepage\hfil}%
\def\@evenfoot{\normalfont\hfil\thepage\hfil}}
\def\@evenhead{\hfil\slshape\leftmark}%
\def\@oddhead{{\slshape\rightmark}\hfil%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\@chapapp\ \thechapter. \ %
\fi
\fi
##1}}{}}%
\def\sectionmark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\z@
\thesection. \ %
\fi
##1}}}}
\makeatother
\pagestyle{headings}% apply new definitions
\addbibresource{mybibliography.bib}
%\bibliography{references}
\begin{document}
这是我的代码的一部分,我试图在新行的末尾写入正方形,其中正方形前的水平空间是空的。
We will have also, $\ker (r \lambda)_* \cong\mathbb{Z}/p^{a-1},$
and $\operatorname{coker}(r \lambda)_*\cong\mathbb{Z}/p^{b-1}
\quad \quad \quad \quad \quad \quad \quad \quad \quad \square$\\
这段代码的问题在于,我得到的正方形与证明的结尾在同一行,而不是在新行中。有人能帮我解决这个问题吗?
答案1
使用 的标准行为,amsthm
无需添加方块。 的末尾proof
将标有一个与最后一行对齐的小框。 为什么需要自己添加方块?
您可以\newline
在之前添加一个\end{proof}
,但它可能会让读者感到困惑,而且方块可能会在下一页(单独)结束。
也可以从同一个包中获得,\qedhere
通常用于在之前添加平方 - 然后完成证明- \end{proof}
,从而允许随后添加注释或引用。
\begin{document}
\begin{proof}
The proof is by induction on $\ldots$.
The end of the proof is marked with a little box, (as an alternative to QED, \emph{quod erat demonstrandum}).
We will have also, $\ker (r \lambda)_* \cong\mathbb{Z}/p^{a-1},$
and $\operatorname{coker}(r \lambda)_*\cong\mathbb{Z}/p^{b-1}$
\newline
% \quad \quad \quad \quad \quad \quad \quad \quad \quad \square$
\end{proof}
\begin{proof}
To prove it by contradiction try and assume that the statement is false,
proceed from there you will arrive to a contradiction.
\qedhere
\end{proof}
\end{document}
如果您希望所有证明都以这种方式运行,而无需\newline
每次都添加,请添加到您的序言中(危险,不推荐):
\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.}]\ignorespaces
}{%
\newline\popQED\endtrivlist\@endpefalse
}
\makeatother
因为页面末尾的行为很糟糕!