用LaTeX写学校论文模板(四)目录的设置

您所在的位置:网站首页 latex加目录 用LaTeX写学校论文模板(四)目录的设置

用LaTeX写学校论文模板(四)目录的设置

2024-02-16 06:24| 来源: 网络整理| 查看: 265

目录的设置

这应该是我最想吐槽的部分了!! 学校那么多规矩!不仅字体要求设置,而且还吃藕,竟然还要英文目录,直接抬走了我!!

\RequirePackage[titles]{tocloft}

利用的tocloft宏包,里面诸多设置。 在这里插入图片描述 由于我是参考湖南师范大学的模板所以定义了一个phantom

\newcommand\SDAUspace{\phantom{永永}}

主要是为了空两格用!

\addtocontents{toc}{\protect\hypersetup{hidelinks}} %英语目录连接 \addtocontents{toe}{\protect\hypersetup{hidelinks}} %设置目录标题用 \newcommand\SDAUspace{\phantom{永永}} %要两个空格 \renewcommand\cftchapdotsep{0.5}%虚线间隔 \renewcommand{\cftdot}{$\cdot$} \renewcommand{\cftdotsep}{1.5} \renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}} \renewcommand{\cftchapdotsep}{\cftdotsep} \setlength{\cftbeforesecskip}{18pt}%章节间隔,节前18磅 \setlength{\cftbeforesubsecskip}{18pt}%章节间隔,小节节前18磅 \renewcommand\cftchapfont{\kaishu\zihao{-4}} \renewcommand\cftsecfont{\kaishu\zihao{-4}} \renewcommand\cftsubsecfont{\kaishu\zihao{-4}} %\renewcommand\cftchappagefont{\mdseries} \setlength\cftbeforetoctitleskip{18pt} % \setlength\cftaftertoctitleskip{18pt} \setlength{\cftsubsecindent}{0pt} %设置subsubsection不缩进 \setlength{\cftsecindent}{0pt} %设置section部分不缩进 \renewcommand{\cftchappagefont }{} %如何设置目录chap的page不加粗

目录在完成后自行回生成一个toc文件,然后toc将条目一个一个加进去,生成了pdf,此外目录需要有链接,需要link,宏包的话就是 \RequirePackage{hyperref} 不过需要隐藏链接,上面应该看的相关代码! 由于我们学校论文模板比较特殊,可以看到,章、节、小节都不需要缩进,所以需要

\setlength{\cftsubsecindent}{0pt} %设置subsubsection不缩进 \setlength{\cftsecindent}{0pt} %设置section部分不缩进

你大概可以理解成一个公式,\cft + {section;chapter等等} + 具体设置,具体就请参阅toc的宏包。里面很多详细设置。 就像这些在这里插入图片描述

加入特殊部分进入目录

对于需要特殊加入参考文献的部分,可以这样定义:

%致谢,附录,附件 \newcommand{\Thanks}{%将致谢添加到目录中 \cleardoublepage \addcontentsline{toc}{chapter}{\kaishu 致谢} \phantomsection \chapter*{致谢} \zihao{-4}\songti } \newcommand{\Appendix}{%将附录添加到目录中 \cleardoublepage %book类需要控制奇偶页 \addcontentsline{toc}{chapter}{\kaishu 附录} \phantomsection \renewcommand{\thechapter}{A}% \cleardoublepage \chapter*{附录} \zihao{-4}\songti }

这里面

\addcontentsline{toc}{chapter}{\kaishu 致谢}

这句话的作用就是放到目录页去,同理附录,由于是ctexbook,可能会导致超链接错误,可以参考这篇文章,可以参考 http://blog.sina.com.cn/s/blog_5e16f1770100lsl7.html 是小屋里面的内容。 同理参考文献也加进去 \addcontentsline{toc}{chapter}{参考文献}

英文目录

在这里插入图片描述 学校真的来了一刀,幸好网上有攻略!!

% !TEX encoding = UTF-8 %定义英文目录使用请勿删 \makeatletter \newcommand\engcontentsname{Contents} \newcommand\tableofengcontents{% \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi \chapter*{\engcontentsname \@mkboth{% \MakeUppercase\engcontentsname}{\MakeUppercase\engcontentsname}}% \@starttoc{toe}% !!!!Define a new contents!!!! \if@restonecol\twocolumn\fi } \newcommand\addengcontents[2]{% \addcontentsline{toe}{#1}{\protect\numberline{\csname the#1\endcsname}#2}} \makeatother \newcommand\echapter[1]{\addengcontents{chapter}{#1}} \newcommand\esection[1]{\addengcontents{section}{#1}} \newcommand\esubsection[1]{\addengcontents{subsection}{#1}}

我把这个写成了一个单独的tex文件放在总文件夹下的chapter里面。像这样 在这里插入图片描述 在这里插入图片描述 这是总文件中的架构,由于英语目录中有一个\makeatletter在cls运行不了(单独编译检查过)所以就只能这样先做好封面页之后再\include英文目录然后需要注意的是每次加入chapter的时候请自行带入echapter

\chapter{表格} \echapter{chart}

就像这样,才会将章节加入英文目录中,同理,section和subsection。 在这里插入图片描述 最后的效果吧!!



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3