whutug / whu-thesis

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

一些经验 #142

Closed wzm2256 closed 8 months ago

wzm2256 commented 2 years ago

经过了3个月的千锤百炼(浑水摸鱼),下周终于要答辩了。现在有点空,把用模板使用过程中的一些经验总结一下。方便以后的小朋友吧。

注:2和3是由于我之前的文章的Latex代码已经写好了,迁移到这个模板上的时候出现冲突。如果从头在这个模板上开始写文章,则并不存在这样的问题。

  1. 这个模板需要最新的Latex版本编译,请更新Latex版本到21,或者在overleaf上使用 https://github.com/whutug/whu-thesis/issues/35#issuecomment-1039970111
  2. algorithm2e替换为algorithm: algorithm2e的设置全部注释掉,替换为我的algorithm设置 注释掉195-203行
    \RequirePackage { algorithm2e }     % 算法代码
    \tl_set:Nn \algorithmcfname { 算法 }
    \SetAlCapSty {}
    \SetAlCapFnt {}
    \box_new:N \l__whu_space_box
    \hbox_set:Nn \l__whu_space_box { \nobreakspace }
    \SetAlgoCaptionSeparator
    { \hbox_to_wd:nn { 1 em - \box_wd:N \l__whu_space_box } {} }
    % 算法标题后会跟一个不间断空格 ~,这里将其宽度减掉 

增加

\RequirePackage { algorithm }     % 算法代码
\RequirePackage {algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\tl_set:Nn \algorithmcfname { 算法 }
\box_new:N \l__whu_space_box
\hbox_set:Nn \l__whu_space_box { \nobreakspace }
  1. subcaption替换为subfigure 这个就比较麻烦,因为替换为subfigure以后图题中就无法使用引用文献,我这里解决的方法是直接去掉了整个图像和表格目录,这样改变了文档结构,谨慎使用。 将372行注释掉 \RequirePackage { subcaption } 并将319行改为

    \RequirePackage{subfigure}
    \RequirePackage[subfigure]{tocloft}
  2. 数学字体和之前文章中差别太大 我无法解决。https://github.com/whutug/whu-thesis/issues/94

  3. 目录缩进 使用\renewcommand​\cftsubsecindent​{4em} https://github.com/whutug/whu-thesis/issues/66#issuecomment-1053792011

  4. 攻博期间发表的科研成果编号 当前模板列出的所有成果是没有编号的,在achievement中用如下格式 https://github.com/whutug/whu-thesis/issues/92#issuecomment-1073161257 以增加编号功能。

  5. 添加封面结构,如武大校徽。这个具体看我的文件,或者参见黄老师的模板。

最后,感谢模板的开发人员,没有这个模板的话写毕业论文应该相当麻烦。 然后我把我修改后的cls文件放在这里。我并不懂cls文件语法,这个文件的修改也全是照葫芦画瓢,但是它确实能够完成我的目标,只是结构比较混乱。希望能为大家提供参考。 whu-thesis.txt

ZrW00 commented 2 years ago

第四点:首先先把Windows中的Cambria Math的字体文件放在项目目录中,然后修改cls文件中的数学字体设置,往其中的可选项中添加cambria.ttc:

math-font .choices:nn =
      { xits , termes , cambria.ttc, none }
      { \__whu_math_fontset:n { \l_keys_choice_tl } },
    % 数学字体

即可生效

H0radricCube commented 1 year ago

似乎还需要在这里将原始的 math-font 替换为 cambria.ttc

% 根据系统判断调用字体
\sys_if_platform_windows:TF
  {
    \keys_define:nn { whu / style }
      {
        font      .initial:n = times,
        math-font .initial:n = cambria.ttc, % changed here
        cjk-font  .initial:n = windows,
      }
  }
  {
    \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc }
    % 使用 menlo 判断 mac,来自 ctex
      {
        \keys_define:nn { whu / style }
          {
            font      .initial:n = times,
            math-font .initial:n = cambria.ttc, % changed here
            cjk-font  .initial:n = mac,
          }
      }
      {
        \keys_define:nn { whu / style }
          {
            font      .initial:n = xits,
            math-font .initial:n = cambria.ttc, % changed here
            cjk-font  .initial:n = fandol,
          }
      }
  }