Skip to content

Commit

Permalink
允许用户自定义缩略语对照表列宽
Browse files Browse the repository at this point in the history
  • Loading branch information
note286 committed Oct 20, 2021
1 parent 82eae00 commit 3ad743e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.md
Expand Up @@ -24,6 +24,7 @@
- [交叉引用](#交叉引用)
- [图片](#图片)
- [论文标题](#论文标题)
- [缩略语对照表](#缩略语对照表)
- [模板来源](#模板来源)
- [编码转换](#编码转换)
- [修复错误](#修复错误)
Expand Down Expand Up @@ -234,6 +235,8 @@ xelatex -synctex=1 xdupgthesis

- lmodern

- makecell

- multirow

- natbib
Expand Down Expand Up @@ -412,6 +415,22 @@ Package hyperref Warning: Token not allowed in a PDF string (Unicode):

用户在使用过程中,将`\texorpdfstring{\\}{}`当作`\\`来对待即可,如果论文标题不长或者希望自动换行,不需要换行符的话,删除`\texorpdfstring{\\}{}`即可。

## 缩略语对照表

缩略语对照表环境`abbreviationlist`提供了一个参数,用于调节列宽,模板中默认为`lXX`,其含义为全部左对齐,缩略语根据内容自动设置宽度,且只占据一行不自动换行,英文全称与中文对照平分剩下的页面宽度,会自动换行,用户无需手动插入换行符干预。

用户如果想要手动指定宽度,可以将模板中默认的`lXX`改为`p{7.5em}p{10.5em}X`,其含义为第一列为`7.5em`,第二列为`10.5em`,第三列占据剩下的页面宽度,会自动换行,用户无需手动插入换行符干预。如果需要更多自定义的参数,用户可以参考[tabularx](http://mirrors.ctan.org/macros/latex/required/tools/tabularx.pdf)宏包手册。

如果用户想要手动插入换行符,请将需要插入换行符的单元格放入`\makecell[l]{}`命令中,例如:

```latex
\begin{abbreviationlist}{lXX}
缩略语 & 英文全称 & 中文对照\\
XXX & \makecell[l]{手动换行手动换行\\手动换行} & 自动换行自动换行自动换行自动换行\\
XXX & XXX & XXX\\
\end{abbreviationlist}
```

# 模板来源

本节讲述本项目模板来源,用户不感兴趣可以跳过,直接使用本项目模板即可。
Expand Down
2 changes: 1 addition & 1 deletion chapters/abstract.tex
Expand Up @@ -28,7 +28,7 @@
\ldots & \ldots\\
\end{symbollist}

\begin{abbreviationlist}
\begin{abbreviationlist}{lXX}
缩略语 & 英文全称 & 中文对照\\
XXX & XXX & XXX\\
XXX & XXX & XXX\\
Expand Down
8 changes: 5 additions & 3 deletions xdupgthesis.cls
@@ -1,6 +1,6 @@

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{xdupgthesis}[2021/10/19 Xidian University Postgraduate Thesis document class, version 0.2.6, modified by @note286, published in https://note286.github.io/xdupgthesis/]
\ProvidesClass{xdupgthesis}[2021/10/19 Xidian University Postgraduate Thesis document class, version 0.2.7, modified by @note286, published in https://note286.github.io/xdupgthesis/]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% class and packages
Expand Down Expand Up @@ -506,6 +506,8 @@ By \par%

\RequirePackage{tabularx}

\RequirePackage{makecell}

%% list of Symbols
\newenvironment{symbollist}
{\parindent=0pt\XDU@toc@add{\XDU@toc@symbollist@title}%
Expand All @@ -515,11 +517,11 @@ By \par%
{\endtabularx\parindent=2\ccwd\cleardoublepage}

%% list of abbreviations
\newenvironment{abbreviationlist}
\newenvironment{abbreviationlist}[1]
{\parindent=0pt\XDU@toc@add{\XDU@toc@abbreviationlist@title}%
\XDU@nchapter{\XDU@label@abbreviationlist@title}\parindent=.5\ccwd%
\renewcommand{\arraystretch}{1.6666666667}
\tabularx{\linewidth}{p{7.5em}p{7.5em}X}}
\tabularx{\linewidth}{#1}}
{\endtabularx\parindent=2\ccwd\cleardoublepage}

%% content
Expand Down

0 comments on commit 3ad743e

Please sign in to comment.