Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本科毕业论文封面编译失败 #337

Open
4 of 11 tasks
ODYYYYYY opened this issue May 3, 2024 · 23 comments · Fixed by #342
Open
4 of 11 tasks

本科毕业论文封面编译失败 #337

ODYYYYYY opened this issue May 3, 2024 · 23 comments · Fixed by #342
Labels

Comments

@ODYYYYYY
Copy link

ODYYYYYY commented May 3, 2024

描述问题

直接复制 #142 中给出的代码并使用xelatex编译,结果编译器报错,同时产生的pdf文件在info的描述处生成了错误的信息(例如“导师”变成了 c__fdu_name_supervisor_tl 等等)

预期结果:
image

实际结果:
image

  • 操作系统
    • Windows
    • macOS
    • Ubuntu
  • TeX 发行版
    • TeX Live 2024
    • MiKTeX 23.5
  • 编译方式
    • XeLaTeX
    • LuaLaTeX
  • fduthesis 获取方式:
    • 发行版自带
    • 通过 GitHub Releases 下载(最新发布版本)
    • 通过 git clone 下载(开发版本)
    • 在 Overleaf 上使用
  • fduthesis 版本:v0.9a
@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 3, 2024

Compiler显示信息如下:

This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./Test.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-04-11>
(d:/texlive/2024/texmf-dist/tex/latex/fduthesis/fduthesis.cls
Document Class: fduthesis 2023/05/27 v0.9a Thesis template for Fudan University
(d:/texlive/2024/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty (d:/texlive/2024/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate-2023-10-10.sty (d:/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty (d:/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)))) (d:/texlive/2024/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (d:/texlive/2024/texmf-dist/tex/latex/fduthesis/fduthesis.def) (d:/texlive/2024/texmf-dist/tex/latex/ctex/ctexbook.cls (d:/texlive/2024/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg)
Document Class: ctexbook 2022/07/14 v2.5.10 Chinese adapter for class book (CTEX)
(d:/texlive/2024/texmf-dist/tex/latex/ctex/ctexhook.sty) (d:/texlive/2024/texmf-dist/tex/latex/ctex/ctexpatch.sty) (d:/texlive/2024/texmf-dist/tex/latex/base/fix-cm.sty (d:/texlive/2024/texmf-dist/tex/latex/base/ts1enc.def)) (d:/texlive/2024/texmf-dist/tex/latex/ctex/config/ctexopts.cfg) (d:/texlive/2024/texmf-dist/tex/latex/base/book.cls
Document Class: book 2023/05/17 v1.4n Standard LaTeX document class
(d:/texlive/2024/texmf-dist/tex/latex/base/bk12.clo)) (d:/texlive/2024/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def (d:/texlive/2024/texmf-dist/tex/xelatex/xecjk/xeCJK.sty (d:/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty (d:/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (d:/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (d:/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty) (d:/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (d:/texlive/2024/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg))) (d:/texlive/2024/texmf-dist/tex/latex/zhnumber/zhnumber.sty (d:/texlive/2024/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg)) (d:/texlive/2024/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def (d:/texlive/2024/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg)) (d:/texlive/2024/texmf-dist/tex/latex/ctex/ctex-cs4size.clo)) (d:/texlive/2024/texmf-dist/tex/latex/ctex/config/ctex.cfg) (d:/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(d:/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (d:/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (d:/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (d:/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (d:/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math.sty (d:/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty (d:/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex))) (d:/texlive/2024/texmf-dist/tex/latex/geometry/geometry.sty (d:/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty) (d:/texlive/2024/texmf-dist/tex/generic/iftex/ifvtex.sty (d:/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty))) (d:/texlive/2024/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty) (d:/texlive/2024/texmf-dist/tex/latex/footmisc/footmisc.sty (d:/texlive/2024/texmf-dist/tex/latex/bigfoot/perpage.sty)) (d:/texlive/2024/texmf-dist/tex/latex/ntheorem/ntheorem.sty
Style `ntheorem', Version 1.33 <2011/08/15>
(d:/texlive/2024/texmf-dist/tex/latex/base/ifthen.sty)) (d:/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty (d:/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty (d:/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty) (d:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (d:/texlive/2024/texmf-dist/tex/latex/graphics-def/xetex.def))) (d:/texlive/2024/texmf-dist/tex/latex/tools/longtable.sty) (d:/texlive/2024/texmf-dist/tex/latex/caption/caption.sty (d:/texlive/2024/texmf-dist/tex/latex/caption/caption3.sty) (d:/texlive/2024/texmf-dist/tex/latex/caption/ltcaption.sty)) (d:/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty (d:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg) (d:/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx))) (d:/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty (d:/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty) (d:/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (d:/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty (d:/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (d:/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (d:/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty))) (d:/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty) (d:/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty) (d:/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty (d:/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty) (d:/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty (d:/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty))) (d:/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (d:/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def) (d:/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty) (d:/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def) (d:/texlive/2024/texmf-dist/tex/latex/url/url.sty) (d:/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty (d:/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (d:/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (d:/texlive/2024/texmf-dist/tex/latex/hyperref/hxetex.def (d:/texlive/2024/texmf-dist/tex/generic/stringenc/stringenc.sty) (d:/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (d:/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty) (d:/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty))) (d:/texlive/2024/texmf-dist/tex/latex/hyperref/psdextra.def)

Package fontspec Warning: 
(fontspec)                Script 'CJK' not explicitly supported within font
(fontspec)                'FandolSong-Regular'. Check the typeset output, and
(fontspec)                if it is okay then ignore this warning. Otherwise a
(fontspec)                different font should be chosen.

No file Test.aux.
*geometry* driver: auto-detecting
*geometry* detected driver: xetex

Package hyperref Warning: Rerun to get /PageLabels entry.


Package fontspec Warning: 
(fontspec)                Script 'CJK' not explicitly supported within font
(fontspec)                'FandolHei-Regular'. Check the typeset output, and
(fontspec)                if it is okay then ignore this warning. Otherwise a
(fontspec)                different font should be chosen.

./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (97.88063pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_author_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (124.6657pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_student_id_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (131.87764pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_department_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (92.9121pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_major_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (125.16255pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_supervisor_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (156.96133pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_supervisor_title_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (114.3823pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_affiliation_tl
./Test.tex:129: Missing \endcsname inserted.
<to be read again> 
                   \hfil 
l.129 \begin{document}
                      
./Test.tex:129: Use of \??? doesn't match its definition.
<argument> \???  
                 ! LaTeX Error: Erroneous variable \csname\endcsname used!
l.129 \begin{document}
                      
./Test.tex:129: Extra \endcsname.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.129 \begin{document}
                      

Overfull \hbox (84.34508pt too wide) detected at line 129
 \TU/texgyreheros(0)/m/n/15.05624 c__fdu_name_date_tl
[1] [2]

Package fontspec Warning: 
(fontspec)                Script 'CJK' not explicitly supported within font
(fontspec)                'FandolKai-Regular'. Check the typeset output, and
(fontspec)                if it is okay then ignore this warning. Otherwise a
(fontspec)                different font should be chosen.

[3] [4] [5] (./Test.aux)

Package rerunfilecheck Warning: File `Test.out' has changed.
(rerunfilecheck)                Rerun to get outlines right
(rerunfilecheck)                or use package `bookmark'.

 )
(see the transcript file for additional information)
Output written on Test.pdf (5 pages).
SyncTeX written on Test.synctex.gz.

Transcript written on Test.log.

@xkwxdyy
Copy link

xkwxdyy commented May 3, 2024

请用把 log 内容放在 Markdown 的代码块里。

```latex
content
```

直接复制issue142中给出的代码并使用xelatex编译

建议下次这种引用要给链接,如果是同一个项目的 issue,直接用 #,比如 #142 ,会产生链接

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 3, 2024

请用把 log 内容放在 Markdown 的代码块里。

```latex
content

> 直接复制issue142中给出的代码并使用xelatex编译

建议下次这种引用要给链接,如果是同一个项目的 issue,直接用 `#`,比如 #142 ,会产生链接

感谢赐教,已经进行了相应的修改!

@xkwxdyy
Copy link

xkwxdyy commented May 3, 2024

建议你把 #142 那个里面的提问删掉,这里引用了之后那个下方会有提示的。

一个解决办法是把 45 和 84 行的 \__fdu_spread_box:nn 改为 \makeboxs 选项方案即可

% line 41
\group_begin:
  \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
    {
      \__fdu_cover_info_format:
      % \__fdu_spread_box:nn { 4 \ccwd } {##2}
      \makebox [ 4 \ccwd ] [ s ] { ##2 }
      ##4
      \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
    }
  \__fdu_cover_info_aux_i:nn {  20 } { date }
\group_end:
% line 81
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    % \__fdu_spread_box:nn { 4 \ccwd } {#2}
    \makebox [ 4 \ccwd ] [ s ] { #2 }
    #4
    \hbox_overlap_right:n { \__fdu_blank_underline:n { #1 \ccwd } }
    \__fdu_fixed_width_center_box:nn { #1 \ccwd } {#3}
  }

@xkwxdyy
Copy link

xkwxdyy commented May 3, 2024

问题出在

\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }

\__fdu_cover_info_aux_ii:nnnn 的第二个参数需要展开。而 interface3.pdf 中可以查到 \tl_use:c 是完全可展的,且在 1.2 节可查到

Fully expandable functions Some functions are fully expandable, which allows them to be used within an x-type or e-type argument (in plain TEX terms, inside an \edef or \expanded), as well as within an f-type argument. These fully expandable functions are indicated in the documentation by a star

说明需要用 x 或者 e 或者 f 来展开,fduthesis.cls 里提供了 o 的变体

\cs_generate_variant:Nn \@@_spread_box:nn { no }

但这里改成 o 会有

! Use of \__tl_map_function_end:w doesn't match its definition.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.130 \begin{document}
                      
? 

的报错。只需要在 #142 提供的代码里面增加一行

\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }

其中 x 可以改为 ef,然后把两处 \__fdu_spread_box:nn 改为 \__fdu_spread_box:nxef 同理)即可

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 3, 2024

__fdu_spread_box:nn

我直接采用了这种方案,在 \ExplSyntaxOn后直接添加了\cs_generate_variant:Nn \__fdu_spread_box:nn { ne}并将两个"nn"修改为了"ne",xelatex编译成功且产生PDF文件无错误,感谢!!!

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

问题出在

\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }

\__fdu_cover_info_aux_ii:nnnn 的第二个参数需要展开。而 interface3.pdf 中可以查到 \tl_use:c 是完全可展的,且在 1.2 节可查到

Fully expandable functions Some functions are fully expandable, which allows them to be used within an x-type or e-type argument (in plain TEX terms, inside an \edef or \expanded), as well as within an f-type argument. These fully expandable functions are indicated in the documentation by a star

说明需要用 x 或者 e 或者 f 来展开,fduthesis.cls 里提供了 o 的变体

\cs_generate_variant:Nn \@@_spread_box:nn { no }

但这里改成 o 会有

! Use of \__tl_map_function_end:w doesn't match its definition.
\exp_args:Nc ...>\exp_after:wN #1\cs:w #2\cs_end: 
                                                  
l.130 \begin{document}
                      
? 

的报错。只需要在 #142 提供的代码里面增加一行

\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }

其中 x 可以改为 ef,然后把两处 \__fdu_spread_box:nn 改为 \__fdu_spread_box:nxef 同理)即可

还有一个小问题,能否把PDF封面info项后面的下划线给去掉,就像“完成日期”那一栏一样没有下划线?我的方案是将

\hbox_overlap_right:n { \__fdu_blank_underline:n { #1 \ccwd } }

注释掉。但是这么做的话会显得info名称和info对应内容纵向对不齐的情况比较明显(虽然这个对不齐在有underline时已经存在),见下图
image

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

为什么要去掉下划线呢,是最新规范?请提供依据

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

为什么要去掉下划线呢,是最新规范?请提供依据

附件1:微电子学院关于本科毕业论文(设计)工作的若干规定.pdf
详见微电子学院提供的封面(PDF文件第10页-附件1(封面一))

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

这个信息是空着的,不能说明一定没下划线,你有认识上一届毕业的学长学姐吗,或者问问你的论文指导老师?先确定一下是否需要去掉下划线

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

好的,感谢,我再去确认一下,那请问关于info名称和info内容对不齐的问题有办法解决吗?

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

这个信息是空着的,不能说明一定没下划线,你有认识上一届毕业的学长学姐吗,或者问问你的论文指导老师?先确定一下是否需要去掉下划线

image
这是我找到的上一届微电子学院一位学长的本科毕业论文PDF文件的封面,可以看到是没有下划线的。

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

改了一下,你用下面的代码吧:

\documentclass{fduthesis}

% 请不要改动 \ExplSyntaxOn ... \ExplSyntaxOff 之间的代码!
\ExplSyntaxOn
\RenewDocumentCommand \makecoveri { }
  {
    \thispagestyle { empty }
    \UseInstance { fdu / cover } { cover-bachelor-default }
  }
\DeclareCoverTemplate { cover-bachelor } { logo-i, title, logo-ii, info }
\DeclareInstance { fdu / cover } { cover-bachelor-default } { cover-bachelor }
  {
    top-skip              = 0 pt plus 0.1 fill,
    bottom-skip           = 0 pt plus 0.4 fill,
    logo-i  / content     = \__fdu_cover_logo_i:,
    title   / content     = \c__fdu_name_thesis_title_tl,
    logo-ii / content     = \__fdu_cover_logo_ii:,
    info    / content     = \__fdu_cover_info:,
    title   / format      = \fontsize { 35 } { 35 } \selectfont \sffamily,
    title   / bottom-skip = 0 pt plus 0.1 fill,
    logo-ii / bottom-skip = 0 pt plus 0.2 fill,
    logo-i  / align       = center,
    title   / align       = center,
    logo-ii / align       = center,
    info    / align       = center,
  }
\cs_set_protected:Npn \__fdu_cover_logo_i:
  { \includegraphics [ width = 6.60 cm ] { \l__fdu_logo_name_tl   } }
\cs_set_protected:Npn \__fdu_cover_logo_ii:
  { \includegraphics [ width = 3.70 cm ] { \l__fdu_logo_emblem_tl } }
\cs_set_protected:Npn \__fdu_cover_info:
  {
    \__fdu_cover_title:n       {  20 }
    \__fdu_cover_info_aux_i:nn { 7.5 } { author           }
    \__fdu_cover_info_aux_i:nn { 7.5 } { student_id       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { department       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { major            } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor       }
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor_title } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { affiliation      } \__fdu_cover_info_skip:
    \group_begin:
      \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
        {
          \__fdu_cover_info_format:
          \__fdu_spread_box:nx { 4 \ccwd } {##2}
          ##4
          \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
        }
      \__fdu_cover_info_aux_i:nn {  20 } { date }
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_title:n #1
  {
    \exp_args:NNV \clist_set:Nn \l__fdu_tmpa_clist \l__fdu_info_title_tl
    \clist_pop:NN  \l__fdu_tmpa_clist \l__fdu_tmpa_tl
    \clist_pop:NNF \l__fdu_tmpa_clist \l__fdu_tmpb_tl
      { \tl_set_eq:NN \l__fdu_tmpb_tl \c_empty_tl }
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \c__fdu_name_title_tl } { \l__fdu_tmpa_tl } { \c__fdu_fwid_colon_tl }
    \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { } { \l__fdu_tmpb_tl } { \phantom { \c__fdu_fwid_colon_tl } }
    \__fdu_cover_info_skip:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }
\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_left_box:nn { #1 \ccwd } {#3}
  }
\cs_new_protected:Npn \__fdu_fixed_width_left_box:nn #1#2
  { \parbox [t] {#1} { \raggedright #2 } }
\cs_set_protected:Npn \__fdu_cover_info_format:
  { \zihao { -3 } \sffamily }
\cs_set_protected:Npn \__fdu_cover_info_skip:
  { \skip_vertical:n { 0.2 ex } }
\cs_set_protected:Npn \__fdu_define_name:nn #1#2
  { \tl_set:cn { c__fdu_name_ #1 _tl } {#2} }
\keys_define:nn { fdu / info }
  {
    affiliation      .tl_set:N = \l__fdu_info_affiliation_tl,
    supervisor-title .tl_set:N = \l__fdu_info_supervisor_title_tl,
  }
\clist_map_inline:nn
  {
    { student_id       } { 学号         },
    { thesis_title     } { 本科毕业论文 },
    { title            } { 论文题目     },
    { supervisor       } { 指导教师     },
    { supervisor_title } { 职称         },
    { affiliation      } { 单位         },
  }
  { \__fdu_define_name:nn #1 }
\tl_set:Nn \l__fdu_logo_name_tl   { fudan-name.pdf   }
\tl_set:Nn \l__fdu_logo_emblem_tl { fudan-emblem-new.pdf }
\ExplSyntaxOff

% 这里开始就和原来一样了
\fdusetup{
  info={
    % 以下各项都要填写,否则会报错
    author           = {张三},
    student-id       = {18110000000},
    department       = {计算机学院},
    major            = {计算机},
    title            = {题目第一行,第二行},
    % title            = {题目只有第一行},
    supervisor       = {李四五},
    supervisor-title = {教授},
    affiliation      = {软件学院},
  }
}

\begin{document}
...
\end{document}

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

里面关于标题的代码我也改了一下,标题只有一行的时候也保留了间距:
image

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

不过你发的规范里面日期竟然还是居中的(上面也保留了这个居中),看上去怪怪的

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

改了一下,你用下面的代码吧:

\documentclass{fduthesis}

% 请不要改动 \ExplSyntaxOn ... \ExplSyntaxOff 之间的代码!
\ExplSyntaxOn
\RenewDocumentCommand \makecoveri { }
  {
    \thispagestyle { empty }
    \UseInstance { fdu / cover } { cover-bachelor-default }
  }
\DeclareCoverTemplate { cover-bachelor } { logo-i, title, logo-ii, info }
\DeclareInstance { fdu / cover } { cover-bachelor-default } { cover-bachelor }
  {
    top-skip              = 0 pt plus 0.1 fill,
    bottom-skip           = 0 pt plus 0.4 fill,
    logo-i  / content     = \__fdu_cover_logo_i:,
    title   / content     = \c__fdu_name_thesis_title_tl,
    logo-ii / content     = \__fdu_cover_logo_ii:,
    info    / content     = \__fdu_cover_info:,
    title   / format      = \fontsize { 35 } { 35 } \selectfont \sffamily,
    title   / bottom-skip = 0 pt plus 0.1 fill,
    logo-ii / bottom-skip = 0 pt plus 0.2 fill,
    logo-i  / align       = center,
    title   / align       = center,
    logo-ii / align       = center,
    info    / align       = center,
  }
\cs_set_protected:Npn \__fdu_cover_logo_i:
  { \includegraphics [ width = 6.60 cm ] { \l__fdu_logo_name_tl   } }
\cs_set_protected:Npn \__fdu_cover_logo_ii:
  { \includegraphics [ width = 3.70 cm ] { \l__fdu_logo_emblem_tl } }
\cs_set_protected:Npn \__fdu_cover_info:
  {
    \__fdu_cover_title:n       {  20 }
    \__fdu_cover_info_aux_i:nn { 7.5 } { author           }
    \__fdu_cover_info_aux_i:nn { 7.5 } { student_id       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { department       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { major            } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor       }
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor_title } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { affiliation      } \__fdu_cover_info_skip:
    \group_begin:
      \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
        {
          \__fdu_cover_info_format:
          \__fdu_spread_box:nx { 4 \ccwd } {##2}
          ##4
          \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
        }
      \__fdu_cover_info_aux_i:nn {  20 } { date }
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_title:n #1
  {
    \exp_args:NNV \clist_set:Nn \l__fdu_tmpa_clist \l__fdu_info_title_tl
    \clist_pop:NN  \l__fdu_tmpa_clist \l__fdu_tmpa_tl
    \clist_pop:NNF \l__fdu_tmpa_clist \l__fdu_tmpb_tl
      { \tl_set_eq:NN \l__fdu_tmpb_tl \c_empty_tl }
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \c__fdu_name_title_tl } { \l__fdu_tmpa_tl } { \c__fdu_fwid_colon_tl }
    \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { } { \l__fdu_tmpb_tl } { \phantom { \c__fdu_fwid_colon_tl } }
    \__fdu_cover_info_skip:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }
\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_left_box:nn { #1 \ccwd } {#3}
  }
\cs_new_protected:Npn \__fdu_fixed_width_left_box:nn #1#2
  { \parbox [t] {#1} { \raggedright #2 } }
\cs_set_protected:Npn \__fdu_cover_info_format:
  { \zihao { -3 } \sffamily }
\cs_set_protected:Npn \__fdu_cover_info_skip:
  { \skip_vertical:n { 0.2 ex } }
\cs_set_protected:Npn \__fdu_define_name:nn #1#2
  { \tl_set:cn { c__fdu_name_ #1 _tl } {#2} }
\keys_define:nn { fdu / info }
  {
    affiliation      .tl_set:N = \l__fdu_info_affiliation_tl,
    supervisor-title .tl_set:N = \l__fdu_info_supervisor_title_tl,
  }
\clist_map_inline:nn
  {
    { student_id       } { 学号         },
    { thesis_title     } { 本科毕业论文 },
    { title            } { 论文题目     },
    { supervisor       } { 指导教师     },
    { supervisor_title } { 职称         },
    { affiliation      } { 单位         },
  }
  { \__fdu_define_name:nn #1 }
\tl_set:Nn \l__fdu_logo_name_tl   { fudan-name.pdf   }
\tl_set:Nn \l__fdu_logo_emblem_tl { fudan-emblem-new.pdf }
\ExplSyntaxOff

% 这里开始就和原来一样了
\fdusetup{
  info={
    % 以下各项都要填写,否则会报错
    author           = {张三},
    student-id       = {18110000000},
    department       = {计算机学院},
    major            = {计算机},
    title            = {题目第一行,第二行},
    % title            = {题目只有第一行},
    supervisor       = {李四五},
    supervisor-title = {教授},
    affiliation      = {软件学院},
  }
}

\begin{document}
...
\end{document}

不过你发的规范里面日期竟然还是居中的(上面也保留了这个居中),看上去怪怪的

修改完成,跑通了,感谢!不过就是论文题目不再是居中的了,你发上来的截图也是如此,这个是意在如此吗,规范好像是要求居中的。

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

是吗,因为你把你学长的标题整个涂掉了,我看不到具体样式。

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

标题居中的话用下面这个吧:

\documentclass{fduthesis}

% 请不要改动 \ExplSyntaxOn ... \ExplSyntaxOff 之间的代码!
\ExplSyntaxOn
\RenewDocumentCommand \makecoveri { }
  {
    \thispagestyle { empty }
    \UseInstance { fdu / cover } { cover-bachelor-default }
  }
\DeclareCoverTemplate { cover-bachelor } { logo-i, title, logo-ii, info }
\DeclareInstance { fdu / cover } { cover-bachelor-default } { cover-bachelor }
  {
    top-skip              = 0 pt plus 0.1 fill,
    bottom-skip           = 0 pt plus 0.4 fill,
    logo-i  / content     = \__fdu_cover_logo_i:,
    title   / content     = \c__fdu_name_thesis_title_tl,
    logo-ii / content     = \__fdu_cover_logo_ii:,
    info    / content     = \__fdu_cover_info:,
    title   / format      = \fontsize { 35 } { 35 } \selectfont \sffamily,
    title   / bottom-skip = 0 pt plus 0.1 fill,
    logo-ii / bottom-skip = 0 pt plus 0.2 fill,
    logo-i  / align       = center,
    title   / align       = center,
    logo-ii / align       = center,
    info    / align       = center,
  }
\cs_set_protected:Npn \__fdu_cover_logo_i:
  { \includegraphics [ width = 6.60 cm ] { \l__fdu_logo_name_tl   } }
\cs_set_protected:Npn \__fdu_cover_logo_ii:
  { \includegraphics [ width = 3.70 cm ] { \l__fdu_logo_emblem_tl } }
\cs_set_protected:Npn \__fdu_cover_info:
  {
    \__fdu_cover_title:n       {  20 }
    \__fdu_cover_info_aux_i:nn { 7.5 } { author           }
    \__fdu_cover_info_aux_i:nn { 7.5 } { student_id       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { department       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { major            } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor       }
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor_title } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { affiliation      } \__fdu_cover_info_skip:
    \group_begin:
      \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
        {
          \__fdu_cover_info_format:
          \__fdu_spread_box:nx { 4 \ccwd } {##2}
          ##4
          \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
        }
      \__fdu_cover_info_aux_i:nn {  20 } { date }
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_title:n #1
  {
    \exp_args:NNV \clist_set:Nn \l__fdu_tmpa_clist \l__fdu_info_title_tl
    \clist_pop:NN  \l__fdu_tmpa_clist \l__fdu_tmpa_tl
    \clist_pop:NNF \l__fdu_tmpa_clist \l__fdu_tmpb_tl
      { \tl_set_eq:NN \l__fdu_tmpb_tl \c_empty_tl }
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { \c__fdu_name_title_tl } { \l__fdu_tmpa_tl } { \c__fdu_fwid_colon_tl }
    \__fdu_cover_info_skip:
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { } { \l__fdu_tmpb_tl } { \phantom { \c__fdu_fwid_colon_tl } }
    \__fdu_cover_info_skip:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }
\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }
\cs_set_protected:Npn \__fdu_cover_title_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_center_box:nn { #1 \ccwd } {#3}
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_left_box:nn { #1 \ccwd } {#3}
  }
\cs_new_protected:Npn \__fdu_fixed_width_left_box:nn #1#2
  { \parbox [t] {#1} { \raggedright #2 } }
\cs_set_protected:Npn \__fdu_cover_info_format:
  { \zihao { -3 } \sffamily }
\cs_set_protected:Npn \__fdu_cover_info_skip:
  { \skip_vertical:n { 0.2 ex } }
\cs_set_protected:Npn \__fdu_define_name:nn #1#2
  { \tl_set:cn { c__fdu_name_ #1 _tl } {#2} }
\keys_define:nn { fdu / info }
  {
    affiliation      .tl_set:N = \l__fdu_info_affiliation_tl,
    supervisor-title .tl_set:N = \l__fdu_info_supervisor_title_tl,
  }
\clist_map_inline:nn
  {
    { student_id       } { 学号         },
    { thesis_title     } { 本科毕业论文 },
    { title            } { 论文题目     },
    { supervisor       } { 指导教师     },
    { supervisor_title } { 职称         },
    { affiliation      } { 单位         },
  }
  { \__fdu_define_name:nn #1 }
\tl_set:Nn \l__fdu_logo_name_tl   { fudan-name.pdf   }
\tl_set:Nn \l__fdu_logo_emblem_tl { fudan-emblem-new.pdf }
\ExplSyntaxOff

% 这里开始就和原来一样了
\fdusetup{
  info={
    % 以下各项都要填写,否则会报错
    author           = {张三},
    student-id       = {18110000000},
    department       = {计算机学院},
    major            = {计算机},
    % title            = {题目第一行,第二行},
    title            = {题目只有第一行},
    supervisor       = {李四五},
    supervisor-title = {教授},
    affiliation      = {软件学院},
  }
}

\begin{document}
...
\end{document}

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

标题居中的话用下面这个吧:

\documentclass{fduthesis}

% 请不要改动 \ExplSyntaxOn ... \ExplSyntaxOff 之间的代码!
\ExplSyntaxOn
\RenewDocumentCommand \makecoveri { }
  {
    \thispagestyle { empty }
    \UseInstance { fdu / cover } { cover-bachelor-default }
  }
\DeclareCoverTemplate { cover-bachelor } { logo-i, title, logo-ii, info }
\DeclareInstance { fdu / cover } { cover-bachelor-default } { cover-bachelor }
  {
    top-skip              = 0 pt plus 0.1 fill,
    bottom-skip           = 0 pt plus 0.4 fill,
    logo-i  / content     = \__fdu_cover_logo_i:,
    title   / content     = \c__fdu_name_thesis_title_tl,
    logo-ii / content     = \__fdu_cover_logo_ii:,
    info    / content     = \__fdu_cover_info:,
    title   / format      = \fontsize { 35 } { 35 } \selectfont \sffamily,
    title   / bottom-skip = 0 pt plus 0.1 fill,
    logo-ii / bottom-skip = 0 pt plus 0.2 fill,
    logo-i  / align       = center,
    title   / align       = center,
    logo-ii / align       = center,
    info    / align       = center,
  }
\cs_set_protected:Npn \__fdu_cover_logo_i:
  { \includegraphics [ width = 6.60 cm ] { \l__fdu_logo_name_tl   } }
\cs_set_protected:Npn \__fdu_cover_logo_ii:
  { \includegraphics [ width = 3.70 cm ] { \l__fdu_logo_emblem_tl } }
\cs_set_protected:Npn \__fdu_cover_info:
  {
    \__fdu_cover_title:n       {  20 }
    \__fdu_cover_info_aux_i:nn { 7.5 } { author           }
    \__fdu_cover_info_aux_i:nn { 7.5 } { student_id       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { department       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { major            } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor       }
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor_title } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { affiliation      } \__fdu_cover_info_skip:
    \group_begin:
      \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
        {
          \__fdu_cover_info_format:
          \__fdu_spread_box:nx { 4 \ccwd } {##2}
          ##4
          \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
        }
      \__fdu_cover_info_aux_i:nn {  20 } { date }
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_title:n #1
  {
    \exp_args:NNV \clist_set:Nn \l__fdu_tmpa_clist \l__fdu_info_title_tl
    \clist_pop:NN  \l__fdu_tmpa_clist \l__fdu_tmpa_tl
    \clist_pop:NNF \l__fdu_tmpa_clist \l__fdu_tmpb_tl
      { \tl_set_eq:NN \l__fdu_tmpb_tl \c_empty_tl }
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { \c__fdu_name_title_tl } { \l__fdu_tmpa_tl } { \c__fdu_fwid_colon_tl }
    \__fdu_cover_info_skip:
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { } { \l__fdu_tmpb_tl } { \phantom { \c__fdu_fwid_colon_tl } }
    \__fdu_cover_info_skip:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }
\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }
\cs_set_protected:Npn \__fdu_cover_title_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_center_box:nn { #1 \ccwd } {#3}
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_left_box:nn { #1 \ccwd } {#3}
  }
\cs_new_protected:Npn \__fdu_fixed_width_left_box:nn #1#2
  { \parbox [t] {#1} { \raggedright #2 } }
\cs_set_protected:Npn \__fdu_cover_info_format:
  { \zihao { -3 } \sffamily }
\cs_set_protected:Npn \__fdu_cover_info_skip:
  { \skip_vertical:n { 0.2 ex } }
\cs_set_protected:Npn \__fdu_define_name:nn #1#2
  { \tl_set:cn { c__fdu_name_ #1 _tl } {#2} }
\keys_define:nn { fdu / info }
  {
    affiliation      .tl_set:N = \l__fdu_info_affiliation_tl,
    supervisor-title .tl_set:N = \l__fdu_info_supervisor_title_tl,
  }
\clist_map_inline:nn
  {
    { student_id       } { 学号         },
    { thesis_title     } { 本科毕业论文 },
    { title            } { 论文题目     },
    { supervisor       } { 指导教师     },
    { supervisor_title } { 职称         },
    { affiliation      } { 单位         },
  }
  { \__fdu_define_name:nn #1 }
\tl_set:Nn \l__fdu_logo_name_tl   { fudan-name.pdf   }
\tl_set:Nn \l__fdu_logo_emblem_tl { fudan-emblem-new.pdf }
\ExplSyntaxOff

% 这里开始就和原来一样了
\fdusetup{
  info={
    % 以下各项都要填写,否则会报错
    author           = {张三},
    student-id       = {18110000000},
    department       = {计算机学院},
    major            = {计算机},
    % title            = {题目第一行,第二行},
    title            = {题目只有第一行},
    supervisor       = {李四五},
    supervisor-title = {教授},
    affiliation      = {软件学院},
  }
}

\begin{document}
...
\end{document}

但是居中之后编译得到的居中标题又和info名称无法对齐了(((

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

我现在有点事,这个很好改,你先弄别的吧,我晚上回去改好给你

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 4, 2024

我现在有点事,这个很好改,你先弄别的吧,我晚上回去改好给你

好的好的,感谢!实在是麻烦了(((

@xkwxdyy
Copy link

xkwxdyy commented May 4, 2024

\documentclass{fduthesis}

% 请不要改动 \ExplSyntaxOn ... \ExplSyntaxOff 之间的代码!
\ExplSyntaxOn
\RenewDocumentCommand \makecoveri { }
  {
    \thispagestyle { empty }
    \UseInstance { fdu / cover } { cover-bachelor-default }
  }
\DeclareCoverTemplate { cover-bachelor } { logo-i, title, logo-ii, info }
\DeclareInstance { fdu / cover } { cover-bachelor-default } { cover-bachelor }
  {
    top-skip              = 0 pt plus 0.1 fill,
    bottom-skip           = 0 pt plus 0.4 fill,
    logo-i  / content     = \__fdu_cover_logo_i:,
    title   / content     = \c__fdu_name_thesis_title_tl,
    logo-ii / content     = \__fdu_cover_logo_ii:,
    info    / content     = \__fdu_cover_info:,
    title   / format      = \fontsize { 35 } { 35 } \selectfont \sffamily,
    title   / bottom-skip = 0 pt plus 0.1 fill,
    logo-ii / bottom-skip = 0 pt plus 0.2 fill,
    logo-i  / align       = center,
    title   / align       = center,
    logo-ii / align       = center,
    info    / align       = center,
  }
\cs_set_protected:Npn \__fdu_cover_logo_i:
  { \includegraphics [ width = 6.60 cm ] { \l__fdu_logo_name_tl   } }
\cs_set_protected:Npn \__fdu_cover_logo_ii:
  { \includegraphics [ width = 3.70 cm ] { \l__fdu_logo_emblem_tl } }
\cs_set_protected:Npn \__fdu_cover_info:
  {
    \__fdu_cover_title:n       {  20 }
    \__fdu_cover_info_aux_i:nn { 7.5 } { author           }
    \__fdu_cover_info_aux_i:nn { 7.5 } { student_id       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { department       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { major            } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor       }
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor_title } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { affiliation      } \__fdu_cover_info_skip:
    \group_begin:
      \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
        {
          \__fdu_cover_info_format:
          \__fdu_spread_box:nx { 4 \ccwd } {##2}
          ##4
          \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
        }
      \__fdu_cover_info_aux_i:nn {  20 } { date }
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_title:n #1
  {
    \exp_args:NNV \clist_set:Nn \l__fdu_tmpa_clist \l__fdu_info_title_tl
    \clist_pop:NN  \l__fdu_tmpa_clist \l__fdu_tmpa_tl
    \clist_pop:NNF \l__fdu_tmpa_clist \l__fdu_tmpb_tl
      { \tl_set_eq:NN \l__fdu_tmpb_tl \c_empty_tl }
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { \c__fdu_name_title_tl } { \l__fdu_tmpa_tl } { \c__fdu_fwid_colon_tl }
    \__fdu_cover_info_skip:
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { } { \l__fdu_tmpb_tl } { \phantom { \c__fdu_fwid_colon_tl } }
    \__fdu_cover_info_skip:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }
\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }
\cs_set_protected:Npn \__fdu_cover_title_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \group_begin:
      \cs_set:Npn \__fdu_fixed_width_center_box:nn ##1##2
        { \parbox [t] {##1} { \centering ##2 } }
    \__fdu_fixed_width_center_box:nn { #1 \ccwd } {#3}
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_left_box:nn { #1 \ccwd } {#3}
  }
\cs_new_protected:Npn \__fdu_fixed_width_left_box:nn #1#2
  { \parbox [t] {#1} { \raggedright #2 } }
\cs_set_protected:Npn \__fdu_cover_info_format:
  { \zihao { -3 } \sffamily }
\cs_set_protected:Npn \__fdu_cover_info_skip:
  { \skip_vertical:n { 0.2 ex } }
\cs_set_protected:Npn \__fdu_define_name:nn #1#2
  { \tl_set:cn { c__fdu_name_ #1 _tl } {#2} }
\keys_define:nn { fdu / info }
  {
    affiliation      .tl_set:N = \l__fdu_info_affiliation_tl,
    supervisor-title .tl_set:N = \l__fdu_info_supervisor_title_tl,
  }
\clist_map_inline:nn
  {
    { student_id       } { 学号         },
    { thesis_title     } { 本科毕业论文 },
    { title            } { 论文题目     },
    { supervisor       } { 指导教师     },
    { supervisor_title } { 职称         },
    { affiliation      } { 单位         },
  }
  { \__fdu_define_name:nn #1 }
\tl_set:Nn \l__fdu_logo_name_tl   { fudan-name.pdf   }
\tl_set:Nn \l__fdu_logo_emblem_tl { fudan-emblem-new.pdf }
\ExplSyntaxOff

% 这里开始就和原来一样了
\fdusetup{
  info={
    % 以下各项都要填写,否则会报错
    author           = {张三},
    student-id       = {18110000000},
    department       = {计算机学院},
    major            = {计算机},
    title            = {题目第一行,第二行},
    % title            = {题目只有第一行},
    supervisor       = {李四五},
    supervisor-title = {教授},
    affiliation      = {软件学院},
  }
}

\begin{document}
...
\end{document}

@ODYYYYYY
Copy link
Author

ODYYYYYY commented May 6, 2024

\documentclass{fduthesis}

% 请不要改动 \ExplSyntaxOn ... \ExplSyntaxOff 之间的代码!
\ExplSyntaxOn
\RenewDocumentCommand \makecoveri { }
  {
    \thispagestyle { empty }
    \UseInstance { fdu / cover } { cover-bachelor-default }
  }
\DeclareCoverTemplate { cover-bachelor } { logo-i, title, logo-ii, info }
\DeclareInstance { fdu / cover } { cover-bachelor-default } { cover-bachelor }
  {
    top-skip              = 0 pt plus 0.1 fill,
    bottom-skip           = 0 pt plus 0.4 fill,
    logo-i  / content     = \__fdu_cover_logo_i:,
    title   / content     = \c__fdu_name_thesis_title_tl,
    logo-ii / content     = \__fdu_cover_logo_ii:,
    info    / content     = \__fdu_cover_info:,
    title   / format      = \fontsize { 35 } { 35 } \selectfont \sffamily,
    title   / bottom-skip = 0 pt plus 0.1 fill,
    logo-ii / bottom-skip = 0 pt plus 0.2 fill,
    logo-i  / align       = center,
    title   / align       = center,
    logo-ii / align       = center,
    info    / align       = center,
  }
\cs_set_protected:Npn \__fdu_cover_logo_i:
  { \includegraphics [ width = 6.60 cm ] { \l__fdu_logo_name_tl   } }
\cs_set_protected:Npn \__fdu_cover_logo_ii:
  { \includegraphics [ width = 3.70 cm ] { \l__fdu_logo_emblem_tl } }
\cs_set_protected:Npn \__fdu_cover_info:
  {
    \__fdu_cover_title:n       {  20 }
    \__fdu_cover_info_aux_i:nn { 7.5 } { author           }
    \__fdu_cover_info_aux_i:nn { 7.5 } { student_id       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { department       } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { major            } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor       }
    \__fdu_cover_info_aux_i:nn { 7.5 } { supervisor_title } \__fdu_cover_info_skip:
    \__fdu_cover_info_aux_i:nn {  20 } { affiliation      } \__fdu_cover_info_skip:
    \group_begin:
      \cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn ##1##2##3##4
        {
          \__fdu_cover_info_format:
          \__fdu_spread_box:nx { 4 \ccwd } {##2}
          ##4
          \__fdu_fixed_width_center_box:nn { ##1 \ccwd } {##3}
        }
      \__fdu_cover_info_aux_i:nn {  20 } { date }
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_title:n #1
  {
    \exp_args:NNV \clist_set:Nn \l__fdu_tmpa_clist \l__fdu_info_title_tl
    \clist_pop:NN  \l__fdu_tmpa_clist \l__fdu_tmpa_tl
    \clist_pop:NNF \l__fdu_tmpa_clist \l__fdu_tmpb_tl
      { \tl_set_eq:NN \l__fdu_tmpb_tl \c_empty_tl }
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { \c__fdu_name_title_tl } { \l__fdu_tmpa_tl } { \c__fdu_fwid_colon_tl }
    \__fdu_cover_info_skip:
    \__fdu_cover_title_aux_ii:nnnn {#1}
      { } { \l__fdu_tmpb_tl } { \phantom { \c__fdu_fwid_colon_tl } }
    \__fdu_cover_info_skip:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_i:nn #1#2
  {
    \__fdu_cover_info_aux_ii:nnnn {#1}
      { \tl_use:c { c__fdu_name_ #2 _tl } }
      { \tl_use:c { l__fdu_info_ #2 _tl } }
      { \c__fdu_fwid_colon_tl }
  }
\cs_generate_variant:Nn \__fdu_spread_box:nn { nx }
\cs_set_protected:Npn \__fdu_cover_title_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \group_begin:
      \cs_set:Npn \__fdu_fixed_width_center_box:nn ##1##2
        { \parbox [t] {##1} { \centering ##2 } }
    \__fdu_fixed_width_center_box:nn { #1 \ccwd } {#3}
    \group_end:
  }
\cs_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nx { 4 \ccwd } {#2}
    #4
    \__fdu_fixed_width_left_box:nn { #1 \ccwd } {#3}
  }
\cs_new_protected:Npn \__fdu_fixed_width_left_box:nn #1#2
  { \parbox [t] {#1} { \raggedright #2 } }
\cs_set_protected:Npn \__fdu_cover_info_format:
  { \zihao { -3 } \sffamily }
\cs_set_protected:Npn \__fdu_cover_info_skip:
  { \skip_vertical:n { 0.2 ex } }
\cs_set_protected:Npn \__fdu_define_name:nn #1#2
  { \tl_set:cn { c__fdu_name_ #1 _tl } {#2} }
\keys_define:nn { fdu / info }
  {
    affiliation      .tl_set:N = \l__fdu_info_affiliation_tl,
    supervisor-title .tl_set:N = \l__fdu_info_supervisor_title_tl,
  }
\clist_map_inline:nn
  {
    { student_id       } { 学号         },
    { thesis_title     } { 本科毕业论文 },
    { title            } { 论文题目     },
    { supervisor       } { 指导教师     },
    { supervisor_title } { 职称         },
    { affiliation      } { 单位         },
  }
  { \__fdu_define_name:nn #1 }
\tl_set:Nn \l__fdu_logo_name_tl   { fudan-name.pdf   }
\tl_set:Nn \l__fdu_logo_emblem_tl { fudan-emblem-new.pdf }
\ExplSyntaxOff

% 这里开始就和原来一样了
\fdusetup{
  info={
    % 以下各项都要填写,否则会报错
    author           = {张三},
    student-id       = {18110000000},
    department       = {计算机学院},
    major            = {计算机},
    title            = {题目第一行,第二行},
    % title            = {题目只有第一行},
    supervisor       = {李四五},
    supervisor-title = {教授},
    affiliation      = {软件学院},
  }
}

\begin{document}
...
\end{document}

昨天电脑不在身边,刚刚验证过这段代码没有问题,感谢!

@stone-zeng stone-zeng linked a pull request May 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants