如何添加附录标题

如何添加附录标题

我有一个问题。我想添加附录,但不幸的是我没有附录标题。它应该是这样的

我想要的是

Appendix A
Heading

在此处输入图片描述 然而,它看起来像这样

What I have
A. Heading

在此处输入图片描述

这是由于以下原因

但是,我希望附录的标题放在前面。我该如何解决这个问题?

\titleformat{\chapter}
  {\normalfont\LARGE\bfseries}{\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{-10pt}{40pt}

最有价值球员

\documentclass[a4paper,12pt]{report}
%\usepackage{tocbibind}
%\usepackage[toc,page]{appendix}
\usepackage[a4paper, left={2.5cm}, right={2cm}, top={3cm}, bottom={3cm}, headheight=15pt]{geometry}
\usepackage[ngerman]{babel}

\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{titlesec}

\setcounter{secnumdepth}{4}
\usepackage{verbatim}
\usepackage{float} 
\usepackage[nohyperlinks, printonlyused]{acronym}
\usepackage{graphicx}
\usepackage[driverfallback=hypertex]{hyperref} 
\titleformat{\chapter}
  {\normalfont\LARGE\bfseries}{\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{-10pt}{40pt}

\usepackage{tikz}
\usepackage{lmodern}


\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}} % for vertical centering text in X column
\usepackage{caption}
\captionsetup[table]{position=bottom}


\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyhead[L]{\nouppercase{\leftmark}}%
  \fancyfoot[R]{\thepage}}
\pagestyle{plain}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. #1}{}}
\usepackage[parfill]{parskip}

\newcommand{\secref}[1]{\ref{#1} \nameref{#1}}


\usepackage[toc,page]{appendix}

\usepackage{hyperref}
\usepackage[ngerman]{cleveref}


\usepackage[titles]{tocloft}
\usepackage{tocloft}
\setlength{\cftfigindent}{0pt}
\setlength{\cfttabindent}{0pt}


\begin{document}    
\tableofcontents

\chapter{Introduction}
  this is my introduction
  \subsection{Test}
\chapter{Finish}
\appendix
%\addcontentsline{toc}{chapter}{Appendix}
\chapter{Hyperparameter Tuning für XGBoost}

\subsection{Further Settings}
\chapter{Hyperpa}
\end{document}

答案1

尝试

\appendix   
\titleformat{\chapter}[display]
{\normalfont\LARGE\bfseries}{\chaptertitlename~\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{-10pt}{40pt}
\chapter{Hyperparameter Tuning für XGBoost}

\subsection{Further Settings}

A

相关内容