Skip to content

Commit

Permalink
增加断页机制切换开关 fixed #7
Browse files Browse the repository at this point in the history
  • Loading branch information
note286 committed Nov 16, 2021
1 parent e2aa7df commit c6647ee
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- [论文标题](#论文标题)
- [插图/表格索引前缀开关](#插图表格索引前缀开关)
- [插图/表格索引垂直间距开关](#插图表格索引垂直间距开关)
- [断页机制切换开关](#断页机制切换开关)
- [符号对照表](#符号对照表)
- [缩略语对照表](#缩略语对照表)
- [附录](#附录)
Expand Down Expand Up @@ -274,6 +275,7 @@ xelatex -synctex=1 xdupgthesis
- `anonrvw`,详见[论文抽查评估](#论文抽查评估)
- `noloftpre`,详见[插图/表格索引前缀开关](#插图表格索引前缀开关)
- `noloftgap`,详见[插图/表格索引垂直间距开关](#插图表格索引垂直间距开关)
- `ragbtm`,详见[断页机制切换开关](#断页机制切换开关)

## 内置宏包

Expand Down Expand Up @@ -571,6 +573,28 @@ Package hyperref Warning: Token not allowed in a PDF string (Unicode):
\documentclass[noloftgap]{xdupgthesis}
```

## 断页机制切换开关

刘海洋的[LaTeX入门](https://book.douban.com/subject/24703731/)第2.2.8节指出:

> LaTeX使用两种机制处理断页问题,可以使用命令`\raggedbottom`告诉LaTeX让页面中的内容保持它的自然高度,把每一页的页面底部用空白填满。相反,`\flushbottom`则让LaTeX将页面高度均匀地填满,使每一页的底部直接对齐。在标准文档类中,LaTeX会为单面输出的文档(`oneside`选项)设置`\raggedbottom`,而为双面输出的文档(`twoside`选项)设置`\flushbottom`。当排满一页后,页面剩余空间比较大的时候,如果还要排版一个很高的内容(如多行的公式或表格),就会造成难看的断页,通常这是由浮动环境解决的,但在无可避免的时候就需要在两种断页机制下选择一种:双面印刷的书籍使用`\flushbottom`可以保证摊开时左右两页对称,但如果有太多过于松散的页面就不如使用`\raggedbottom`了。
简单来讲,由于学位论文是`twoside`的,默认会将页面高度均匀地填满,使每一页的底部直接对齐。最直观的表现就是对于不满一页内容的页面不受影响,但是满一页内容的页面会在垂直方向上移动元素所在高度,使得行间距或段间距发生变化,甚至节标题的位置也会发生变化。用户可以查看[section行间隔不正常 · Issue #7](https://github.com/note286/xdupgthesis/issues/7)中的讨论,里面有图片描述。

---

本项目模板默认会默认会将页面高度均匀地填满,使每一页的底部直接对齐,用户如想要让页面中的内容保持它的自然高度,把每一页的页面底部用空白填满,需要在`xdupgthesis.tex`中为文档类添加`ragbtm`参数(Ragged Bottom),即将

```latex
\documentclass{xdupgthesis}
```

改为

```latex
\documentclass[ragbtm]{xdupgthesis}
```

## 符号对照表

模板中默认为`lX`,其含义为全部左对齐,符号列根据内容自动设置宽度,且只占据一行不自动换行,符号名称占据剩下的页面宽度,会自动换行,用户无需手动插入换行符干预。更多设置请用户参考[缩略语对照表](#缩略语对照表)介绍进行设置。
Expand Down
10 changes: 9 additions & 1 deletion xdupgthesis.cls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{xdupgthesis}[2021/11/14 Xidian University Postgraduate Thesis document class, version 0.2.33, modified by @note286, published in https://note286.github.io/xdupgthesis/]
\ProvidesClass{xdupgthesis}[2021/11/16 Xidian University Postgraduate Thesis document class, version 0.2.34, modified by @note286, published in https://note286.github.io/xdupgthesis/]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% class and packages
Expand Down Expand Up @@ -35,6 +35,10 @@
\newif\ifXDU@Option@noloftgap\XDU@Option@noloftgapfalse
\DeclareOption{noloftgap}{\XDU@Option@noloftgaptrue}

% ragbtm = Ragged Bottom
\newif\ifXDU@Option@ragbtm\XDU@Option@ragbtmfalse
\DeclareOption{ragbtm}{\XDU@Option@ragbtmtrue}

%% others
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions\relax
Expand Down Expand Up @@ -67,6 +71,10 @@
\BeforeBeginEnvironment{document}{\setmainfont{Times New Roman}}
\fi

\ifXDU@Option@ragbtm
\BeforeBeginEnvironment{document}{\raggedbottom}
\fi

\RequirePackage{lmodern}

\RequirePackage{fancyhdr}
Expand Down

0 comments on commit c6647ee

Please sign in to comment.