我有以下代码,由于该代码,参考书目/参考文献的标题是居中对齐,如果\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
将参考书目/参考文献插入目录中