加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

在latex中如何去除或设置目录\tableofcontents中的页眉问题

(2018-03-25 10:50:33)
标签:

latex

tableofcontents

页眉

章页眉

分类: Latex札记

问题描述:

在论文、报告排版中,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{}

 \renewcommand\headrulewidth{.4pt}

 \fancyhead[C]{\slshape \leftmark}

 \fancyfoot[C]{\thepage} }

 

\makeatletter %.cls文件中不需要makeatlettermakeatother

 \newcommand\frontpagestyle{\cleardoublepage\pagestyle{front}\let\ps@plain\ps@front}   \newcommand\mainpagestyle{\cleardoublepage\pagestyle{main}\let\ps@plain\ps@main}

 \makeatother


\usepackage{blindtext}

 

\begin{document}

 \frontpagestyle % switch to the pagestyle front

 \tableofcontents

 \listoffigures

 \listoftables

 \mainpagestyle % switch to the pagestyle main   \Blinddocument\Blinddocument\Blinddocument\Blinddocument\Blinddocument   \Blinddocument\Blinddocument\Blinddocument\Blinddocument\Blinddocument

 \end{document}

 

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

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有