Skip to content

Commit

Permalink
Merge pull request #391 from BITNP/fky-fix
Browse files Browse the repository at this point in the history
fix: fix display skip and line stretch.
  • Loading branch information
lsylusiyao authored Oct 22, 2023
2 parents 365b320 + 4ba5027 commit 126ff24
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
13 changes: 13 additions & 0 deletions bithesis-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,19 @@ \subsubsection{样式信息}

\end{function}

\begin{function}[added=2023-10-22]{style/mathAboveDisplaySkip,style/mathBelowDisplaySkip}
\begin{bitsyntax}[emph={[1]mathBelowDisplaySkip,mathAboveDisplaySkip}]
mathBelowDisplaySkip = (*(3pt)|任意长度*)
mathAboveDisplaySkip = (*(3pt)|任意长度*)
\end{bitsyntax}

定义公式环境(如 \verb|\begin{equation}| )到上下段落间的距离。

\textit{请保证源码中的公式的环境(如}\verb|\begin{equation}|
\textit{)与上一段落不要有空行。否则,公式和上文段落之间会有额外的空白。}

\end{function}

\subsubsection{目录选项}

\begin{function}{TOC}
Expand Down
39 changes: 25 additions & 14 deletions bithesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,11 @@
% 控制英文是否使用 hyphen 进行换行
hyphen .bool_set:N = \l_@@_style_hyphen_bool,
hyphen .initial:n = {true},
% 控制公式和上下文的距离
mathAboveDisplaySkip .dim_set:N = \l_@@_style_math_above_display_skip_dim,
mathAboveDisplaySkip .initial:n = {3pt},
mathBelowDisplaySkip .dim_set:N = \l_@@_style_math_below_display_skip_dim,
mathBelowDisplaySkip .initial:n = {3pt},
}
% \end{macrocode}
%
Expand Down Expand Up @@ -878,11 +883,10 @@
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
\RequirePackage{titletoc}
\RequirePackage{setspace}
\RequirePackage{graphicx}
\RequirePackage{fancyhdr}
\RequirePackage{pdfpages}
\RequirePackage{setspace}
\RequirePackage[nodisplayskipstretch]{setspace}
\RequirePackage{booktabs}
\RequirePackage{multirow}
\RequirePackage{tikz}
Expand Down Expand Up @@ -1281,8 +1285,8 @@
nameformat = {},
titleformat = {},
aftername = \hspace{8bp},
beforeskip = 20bp plus 1ex minus .2ex,
afterskip = 18bp plus .2ex,
beforeskip = 20bp,
afterskip = 17bp,
fixskip = true,
}
}
Expand All @@ -1299,8 +1303,8 @@
nameformat = {},
titleformat = {},
aftername = \hspace{7bp},
beforeskip = 17bp plus 1ex minus .2ex,
afterskip = 14bp plus .2ex,
beforeskip = 17bp,
afterskip = 17bp,
fixskip = true,
}
}
Expand All @@ -1320,8 +1324,8 @@
format={\l_@@_title_font_cs:n \raggedright \zihao{-4}},
nameformat = {},
titleformat = {},
beforeskip=14bp plus 1ex minus .2ex,
afterskip=14bp plus .2ex,
beforeskip=14bp,
afterskip=14bp,
fixskip=true,
}
}
Expand Down Expand Up @@ -1385,7 +1389,7 @@
numbering = false,
}
}
\setstretch{1.53}
\linespread{1.53}\selectfont
\pagestyle{BIThesis}

% 表格内容默认使用五号字。
Expand Down Expand Up @@ -1420,7 +1424,7 @@
\pagestyle{BIThesis}
% 正文 22 磅的行距
\setlength{\parskip}{0em}
\setstretch{1.53}
\linespread{1.53}\selectfont
% 修复脚注出现跨页的问题
\interfootnotelinepenalty=10000
}
Expand Down Expand Up @@ -1498,6 +1502,13 @@
\AtBeginDocument{
\cs_gset:Npn \thelstlisting {\thechapter\g_@@_label_divide_char_tl\arabic{lstlisting}}
\cs_gset:Npn \lstlistingname {\c_@@_label_code_tl}

% 默认的情况下,保留公式和上下文的一定间距。(会比 Word 稍宽一些)
\setlength{\abovedisplayskip}{\l_@@_style_math_above_display_skip_dim}
\setlength{\abovedisplayshortskip}{\l_@@_style_math_above_display_skip_dim}
\setlength{\belowdisplayskip}{\l_@@_style_math_below_display_skip_dim}
\setlength{\belowdisplayshortskip}{\l_@@_style_math_below_display_skip_dim}
%
}
\captionsetup[lstlisting]{font=small,labelsep=space}
% \end{macrocode}
Expand Down Expand Up @@ -1767,7 +1778,7 @@
\begin{titlepage}
\vskip 5cm
\begin{center}
\setstretch{1.1}
\linespread{1.1}\selectfont
\begin{minipage}[t][19.7cm]{2em}
\begin{center}
{
Expand Down Expand Up @@ -2357,7 +2368,7 @@
\newpage
}
{3} {
\setstretch{1.26}
\linespread{1.26}\selectfont
% 原创性声明部分
\begin{center}
\vspace*{-2bp}
Expand Down Expand Up @@ -2482,7 +2493,7 @@
{

\cleardoublepage
\setstretch{1.53}
\linespread{1.53}\selectfont

\@@_if_bachelor_thesis:T {
\begin{center}
Expand Down Expand Up @@ -2552,7 +2563,7 @@
% \begin{macrocode}
\NewDocumentEnvironment {abstractEn} {}
{
\setstretch{1.53}
\linespread{1.53}\selectfont

\@@_if_bachelor_thesis:T {
\begin{spacing}{0.95}
Expand Down
7 changes: 4 additions & 3 deletions templates/graduate-thesis/chapters/chapter2.tex
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ \chapter{具体研究内容}
\label{thm:res}
假设$U$是复平面上的一个单连通开子集,$a_1,\ldots,a_n$是复平面上有限个点,$f$是定义在$U\backslash \{a_1,\ldots,a_n\}$上的全纯函数,
如果$\gamma$是一条把$a_1,\ldots,a_n$包围起来的可求长曲线,但不经过任何一个$a_k$,并且其起点与终点重合,那么:

\begin{equation}
\label{eq:res}
\ointop_{\gamma}f(z)\,\mathrm{d}z = 2\pi\mathbf{i}\sum^n_{k=1}\mathrm{I}(\gamma,a_k)\mathrm{Res}(f,a_k)
\end{equation}

如果$\gamma$是若尔当曲线,那么$\mathrm{I}(\gamma, a_k)=1$,因此:

\begin{equation}
\label{eq:resthm}
\ointop_{\gamma}f(z)\,\mathrm{d}z = 2\pi\mathbf{i}\sum^n_{k=1}\mathrm{Res}(f,a_k)
Expand All @@ -51,4 +49,7 @@ \chapter{具体研究内容}
所以,由\autoref{thm:res}可知……
\qedhere
\end{proof}


\textit{有关公式与上下文间距的一些注意事项:请保证源码中的公式的环境(如}
\\ \verb|\begin{equation}|
\textit{)与上一段落不要有空行。否则,公式和上文段落之间会有额外的空白。}
5 changes: 5 additions & 0 deletions templates/undergraduate-thesis/chapters/1_chapter1.tex
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,8 @@ \section{字体效果表格}
如果想要获得宋体粗体的样式,请在配置中开启伪粗体选项。
\item \colorbox{gray}{粗斜体}的效果是因操作系统字体而定的,中文写作中不会使用这种字形,可以忽略。
\end{itemize}

\textit{有关公式与上下文间距的一些注意事项:请保证源码中的公式的环境(如}
\\ \verb|\begin{equation}|
\textit{)与上一段落不要有空行。否则,公式和上文段落之间会有额外的空白。}

0 comments on commit 126ff24

Please sign in to comment.