whutug / whu-thesis

:memo: 武汉大学毕业论文 LaTeX 模版 2024
LaTeX Project Public License v1.3c
931 stars 200 forks source link

增加术语表页或者符号对照表页 #176

Closed whuryl closed 1 year ago

whuryl commented 1 year ago

检查

编译环境

描述问题

请问怎样修改模板可以在“表格索引”页后面增加“术语表”页或者“符号对照表”页?类似于“图片索引”页和“表格索引”页。 强烈建议增加“术语表”页或者“符号对照表”页选项(类似于“图片索引”页和“表格索引”页),非常感谢!

image

sikouhjw commented 1 year ago

这部分可以参考 https://github.com/sikouhjw/gdutthesis/blob/a5f3d8110bf011773cdd91bada27d81620219b53/gdutthesis.cls#L1438-L1457

sikouhjw commented 1 year ago

在导言区加上,记得加载 longtable 宏包

\ExplSyntaxOn
\NewDocumentEnvironment { notation } { O { l p { 7.5 cm } } }
  {
    \chapter{物理量名称及符号表}
    \group_begin: \zihao{5}
    \dim_set_eq:NN \LTpre  \c_zero_dim
    \dim_set_eq:NN \LTpost \c_zero_dim
      \longtable {#1}
  }
  {
      \endlongtable
    \group_end:
  }
\ExplSyntaxOff
whuryl commented 1 year ago

谢谢sikouhjw的答复,我按照自己的方式参照cls文件的“表格索引”页和“博士生自认为的论文创新点”页已经将“术语表”页新增成功,并且在whu-thesis-demo.tex文件style模块中可以通过list-of-notation = true(或者false)配置术语表模式开启(或者关闭)。新增包括:

cls文件具体新增内容(请看下面与术语表相关的注释部分):

  1. 定义术语表页标题
    \tl_set:Nn \contentsname   { 目 \qquad 录 }
    \tl_set:Nn \listfigurename { 图片索引     }
    \tl_set:Nn \listtablename  { 表格索引     }
    \tl_set:Nn \listnotationname  { 术语表     } % 增加术语表
  2. 定义术语表内容(element中增加notation)
    
    \tl_new:N \g__whu_element_innovation_tl
    \tl_new:N \g__whu_element_notation_tl % 增加术语表
    \tl_new:N \g__whu_element_abstract_tl
    \tl_new:N \g__whu_element_abstract_en_tl
    \tl_new:N \g__whu_element_thanks_tl
    \clist_new:N \g__whu_element_bibliography_clist
    \clist_new:N \g__whu_element_appendix_clist

\keys_define:nn { whu / element } { innovation .tl_gset:N = \gwhu_element_innovation_tl, notation .tl_gset:N = \gwhu_element_notation_tl, % 增加术语表 abstract .tl_gset:N = \gwhu_element_abstract_tl, abstract * .tl_gset:N = \gwhu_element_abstract_en_tl, achievements .tl_gset:N = \gwhu_element_achievements_tl, thanks .tl_gset:N = \gwhu_element_thanks_tl, bibliography .clist_gset:N = \gwhu_element_bibliography_clist, appendix .clist_gset:N = \gwhu_element_appendix_clist, }

3. 定义术语表模式命令(`list_of_notation_bool`)

\bool_new:N \gwhu_style_bib_backend_bibtex_bool \bool_new:N \gwhu_style_list_of_figures_bool \bool_new:N \gwhu_style_list_of_tables_bool \bool_new:N \gwhu_style_list_of_notation_bool % 增加术语表模式命令

4. 配置术语表模式选项(参照`list-of-tables`配置`list_of_notation_bool=true|false`)
% 配置术语表模式选项
list-of-notation       .choice:,
list-of-notation / true.code:n =
  { \bool_gset_true:N  \g__whu_style_list_of_notation_bool },
list-of-notation / false.code:n =
  { \bool_gset_false:N \g__whu_style_list_of_notation_bool },
list-of-notation       .default:n = true,
list-of-notation       .initial:n = false,
5. 增加术语表页内容(参照`g__whu_style_list_of_tables_bool`配置)
  % 增加术语表 changed by ryl 20221006
  \bool_if:NT \g__whu_style_list_of_notation_bool
  {
    \tl_if_empty:NF \g__whu_element_notation_tl
    {
      \chapter * { 术语表 }
      \thispagestyle { empty }
      \file_input:V \g__whu_element_notation_tl
    }
    \__whu_new_chapter_page:
  }

### whu-thesis-demo.tex文件具体新增内容(请看下面与术语表相关的注释部分):
style              =
  {
    graphics-path  = {{figures/}{data/}},
    list-of-figures = true,
    list-of-tables = true,
    list-of-notation = true, % 设置是否显示术语表 true|false
    font = times,
    math-font = xits,
    bib-style = numerical,
    cite-style = numerical-super,
  },
element            =
  {
    innovation     = {pages/innovation},
    notation       = {pages/notation}, % 术语表内容
    abstract       = {pages/abstract},
    abstract*      = {pages/enabstract},
    bibliography   = {ref/refs , ref/thu},
    achievements   = {pages/achievements},
    thanks         = {pages/thanks},
    % appendix       = {pages/appendix}
  }

### 截图示例:
![image](https://user-images.githubusercontent.com/54856248/195249353-2099d043-8da4-419f-84cb-ebde1a7807a0.png)
theUanAsia commented 1 year ago

在导言区加上,记得加载 longtable 宏包

\ExplSyntaxOn
\NewDocumentEnvironment { notation } { O { l p { 7.5 cm } } }
  {
    \chapter{物理量名称及符号表}
    \group_begin: \zihao{5}
    \dim_set_eq:NN \LTpre  \c_zero_dim
    \dim_set_eq:NN \LTpost \c_zero_dim
      \longtable {#1}
  }
  {
      \endlongtable
    \group_end:
  }
\ExplSyntaxOff

大佬大佬,我找不到具体哪个位置插入上述代码,cls文件太长了,大佬,救救我这个菜鸡!

sikouhjw commented 1 year ago

大佬大佬,我找不到具体哪个位置插入上述代码,cls文件太长了,大佬,救救我这个菜鸡!

『導言區』

theUanAsia commented 1 year ago

不行了,还是找不到,我要被我给气死了,实在没有深入研究过tex

tanukihee commented 1 year ago

导言区:指 \documentclass 之后,\begin{document} 之前的区域

theUanAsia commented 1 year ago

导言区:指 \documentclass 之后,\begin{document} 之前的区域

没有报错了,但是好像论文里面没有出现变化,而且我也不知道从哪里编辑添加的表格。。。

sikouhjw commented 1 year ago

没有报错了,但是好像论文里面没有出现变化

用法:

\begin{notation}
  \toprule
  符号  & 含义 \\
  \midrule
  $E$   & 能量 \\
  $F$   & 推力 \\
  \bottomrule
\end{notation}

而且我也不知道从哪里编辑添加的表格。。。

在你需要輸出符號表的地方