2009-12-02 4288 views
8

我想用下面的命令如何在LaTeX中將目錄的標題居中?

\usepackage{tocloft} 
\renewcommand{\contentsname}{\centering Table of Contents} 

居中的目錄稱號膠乳作爲我問我敢肯定你們都意識到這沒有工作,任何我可以嘗試什麼建議?

編輯:我得到了它與

\renewcommand{\cfttoctitlefont}{\hfill\Huge} 

回答

9

這個工程工作(不usepackage):

\renewcommand{\contentsname}{\centering Contents} 

確保它在序言中,也許,並嘗試殺死.aux文件。

+0

它在documentclass和'report'中工作,但在'book'中產生錯誤。 – MattAllegro 2015-07-03 17:36:22

3

這工作在\documentclass{book},而不需要usepackage:

\renewcommand*\contentsname{\hfill Contents \hfill} 
\tableofcontents 

如果\ renewcommand緊接在\ tableofcontents命令之前,它應該甚至不工作。