新浪博客

[转载]在latex中如何去除或设置目录\tableofcontents中的页眉问

2020-08-12 17:22阅读:

问题描述:
在论文、报告排版中,Latex设置为封面页是无页眉(页脚)的,目录、表目录、图目录、正文的页眉一样,章节页的第一页通常也是没有页眉的。在遇到要求目录、表目录、图目录同封面都为无页眉要求时,我在百度上检索通常的解决方案都是pagestyle{plain}thispagestyle{plain}命令。但本人发现这并不能很好的解决这个问题。
问题解决方案:
(1) 添加章节第一页的页眉。
使用:
pagestyle{fancy}
fancypagestyle{plain}{ ...... }
(2) 去掉目录中的页眉,而不影响其他正文章的页眉。以下命令完全不同于pagestyle{plain}thispagestyle{plain}命令。
documentclass{report} %book类似
usepackage{fancyhdr}

fancypagestyle{front}{ % style for TOC, LOF, LOT (设置目录、表目录、图目录)
fancyhf{}
renewcommand{headrulewidth}{0pt}
cfoot{thepage} } %可根据自己要
求修改

fancypagestyle{main}{ % style for the mainmatter(设置正文目录)
fancyhf{}
renewcommandheadrulewidth{.4pt}
fancyhead[C]{slshape leftmark}
fancyfoot[C]{thepage} }

makeatletter %.cls文件中不需要makeatlettermakeatother
newcommandfrontpagestyle{cleardoublepagepagestyle{front}letps@plainps@front} newcommandmainpagestyle{cleardoublepagepagestyle{main}letps@plainps@main}
makeatother
usepackage{blindtext}

begin{document}
frontpagestyle % switch to the pagestyle front
tableofcontents
listoffigures
listoftables
mainpagestyle % switch to the pagestyle main BlinddocumentBlinddocumentBlinddocumentBlinddocumentBlinddocument BlinddocumentBlinddocumentBlinddocumentBlinddocumentBlinddocument
end{document}

解决方案参考资料:https://tex.stackexchange.com/questions/177101/how-to-remove-header-and-footer-in-table-of-contents-and-lof-and-lot

我的更多文章

下载客户端阅读体验更佳

APP专享