Skip to content

Commit

Permalink
feat: append and prepend pdf as covers
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanfei-1 committed May 20, 2024
1 parent af18bb3 commit 5d513c1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
10 changes: 7 additions & 3 deletions docs/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@
% 插入扫描版的声明页 PDF 文档
% 默认使用预定义的声明页,但不带签名
%
% auto-make-cover = true
% 是否自动生成论文封面(封一)、指导小组成员名单(封二)和声明页(封三)
% 除非特殊需要(e.g. 不要封面),否则不建议设为 false
% prepend-cover = {prepend-cover.pdf}
% 插入预先生成的封面 PDF 到文档首,包括论文封面(封一)、论文撰写人承诺书(封二)等
% 将 PDF 文档放入 thesis 文件夹下
%
% append-cover = {append-cover.pdf}
% 插入预先生成的封底 PDF 到文档尾,包括教师审查意见(封三)等
% 将 PDF 文档放入 thesis 文件夹下
},
%
% info 类用于录入论文信息
Expand Down
47 changes: 43 additions & 4 deletions source/fduthesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -5263,10 +5263,12 @@ Copyright (C) 2017&ndash;2024 by Xiangdong Zeng <[email protected]>.
}
% \end{macrocode}
%
% \begin{variable}{\l_@@_auto_make_cover_bool,\l_@@_declaration_page_tl}
% \begin{variable}{\l_@@_auto_make_cover_bool,\l_@@_declaration_page_tl, \l_@@_prepend_cover_tl, \l_@@_append_cover_tl}
% \begin{macrocode}
\bool_new:N \l_@@_auto_make_cover_bool
\tl_new:N \l_@@_declaration_page_tl
\tl_new:N \l_@@_prepend_cover_tl
\tl_new:N \l_@@_append_cover_tl
% \end{macrocode}
% \end{variable}
%
Expand All @@ -5276,7 +5278,7 @@ Copyright (C) 2017&ndash;2024 by Xiangdong Zeng <[email protected]>.
\keys_define:nn { fdu / style }
{
auto-make-cover .bool_set:N = \l_@@_auto_make_cover_bool,
auto-make-cover .default:n = true,
auto-make-cover .default:n = false,
% \end{macrocode}
% \end{macro}
%
Expand All @@ -5290,6 +5292,28 @@ Copyright (C) 2017&ndash;2024 by Xiangdong Zeng <[email protected]>.
\tl_set_eq:NN \l_@@_declaration_page_tl \l_keys_value_tl
\RequirePackage { pdfpages }
},
% \end{macrocode}
%
% \begin{macro}{style/declaration-page}
% 插入预先生成的封面 PDF 到文档首,包括论文封面(封一)、论文撰写人承诺书(封二)等
% 仅当 auto-make-cover = false 时有效
% \begin{macrocode}
prepend-cover .code:n =
{
\tl_set_eq:NN \l_@@_prepend_cover_tl \l_keys_value_tl
\RequirePackage { pdfpages }
},
% \end{macrocode}
%
% \begin{macro}{style/declaration-page}
% 插入预先生成的封底 PDF 到文档尾,包括教师审查意见(封三)等
% 仅当 auto-make-cover = false 时有效
% \begin{macrocode}
append-cover .code:n =
{
\tl_set_eq:NN \l_@@_append_cover_tl \l_keys_value_tl
\RequirePackage { pdfpages }
},
}
% \end{macrocode}
% \end{macro}
Expand All @@ -5298,12 +5322,27 @@ Copyright (C) 2017&ndash;2024 by Xiangdong Zeng <[email protected]>.
% \begin{macrocode}
\ctex_after_end_preamble:n
{
\bool_if:NT \l_@@_auto_make_cover_bool
\bool_if:NTF \l_@@_auto_make_cover_bool
{
\begin{titlepage}
\makecoveri \newpage \makecoverii
\end{titlepage}
}
{
\begin{titlepage}
\thispagestyle { empty }
\tl_set:Nn \thepage { A }
\tl_if_empty:NTF \l_@@_prepend_cover_tl
{ \empty }
{
% separate each pdf file with a comma
\tl_set:Nn \l_tmpa_tl { \l_@@_prepend_cover_tl }
\tl_replace_all:Nnn \l_tmpa_tl { , } { }

\includepdf { \l_@@_prepend_cover_tl }
}
\end{titlepage}
}
}
% \end{macrocode}
%
Expand Down Expand Up @@ -6044,7 +6083,7 @@ Copyright (C) 2017&ndash;2024 by Xiangdong Zeng <[email protected]>.
%<class> style / cjk-font = fandol,
style / font-size = -4,
%<class> style / fullwidth-stop = false,
style / auto-make-cover = true,
style / auto-make-cover = false,
style / logo = { fudan-name.pdf },
style / logo-size = { 0.5 \textwidth },
style / hyperlink = color,
Expand Down

0 comments on commit 5d513c1

Please sign in to comment.