又到一年畢業季,廣大准畢業生都忙着撰寫學位論文,有用Word寫的,也有用$\LaTeX$排版的。相對來說,我更喜歡用$\LaTeX$排版,因為它對整個論文各個方面提供更精准的控制和更優美的排版效果。當然,$\LaTeX$排版系統不像“所見即所得”的Word,要從零開始完全自己排版整個論文還需要花點時間和不熟悉的命令、機制等做斗爭,好在網上也有很多資料和網友分享的學位論文模板可以利用參考。前幾年,中科院對學位論文的格式似乎並沒有很具體的要求,實驗室學生也一直使用吳凌雲開發的中科院學位論文模板CASthesis,一屆傳一屆,相安無事。今年,中科院整理發布了“中國科學院大學研究生學位論文撰寫規范指導意見”,其中對學位論文的各個方面都做了細致的規定。原來的CASthesis已經不好再用了,一是該模板和最新的規定不一致了,二是隨着CTeX宏集的不斷更新,在其基礎上編寫的CASthesis模板也已經過時了。
事實上,得益於同樣是吳凌雲等人開發的CTeX宏集,撰寫符合要求的學位論文並不難,直接用CTeX宏集中提供的ctexbook文檔類已經能排版出一篇優美的論文。為了撰寫符合“中國科學院大學研究生學位論文撰寫規范指導意見”要求的學位論文,只需要微調不多的一些配置即可,下面簡述一些簡單的修改。
一、整體結構

\documentclass[UTF8,zihao=-4,a4paper,linespread=1.5,AutoFakeBold=0.6]{ctexbook} % 主要字號、行間距等 \usepackage{calc} \usepackage[top=1in,bottom=1in,inner=1.5in,outer=1.25in,head=1in-1.5cm-\headsep]{geometry} % 頁面設置 %%%%%%%%%%%%%%%%%%%%% % 這里包括使用的宏包和命令配置等 \setCJKmainfont{SimSun} % 論文主要中文字體 \setmainfont{Times New Roman} % 主要英文字體 %%%%%%%%%%%%%%%%%%%%% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 封面部分 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pagestyle{empty} % 中文封面 \maketitle \cleardoublepage % 英文封面 \makeenglishtitle \cleardoublepage % 學位論文獨創性聲明和版權使用授權說明 \pagestyle{empty} \include{statement} \cleardoublepage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 前言部分 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \frontmatter % 摘要 \include{chapters/abstract} % 目錄 \tableofcontents % 表格目錄 % \listoftables % 插圖目錄 % \listoffigures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 正文部分 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \mainmatter \include{chapters/chap1} \include{chapters/chap2} \include{chapters/chap3} % 附錄 % \appendix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 附件部分 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \backmatter % 參考文獻 % 使用 BibTeX % \bibliographystyle{plain} % \bibliography{bib/ref} % \nocite{*} % 發表文章目錄 % \include{chapters/pub} % 個人簡歷 \include{chapters/resume} % 致謝 % \include{chapters/thanks} \end{document}
二、頁眉、頁腳設置
除了一些沒有頁眉頁腳的頁面,整個論文主要包括兩種頁眉頁腳:從摘要頁到目錄頁部分一種,正文部分一種,下面分別配置:

% 從摘要頁到目錄頁頁眉頁腳配置 \usepackage{fancyhdr} \fancypagestyle{frontmatter}{%定義新的頁面樣式 \fancyhf{}% \fancyhead[CO]{\zihao{-5} \nouppercase{\leftmark}}% \fancyhead[CE]{\zihao{-5} \Title}% \fancyfoot[C]{\zihao{-5} \thepage}% \renewcommand{\headrulewidth}{0.4pt}% \renewcommand{\footrulewidth}{0pt}% } \newcommand{\abstract}[1]{\chaptermark{#1}\chapter*{#1}} % 目錄只顯示正文部分,因此中英文摘要不編號,而\chapter*不會設置\chaptermark標記,所以要手動設置 \setlength{\headheight}{11pt} % fixes \headheight warning

% 放置於正文部分前 \pagestyle{fancy} \fancyhf{} \fancyhead[CO]{\zihao{-5} \leftmark} \fancyhead[CE]{\zihao{-5} \Title} \fancyfoot[RO,LE]{\zihao{-5} \thepage}
有幾個問題:
1. 摘要頁部分頁碼要求使用大寫羅馬數字,通過在摘要頁前放如下代碼修改:
\pagestyle{frontmatter} % 使用新定義的樣式 \pagenumbering{Roman} % 頁碼使用大寫羅馬數字
2. $\LaTeX$默認book文檔類中每章的第一頁比較特殊,使用plain頁面樣式,即\chapter命令內部隱含\thispagestyle{plain}。論文要求是和其他頁一樣,ctexbook提供了配置接口:
\ctexset{chapter/pagestyle=fancy}
或者也可以通過修改默認的plain樣式\fancypagestyle{plain}{...}來達到目的。
三、封面設置

\newcommand{\TEXTunderline}[2][299pt]{\uline{\makebox[#1]{\hfill#2\hfill}}} \renewcommand\ULthickness{1pt} % thickness of uline in ulem.sty % 中文封面 \renewcommand\maketitle{% \thispagestyle{empty} \begin{center} \vskip \stretch{2} \includegraphics[width=0.8\textwidth]{figures/ucas_logo.png} \vskip \stretch{1} {\bfseries\heiti\zihao{1}博士/碩士學位論文} \vskip \stretch{1.5} {\bfseries\heiti\zihao{-3}\TEXTunderline{論文題目}} \vskip \stretch{1.5} \zihao{4} \def\arraystretch{1.5} \begin{tabular}{>{\bfseries}l>{\bfseries}l} 作者姓名: & \TEXTunderline{作者} \\ 指導教師: & \TEXTunderline{導師} \\ & \TEXTunderline{單位} \\ 學位類別: & \TEXTunderline{學位} \\ 學科專業: & \TEXTunderline{專業} \\ 培養單位: & \TEXTunderline{培養單位} \end{tabular} \vskip \stretch{2} {\bfseries \today} \end{center} }

% 英文封面 \newcommand\makeenglishtitle{% \thispagestyle{empty} \begin{center} \bfseries \vspace*{20pt} \zihao{-3} \TEXTunderline[299pt]{Research on xxxxx} \vskip \stretch{2} \zihao{4} A dissertation submitted to \\ University of Chinese Academy of Sciences \\ in partial fulfillment of the requirement \\ for the degree of \\ Doctor/Master of Philosophy \\[6ex] By \\ Author Name \\ Supervisor: Professor XXX \vskip \stretch{2} Institute of xxxxxx \\ Chinese Academy of Sciences \vskip 3pt June 2018 \end{center} }
四、目錄設置

\usepackage{tocloft} \tocloftpagestyle{frontmatter} \setlength{\cftbeforetoctitleskip}{24pt} \setlength{\cftaftertoctitleskip}{18pt} \renewcommand{\cfttoctitlefont}{\hfill\heiti\zihao{4}\bfseries} \renewcommand{\cftaftertoctitle}{\hfill} % 使“目錄”居中 %目錄章標題格式 \renewcommand{\cftchapfont}{\heiti\zihao{4}} \setlength{\cftchapindent}{0pt} \setlength{\cftbeforechapskip}{6pt} \renewcommand{\cftchapdotsep}{\cftsecdotsep} \renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftchapdotsep}} \renewcommand\cftchapafterpnum{\vskip0pt} %目錄節標題格式 \renewcommand{\cftsecfont}{\heiti\zihao{-4}} \setlength{\cftsecindent}{\ccwd} \setlength{\cftbeforesecskip}{6pt} \renewcommand\cftsecafterpnum{\vskip0pt} \renewcommand{\cftsubsecfont}{\heiti\zihao{-4}} \setlength{\cftsubsecindent}{2\ccwd} \setlength{\cftbeforesubsecskip}{6pt} \renewcommand\cftsubsecafterpnum{\vskip0pt}
五、正文配置
ctexbook提供了豐富的配置選項來配置標題、段落格式等,具體參考說明文件ctex.pdf,配置如下:

\ctexset{ chapter={ format+=\heiti\zihao{4}\bfseries, beforeskip=24pt, afterskip=18pt, numbering=true, number=\arabic{chapter}, pagestyle=fancy,%標題所在頁頁面風格 }, section={ format=\heiti\zihao{-4}\raggedright, beforeskip=24pt, afterskip=6pt, }, subsection={ format=\heiti\zihao{-4}\raggedright, beforeskip=12pt, afterskip=6pt, }, contentsname={目\hspace{\ccwd}錄}, } \setlength{\parskip}{0pt}
六、圖/表中英文題注配置

\usepackage{ccaption} % for bicaption \usepackage[font=small]{caption} % 圖的題注在圖下面,使用\bicaption % 表的題注在表上面,新定義的命令\topbicaption,調整間距 \newcommand{\topbicaption}{%標題在表格上面使用 \midbicaption{% \addtolength{\belowcaptionskip}{-0.5\baselineskip}%中英文標題間距 \setlength{\abovecaptionskip}{0.5\baselineskip}}%標題和表格間距 \bicaption}

% 插入圖片示例 \begin{figure}[htb] \centering \includegraphics[width=0.6\textwidth]{figures/ucas_logo.png} \bicaption[fig1]{中文題注簡寫,可不寫}{中文題注}{Figure}{英文題注} \end{figure} % 插入表格示例,推薦使用三線表格 \begin{table}[htb] \setlength{\tabcolsep}{5pt} \topbicaption[tb1]{中文題注簡寫}% {中文題注}% {Table}{英文題注} \centering% \begin{tabular}{cc} \toprule% xxxxx & xxxxx \\\otoprule xxxx & xxxx \\ xxxx & xxxx \\ \bottomrule \end{tabular} \end{table}
以上這些組合起來,差不多能排版一篇精美的、符合格式要求的學位論文。
最后祝大家畢業順利!