我只想更改目录中标题“目录”的颜色。我\tableof contents
在文档中使用简单命令
这是主页代码
\documentclass[titlepage]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{images/}
\usepackage[english]{babel}
\usepackage[nottoc]{tocbibind}
\usepackage[export]{adjustbox}
\usepackage[document]{ragged2e}
\usepackage{geometry}
\geometry{margin=0.9in}
\usepackage[dvipsnames]{xcolor}
\usepackage{hyperref}
\usepackage{breakcites}
\bibliographystyle{apalike}
\begin{document}
\include{chapters/Cover/Coverpage}
\tableofcontents
\include{chapters/0-Abstract/Abstract}
\include{chapters/1-Introduction/general}
\include{chapters/2-GamificationDesignPrinciples/general}
\include{chapters/3-MOOC+SRL/MOOC+SRL}
\include{chapters/4-ProjectDesc/project_desc}
\bibliographystyle{unsrt}
\bibliography{bibliography/references}
\end{document
答案1
如果只更改目录的标题(不更改其他部分),请在序言中输入以下内容:
\let\oldcontentsname\contentsname
\renewcommand{\contentsname}{\color{red}\oldcontentsname}
答案2
我不知道内容就像章节名称。我想更改文档中所有子章节和章节的颜色,然后我看到了这篇文章:https://stackoverflow.com/questions/3275770/modifying-section-to-make-it-colorful-with-latex
令我惊喜的是,它也改变了内容的颜色。
代码非常简单,如下所示:
\usepackage{titlesec}
\titleformat{\section}
{\color{Blue}\normalfont\Large\bfseries}
{\color{Blue}\thesection}{1em}{}