我正在尝试使用以下命令将目录的标题集中在LaTeX中
\usepackage{tocloft}
\renewcommand{\contentsname}{\centering Table of Contents}
因为我问我确定你们都意识到这不起作用,对我能尝试什么的任何建议?
编辑:我使用了
\renewcommand{\cfttoctitlefont}{\hfill\Huge}
答案 0 :(得分:14)
这有效(没有usepackage):
\renewcommand{\contentsname}{\centering Contents}
确保它可能在序言中,并尝试删除.aux
文件。
答案 1 :(得分:4)
这适用于\documentclass{book}
,无需usepackage:
\renewcommand*\contentsname{\hfill Contents \hfill}
\tableofcontents
如果\ renewcommand紧跟在\ tableofcontents命令之前,它甚至可以工作。
答案 2 :(得分:0)
更新contentsname可能会因为\ begin {document}重写babel中的组件而失败,因此必须将命令添加到\ captionsenglish。 This post详细介绍。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<a data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">Column1</a>
<div class="collapse" id="collapseExample">
<div class="well">
Your Text Here
</div>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>