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

本科毕业论文的封面 #142

Open
stone-zeng opened this issue May 29, 2020 · 0 comments · Fixed by #342
Open

本科毕业论文的封面 #142

stone-zeng opened this issue May 29, 2020 · 0 comments · Fixed by #342
Labels

Comments

@stone-zeng
Copy link
Owner

stone-zeng commented May 29, 2020

本科毕业论文和硕士、博士论文的封面差异较大,可以参照以下代码使用:

\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:nn { 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 }
    \tl_if_empty:NTF \l__fdu_tmpb_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}
          { \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_set_protected:Npn \__fdu_cover_info_aux_ii:nnnn #1#2#3#4
  {
    \__fdu_cover_info_format:
    \__fdu_spread_box:nn { 4 \ccwd } {#2}
    #4
    \hbox_overlap_right:n { \__fdu_blank_underline:n { #1 \ccwd } }
    \__fdu_fixed_width_center_box:nn { #1 \ccwd } {#3}
  }
\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}

image

以后可能会把这个加进模板。

@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.

1 participant