diff --git a/source/njuthesis.dtx b/source/njuthesis.dtx index 68e820dacbd950213ec004ea33709f6c381cd8bd..1249a25ab3fe1c7d8cb1f11a7597b27cafbf44ec 100644 --- a/source/njuthesis.dtx +++ b/source/njuthesis.dtx @@ -113,11 +113,12 @@ through XeTeX. %<*driver> \ProvidesFile{njuthesis.dtx} \documentclass{ctxdoc} -\usepackage{listings,tabularray,njuvisual} +\usepackage{listings,njuvisual,tabularray} \usepackage[firstpage=true]{background} \backgroundsetup{contents={\njuemblem[white!85!gray]{22cm}{!}},scale=1,angle=0,hshift=-4cm} \newcommand*\scite[1]{\textsuperscript{\cite{#1}}} \setlist[1]{labelindent=0.5em} +\hypersetup{pdftitle={The njuthesis class 鈥� LaTeX thesis template for Nanjing University}} \UseTblrLibrary{booktabs,siunitx,diagbox} \DefTblrTemplate{caption-tag}{default}{琛╘hspace{0.25em}\thetable} \SetTblrStyle{caption-tag}{font=\bfseries} @@ -133,6 +134,7 @@ through XeTeX. xleftmargin = 2 em, xrightmargin = 3 em, escapeinside = {(*}{*)}, + breaklines = true, basicstyle = \small\ttfamily, keywordstyle = \bfseries\color{njuviolet}, commentstyle = \itshape\color{white!50!gray}, @@ -1184,10 +1186,10 @@ through XeTeX. % \subsection{瑙嗚璇嗗埆绯荤粺} % % 瑙嗚璇嗗埆绯荤粺 \pkg{njuvisual} 鐜板凡琚垎绂讳负鐙珛瀹忓寘锛屽熀鏈娇鐢ㄦ柟娉曚妇渚嬪涓嬶細 -% \begin{latexexample}[moretexcs={\njuemblem}] -% \njuemblem{!}{3cm} % 榛樿鐢熸垚鎸囧畾澶у皬鐨勭传鑹插崡澶ф牎寰� -% \njuname{4cm}{!} % 榛樿鐢熸垚鎸囧畾澶у皬鐨勭传鑹插崡澶т腑鏂囨牎鍚� -% \njuname*{4cm}{!} % 榛樿鐢熸垚鎸囧畾澶у皬鐨勭传鑹插崡澶ц嫳鏂囨牎鍚� +% \begin{latexexample}[moretexcs={\njuemblem,\njuname}] +% \njuemblem{!}{3cm} % 鐢熸垚鎸囧畾澶у皬鐨勭传鑹插崡澶ф牎寰� +% \njuname{4cm}{!} % 鐢熸垚鎸囧畾澶у皬鐨勭传鑹插崡澶т腑鏂囨牎鍚� +% \njuname*{4cm}{!} % 鐢熸垚鎸囧畾澶у皬鐨勭传鑹插崡澶ц嫳鏂囨牎鍚� % \njuemblem[black]{!}{3cm} % 榛戣壊鐨勫崡澶ф牎寰� % \njuemblem[department=dii]{!}{4cm} % 绱壊鍖¢櫌寰芥爣 % \njuemblem[department=cs,color=blue]{!}{3cm} % 绾摑鑹茶绉戝窘鏍� @@ -2505,415 +2507,40 @@ through XeTeX. } % \end{macrocode} % -% 鍒ゆ柇瀛︿綅杩涜鍛戒护瀹氫箟 +% 浣跨敤 \pkg{xtemplate} 閲嶆瀯灏侀潰妯℃澘 % \begin{macrocode} -\int_compare:nTF { \g_@@_info_degree_int == 1 } - { - % 鏈 - \tl_const:Nn \c_@@_name_title_tl { 棰榎hfill 鐩� } - - \tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt } - \tl_const:Nn \c_@@_cover_uline_len_b_tl { 90pt } - \tl_const:Nn \c_@@_cover_uline_font_tl { \songti } - \tl_const:Nn \c_@@_cover_uline_style_tl { \bf } - \tl_const:Nn \c_@@_cover_uline_bskip_tl {} - - \tl_const:Nn \c_@@_cover_box_len_tl { 4.2em } - - % 鏈寮哄埗涓嶆墦鍗板浗瀹跺浘涔﹂灏侀潰 - \bool_set_false:N \g_@@_nlcover_bool - } - { - % 鏈浠ュ閮芥槸鐮旂┒鐢� - \tl_const:Nn \c_@@_name_title_tl { 璁篭hfill 鏂嘰hfill 棰榎hfill 鐩� } - - \tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt } - \tl_const:Nn \c_@@_cover_uline_len_b_tl { 14em } - \tl_const:Nn \c_@@_cover_uline_font_tl { \kaishu } - \tl_const:Nn \c_@@_cover_uline_style_tl {} - \tl_const:Nn \c_@@_cover_uline_bskip_tl { \hspace{1em} } - - \tl_const:Nn \c_@@_cover_box_len_tl { 6em } - } -% \end{macrocode} -% \begin{macro}{\@@_spread_box:nn} -% 鏉ヨ嚜\cls{fduthesis}锛氬垎鏁e榻愮殑姘村钩鐩掑瓙銆� -% \begin{arguments} -% \item 瀹藉害 -% \item 鍐呭 -% \end{arguments} -% 鍒╃敤 \cs{tl_map_inline:nn} 鍦ㄥ瓧绗﹂棿鎻掑叆 \tn{hfil}锛涚揣闅忓叾鍚庣殑 \tn{unskip} -% 灏嗕細鍘绘帀鏈€鍚庝竴涓� \tn{hfil}銆傝 \url{https://tex.stackexchange.com/q/169689}銆� -% |#2| 闇€瑕佸畬鍏ㄥ睍寮€浠ラ伩鍏� underfull 璀﹀憡銆� -% \begin{macrocode} -\cs_generate_variant:Nn \tl_map_inline:nn { xn } -\cs_new_protected:Npn \@@_spread_box:nn #1#2 - { - \mode_leave_vertical: - \hbox_to_wd:nn {#1} - { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip } - } -% \end{macrocode} -% \end{macro} +% 澹版槑灏侀潰瀵硅薄銆� +% \DeclareObjectType {鉄╫bject type鉄﹠ {鉄╪o. of args鉄﹠ +\DeclareObjectType { nju / cover } { \c_zero_int } % -% \begin{macro}{\@@_cover_uline_a:n} -% 鍦ㄥ皝闈㈢粯鍒朵笅鍒掔嚎 -% \begin{macrocode} -\cs_new_protected:Npn \@@_cover_uline_a:n #1 +% 澹版槑灏侀潰妯℃澘銆� +% \DeclareTemplateInterface {鉄╫bject type鉄﹠ {鉄╰emplate鉄﹠ {鉄╪o. of args鉄﹠ {鉄╧ey list鉄﹠ +\DeclareTemplateInterface { nju / cover } { undergraduate } { \c_zero_int } { - \uline{\makebox[\c_@@_cover_uline_len_a_tl] - {\rm\c_@@_cover_uline_font_tl #1 }} + format : tokenlist } -\cs_new_protected:Npn \@@_cover_uline_b:n #1 +\tl_new:N \l_@@_ug_format_tl +% \DeclareTemplateCode {鉄╫bject type鉄﹠ {鉄╰emplate鉄﹠ {鉄╪o. of args鉄﹠ {鉄╧ey bindings鉄﹠ {鉄╟ode鉄﹠ +\DeclareTemplateCode { nju / cover } { undergraduate } { \c_zero_int } { - \uline{\makebox[\c_@@_cover_uline_len_b_tl] - {\rm\c_@@_cover_uline_font_tl #1 }} + format = \l_@@_ug_format_tl } -\cs_new_protected:Npn \@@_cover_uline_nl:nn #1 #2 { - \uline{\makebox[#1] - {\rm\c_@@_cover_uline_font_tl #2 }} + \AssignTemplateKeys + \chapter*{TITLE PAGE} + \tl_use:c {\l_@@_ug_format_tl } + { Random words} } -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\@@_cover_box:n} -% 灏侀潰琛ㄦ牸杈规 -% \begin{macrocode} -\cs_new_protected:Npn \@@_cover_box:n #1 - { - \makebox[\c_@@_cover_box_len_tl][s]{ - #1\c_@@_cover_uline_bskip_tl} - } -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\@@_cover_degree:} -% 瀛︿綅绫诲瀷銆� -% \begin{macrocode} -\cs_new_protected:Npn \@@_cover_degree: +% \DeclareInstance {鉄╫bject type 鉄﹠ {鉄╥nstance 鉄﹠ {鉄╰emplate 鉄﹠ {鉄╬arameters 鉄﹠ +\DeclareInstance { nju / cover } { cover-ug } { undergraduate } { - { 锛堢敵璇� } - \clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int } - { 瀛︿綅锛� } + format = centering } -% \end{macrocode} -% \end{macro} -% -% \subsubsection{灏侀潰缁勪欢} % -% \begin{macro}{\@@_cover_title_breakline:} -% 瀵规爣棰樿繘琛岃嚜鍔ㄥ垽鏂紝濡傛灉鏌愯鏍囬绌哄垯涓嶈緭鍑烘帴涓嬫潵鐨勮嫢骞茶锛屽緱鍒板琛屾爣棰樸€� -% \begin{macrocode} -\cs_new_protected:Npn \@@_cover_title_breakline: - { - \@@_cover_box:n {\c_@@_name_title_tl} - & \@@_cover_uline_a:n - { \c_@@_cover_uline_style_tl \l_@@_info_title_a_tl } \\ - \tl_if_empty:NF \l_@@_info_title_b_tl - { - \tl_if_empty:NTF \l_@@_info_title_c_tl - { - & \@@_cover_uline_a:n - {\c_@@_cover_uline_style_tl \l_@@_info_title_b_tl } \\ - } - { - & \@@_cover_uline_a:n - { \c_@@_cover_uline_style_tl \l_@@_info_title_b_tl } \\ - & \@@_cover_uline_a:n - { \c_@@_cover_uline_style_tl \l_@@_info_title_c_tl } \\ - } - } - } -% \end{macrocode} -% \end{macro} +% \UseInstance {鉄╫bject type 鉄﹠ {鉄╥nstance 鉄﹠ 鉄╝rguments 鉄� +% \UseTemplate {鉄╫bject type 鉄﹠ {鉄╰emplate 鉄﹠ {鉄╯ettings 鉄﹠ 鉄╝rguments 鉄� % -% \begin{macro}{\@@_print_covertab:} -% 灏侀潰淇℃伅鏍� -% \begin{macrocode} -\cs_new_protected:Npn \@@_print_covertab: -{% -\int_compare:nTF { \g_@@_info_degree_int == 1 } - { - \begin{tabular}{p{4.2em}c} - \@@_cover_box:n {闄hfill 绯粆 - & \@@_cover_uline_a:n {\l_@@_info_dept_tl} \\ - \@@_cover_box:n {涓揬hfill 涓殅 - & \@@_cover_uline_a:n {\l_@@_major_tl} \\ - \@@_cover_title_breakline: - \end{tabular}\\ - - \begin{tabular}{p{4.2em}cp{4.2em}c} - \@@_cover_box:n {骞碶hfill 绾 - & \@@_cover_uline_b:n {\l_@@_info_grade_tl} - & \@@_cover_box:n {瀛hfill 鍙穧 - & \@@_cover_uline_b:n {\l_@@_info_id_tl}\\ - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \@@_cover_box:n {瀛hfill 鐢焅hfill 濮揬hfill 鍚峿 - & \@@_cover_uline_a:n {\l_@@_info_author_tl} - \end{tabular}\\ - \begin{tabular}{p{4.2em}cp{4.2em}c} - \@@_cover_box:n {瀵糪hfill 甯坿 - & \@@_cover_uline_b:n {\l_@@_info_supv_a_tl} - & \@@_cover_box:n {鑱孿hfill 绉皚 - & \@@_cover_uline_b:n {\l_@@_info_supv_a_title_tl}\\ - - % 绗簩瀵煎笀 - \tl_if_empty:NF \l_@@_info_supv_b_tl - { - \@@_cover_box:n {绗琝hfill 浜孿hfill 瀵糪hfill 甯坿 - & \@@_cover_uline_b:n {\l_@@_info_supv_b_tl} - & \@@_cover_box:n {鑱孿hfill 绉皚 - & \@@_cover_uline_b:n {\l_@@_info_supv_b_title_tl}\\ - } - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \@@_cover_box:n {鎻怽hfill 浜hfill 鏃hfill 鏈焳 - & \@@_cover_uline_a:n {\l_@@_submit_date_tl}\\ - \end{tabular} - } - { - \begin{tabular}{p{6em}c} - \@@_cover_title_breakline: - \@@_cover_box:n {浣淺hfill 鑰匼hfill 濮揬hfill 鍚峿 - & \@@_cover_uline_a:n {\@@_spread_box:nn {4em}{\l_@@_info_author_tl}}\\ - \@@_cover_box:n {涓揬hfill 涓歕hfill 鍚峔hfill 绉皚 - & \@@_cover_uline_a:n {\l_@@_major_tl}\\ - \@@_cover_box:n {鐮擻hfill 绌禱hfill 鏂筡hfill 鍚憓 - & \@@_cover_uline_a:n {\l_@@_field_tl}\\ - \@@_cover_box:n {鎸嘰hfill 瀵糪hfill 鏁橽hfill 甯坿 - & \@@_cover_uline_a:n {\l_@@_info_supv_full_tl}\\ - \end{tabular} - } -} -% \end{macrocode} -% \end{macro} -% -% -% \subsubsection{缁樺埗灏侀潰} -% -% \begin{macro}{\@@_print_cover_nl:} -% \changes{v0.12}{2021/12/02}{閫夋嫨|nlcover|鏃朵笉鐢熸垚鏅€氬皝闈€€倉 -% 鎸夐渶缁樺埗鍥藉鍥句功棣嗗皝闈紝淇敼鑷儭娴锋槦妯℃澘 -% \begin{macrocode} -\cs_new_protected:Npn \@@_print_cover_nl: -{ - \pdfbookmark[0]{鍥藉鍥句功棣嗗皝闈{nl} - { - % 椤剁 - \noindent\null\vskip -20mm \hskip -15mm - \songti\zihao{-4} - \makebox[40pt][l]{鍒嗙被鍙穧 - \@@_cover_uline_b:n {\l_@@_info_clc_tl} - \hfill - \makebox[40pt][l]{瀵嗙骇} - \@@_cover_uline_b:n {\l_@@_info_seclv_tl} - \vskip 10pt \hskip -15mm - \makebox[40pt][l]{udc} - \@@_cover_uline_b:n {\l_@@_info_udc_tl} - } - - % 涓儴 - \vskip\stretch{2} - \begin{center} - \def\ULthickness{1pt} - {\kaishu\zihao{-0} 瀛hspace{0.5em}浣峔hspace{0.5em}璁篭hspace{0.5em}鏂噠 - { - \kaishu\zihao{1} - \vskip \stretch{1} - \@@_cover_uline_b:n {\l_@@_info_title_a_tl}\\ - \@@_cover_uline_b:n {\l_@@_info_title_b_tl}\\ - \@@_cover_uline_b:n {\l_@@_info_title_c_tl}\\ - } - \vskip \stretch{1} - {\kaishu\zihao{4}锛堥鍚嶅拰鍓鍚嶏級} - \vskip \stretch{1} \vskip 5mm - {\kaishu\zihao{1}\uline{\makebox{\l_@@_info_author_tl}}} - \vskip \stretch{1} - {\kaishu\zihao{4}锛堜綔鑰呭鍚嶏級} - \end{center} - - % 搴曢儴 - \vskip\stretch{1}\kaishu\zihao{4} - \noindent 鎸囧鏁欏笀濮撳悕銆佽亴鍔°€佽亴绉般€佸浣嶃€佸崟浣嶅悕绉板強鍦板潃% - \@@_cover_uline_nl:nn {94pt}{\l_@@_info_supv_a_tl}\par - \noindent \@@_cover_uline_nl:nn {\textwidth}{% - \l_@@_info_supv_cont_tl}\par - \noindent 鐢宠瀛︿綅绾у埆% - \@@_cover_uline_nl:nn {9em}{\clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int }}% - \noindent 涓撲笟鍚嶇О% - \uline{\hfill\l_@@_major_tl\hfill}\par - \noindent 璁烘枃鎻愪氦鏃ユ湡% - \@@_cover_uline_nl:nn {9em}{\l_@@_submit_date_tl}% - \noindent 璁烘枃绛旇京鏃ユ湡% - \uline{\hfill\l_@@_defend_date_tl\hfill}\par - \noindent 瀛︿綅鎺堜簣鍗曚綅鍜屾棩鏈焅uline{\hfill}\par - \begin{flushright} - 绛旇京濮斿憳浼氫富甯細 - \@@_cover_uline_nl:nn {9em}{ \l_@@_info_chairman_tl }\par - 璇勯槄浜猴細 - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {1} }\par - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {2} }\par - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {3} }\par - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {4} }\par - \end{flushright} - \begin{center} - \kaishu\zihao{3}\hspace{2em} 骞碶hspace{1em} 鏈圽hspace{1em} 鏃� - \end{center} - \vskip -10mm -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_print_declaration:} -% \changes{v0.12}{2021/12/02}{娣诲姞鍘熷垱鎬у0鏄庨〉闈€€倉 -% 鍘熷垱鎬у0鏄庛€� -% \begin{macrocode} -\cs_new_protected:Npn \@@_print_declaration: - { - \normalfont\normalsize - \chapter*{鍗椾含澶у瀛︿綅璁烘枃鍘熷垱鎬у0鏄巬 - \thispagestyle{empty} - \c_@@_orig_decl_text_tl - \vfil - \begin{flushright} - {鐮旂┒鐢熺鍚嶏細} \uline{\makebox[5em]{}} - {鏃ユ湡锛殅 \uline{\makebox[5em]{}} - \end{flushright} - \vfil - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_print_cover_ug:} -% 鏈灏侀潰 -% \begin{macrocode} -\cs_new_protected:Npn \@@_print_cover_ug: - { - \pdfbookmark{灏侀潰}{cover} % 灏嗗皝闈㈡彃鍏df涔︾ - \begin{spacing}{1.25} - \noindent\null\hspace{-10mm} - \njuemblem[black]{!}{3cm}\smallskip - \begin{center} - \njuname[black]{!}{3.35cm} - \vskip 10mm - {\zihao{1}\bf\songti\@@_spread_box:nn {9em}{鏈姣曚笟璁烘枃}} - \vfill - \vskip\stretch{0} - {\bgroup - \kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - % 缁樺埗淇℃伅妗� - \@@_print_covertab: - \egroup} - \vfill - \end{center} - \end{spacing} - } -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\@@_print_cover_g:} -% 鐮旂┒鐢熷皝闈� -% \begin{macrocode} -\cs_new_protected:Npn \@@_print_cover_g: -{ - \pdfbookmark{灏侀潰}{cover} % 灏嗗皝闈㈡彃鍏df涔︾ - \begin{spacing}{1.25} - \begin{center} - \noindent\null\vskip 5mm - \njuemblem[black]{!}{1.9cm} - \vskip 10mm - \njuname[black]{4.4cm}{!} - \par\vskip -2mm - \njuname*[black]{4.4cm}{!} - \vskip 15mm - \bgroup - \zihao{1}\bf\kaishu - \@@_spread_box:nn {10em}{鐮旂┒鐢熸瘯涓氳鏂噠 - \vskip 5mm - \@@_cover_degree: - \egroup - \par\vfill\vskip\stretch{0} - \bgroup - \bf\kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - \vskip 10mm - \@@_print_covertab: - \egroup - \vfill - \vskip 10mm - \bgroup - \bf\kaishu\zihao{4}\l_@@_submit_date_tl - \egroup - \vskip 15mm - \end{center} - \end{spacing} - - \newpage % 灏侀潰鑳岄潰 - \begin{spacing}{1.625} - \null\vfill - {\bgroup - \kaishu\zihao{3} - \makebox[6em][s]{\bf\kaishu 瀛hfill 鍙穧锛歕MakeUppercase{\l_@@_info_id_tl} - \par - \makebox[6em][s]{\bf\kaishu 璁烘枃绛旇京鏃ユ湡}锛歕l_@@_defend_date_tl - \par - \makebox[6em][s]{\bf\kaishu 鎸嘰hfill 瀵糪hfill 鏁橽hfill 甯坿锛歕hspace{50mm}锛堢瀛楋級 - \par - \egroup} - \vskip 15mm - \end{spacing} - -% 鐮旂┒鐢熻嫳鏂囧皝闈� - \newpage - \pdfbookmark{鑻辨枃灏侀潰}{cover-en} % 灏嗗皝闈㈡彃鍏df涔︾ - \begin{center} - \noindent\vspace*{20pt} - \bf\sffamily\zihao{2}\l_@@_info_title_en_tl - \vskip \stretch{1} - \normalfont\rmfamily\zihao{4}{by} - \vskip 3pt - \bf\sffamily\zihao{4}\l_@@_info_author_en_tl - \vskip\stretch{1} - \normalfont\rmfamily\zihao{4}{Supervised~by} - \vskip 3pt - \normalfont\sffamily\zihao{4} - \l_@@_info_supv_a_title_en_tl - \hspace{.5em}\l_@@_info_supv_a_en_tl\\ - \l_@@_info_supv_b_title_en_tl - \hspace{.5em}\l_@@_info_supv_b_en_tl - \vskip\stretch{1} - \normalsize\rmfamily{ - A~dissertation~submitted~to\\ - the~graduate~school~of~Nanjing~University\\ - in~partial~fulfilment~of~the~requirements~for~the~degree~of\\ - \textsc{ - \clist_item:Nn \c_@@_name_degree_en_clist { \g_@@_info_degree_int } - }\\ - in\\ - {\l_@@_major_en_tl} - } - \vskip\stretch{2} - \njuemblem[black]{2.5cm}{!}\par - \vskip 3mm - \normalfont\l_@@_info_dept_en_tl\\ - {Nanjing~University} - \vskip 30pt - \normalfont\normalsize\l_@@_submit_date_en_tl - \end{center} -} % \end{macrocode} % \end{macro} % @@ -2926,9 +2553,10 @@ through XeTeX. \RenewDocumentCommand \maketitle { } { \pagestyle{empty} - \bool_if:NTF \g_@@_nlcover_bool - { \@@_print_cover_nl: \@@_print_declaration: } - { \use:c { @@_print_cover_ \g_@@_info_diploma_tl : } } + \UseInstance { nju / cover } { cover-ug } + % \bool_if:NTF \g_@@_nlcover_bool + % { \@@_print_cover_nl: \@@_print_declaration: } + % { \use:c { @@_print_cover_ \g_@@_info_diploma_tl : } } % \end{macrocode} % 鍦ㄦ爣棰橀〉鍚庝娇鐢ㄥぇ鍐欑綏椹瓧姣嶉〉鐮併€� % \begin{macrocode}