编辑

编辑

我正在写一篇文章,我想在文章开头只显示章节标题。问题出在附录上,因为现在我想显示“附录 A”。

我的主文本

\documentclass[a4paper, 12pt, titlepage]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\huge}{\thechapter.}{20pt}{\bfseries\huge}
\usepackage[utf8]{inputenc}
\usepackage[title]{appendix} %appendices

\begin{document}

\maketitle
\tableofcontents
\input{ch1/chapter1}
\bibliography{mybib}
\bibliographystyle{plain}

\begin{appendices}
\input{app1/appendix1}
\end{appendices}

\end{document}

的开始第一章.tex

\chapter{Introduction}
I have some text in this chapter just like this.
It has survived not only 
five centuries, but also the leap into electronic typesetting, remaining 
essentially unchanged.

部分文件附录1.tex是:

\chapter{Attached files to the project}
This is a description of the files and images that you will find in the several folders in the DVD.

我的章节标题是这样的:

  1. 介绍

附录为:

A. 项目附加文件

但我想看到附录标题:

附录 A 项目附加文件

我知道它与命令“\titleformat”有关,但我该如何修复它以显示附录 A + 附录标题

答案1

为了使代码能够编译,我们需要\maketitle从示例中删除参考书目并整合问题中提供的代码片段。

完成后,我们可以在环境中重新定义章节样式appendices,将其包含\appendixname在标题前面的章节标签中。

例如:

\documentclass[a4paper, 12pt, titlepage]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\huge}{\thechapter.}{20pt}{\bfseries\huge}
\usepackage[utf8]{inputenc}
\usepackage[title]{appendix} %appendices

\begin{document}
\tableofcontents

\chapter{Introduction}
I have some text in this chapter just like this.
It has survived not only
five centuries, but also the leap into electronic typesetting, remaining
essentially unchanged.

\begin{appendices}
  \titleformat{\chapter}{\normalfont\huge}{\appendixname{} \thechapter.}{20pt}{\bfseries\huge}
  \chapter{Attached files to the project}
  This is a description of the files and images that you will find in the several folders in the DVD.
\end{appendices}

\end{document}

章节和附录

我知道这就是你想要的,尽管我不完全确定。

编辑

要将附录标题放在新行上,您可以display在环境中重新定义格式时添加回默认形状appendices

\titleformat{\chapter}[display]{\normalfont\huge}{\appendixname{} \thechapter.}{20pt}{\bfseries\huge}

+显示

相关内容