參考書目標題左對齊

參考書目標題左對齊

我有以下程式碼,由於參考書目/參考文獻的標題是居中對齊,如果\titleformat{\chapter}[display]被刪除,那麼它是左對齊的,但所有章節標題也是左對齊的,我希望章節標題與書目標題居中對齊,左對齊。

\documentclass[12pt,a4paper]{report}
\usepackage{graphicx, subfigure}
\usepackage{amsmath}
%\renewcommand\bibname{References}
\usepackage{fancyhdr}
\makeatletter
\let\ps@plain\ps@fancy
\makeatother
\usepackage{titlesec}
\titleformat{\chapter}[display]
    {\normalfont\LARGE\bfseries\centering}{\chaptertitlename\ \thechapter}{5pt}{\LARGE}
\titlespacing*{\chapter}{0pt}{-30pt}{10pt}
\titleformat{\section}
    {\normalfont\normalsize\bfseries}{\thesection}{5pt}{\normalsize}
\titlespacing*{\section}{0pt}{2pt}{2pt}
\titleformat{\subsection}
    {\normalfont\normalsize\bfseries}{\thesubsection}{5pt}{\normalsize}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}
\titleformat{\subsubsection}
    {\normalfont\normalsize\bfseries}{\thesubsubsection}{5pt}{\normalsize}
\titlespacing*{\subsubsection}{0pt}{0pt}{0pt}
\begin{document}
\include{chapter1}
\include{chapter2 }
\nocite{*}
\bibliographystyle{ieeetr}
\bibliography{xyz}
\addcontentsline{toc}{chapter}{References}
\end{document} 

答案1

你可以直接重複指令前\chapter省略must的定義,即:\centering\bibliography

...
\titleformat{\chapter}[display]
    {\normalfont\LARGE\bfseries}{\chaptertitlename\ \thechapter}{5pt}{\LARGE}
\bibliographystyle{ieeetr}
\bibliography{xyz}

順便說一下, \addcontentsline{toc}{chapter}{References}如果參考書目長於一頁,在參考書目之後添加會產生錯誤的結果。最好使用tocbibind包在目錄中插入參考書目/參考文獻

相關內容