Anonymous 1123
I use this file to prepare a document.
```
\documentclass[12pt,a4paper,twoside,openany]{book}
\usepackage[left=2cm,right=1.5 cm,top=2cm,bottom=2cm]{geometry}
\usepackage{lipsum}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage[titletoc,toc,title]{appendix}
\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\itshape\nouppercase{\rightmark}}
\fancyhead[RE]{\itshape\nouppercase{\leftmark}}
\renewcommand{\chaptermark}[1]%
{\markboth{{\it \chaptername\,\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\it \thesection.\ #1}}
\lhead[\fancyplain{}{\thepage}]%
{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\leftmark}]%
{\fancyplain{}{\thepage}}
\cfoot{}
\sloppy
\apptocmd{\appendix}
{\addtocontents{toc}{%
\protect\addtolength\protect\cftchapnumwidth{-\mylength}%
\protect\renewcommand{\protect\cftchappresnum}{Appendix~}%
\protect\settowidth\mylength{\bfseries\protect\cftchappresnum\protect\cftchapaftersnum}%
\protect\addtolength\protect\cftchapnumwidth{\mylength}}%
}{}{}
\newlength\mylength
\renewcommand{\cftchapaftersnum}{.}
\renewcommand\cftchappresnum{Chapter~}
\settowidth\mylength{\bfseries\cftchappresnum\cftchapaftersnum}
\addtolength\cftchapnumwidth{\mylength}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
,unicode,bookmarksnumbered
}
\begin{document}
\chapter{Chapter one}
\lipsum[1-5]
\chapter{Chapter two}
\lipsum[5-10]
\appendix
\chapter{Appendix}
\section{One section}
\lipsum[11-30]
\end{document}
```
In header of chaper Appendix, I want to rename `Chapter A` to `Appendix A`. How can I prepare?

Top Answer
Anonymous 1123
I solve my problem by put `\renewcommand\chaptername{Appendix}`
after `\appendix` like this
```
\appendix
\renewcommand\chaptername{Appendix}
```
Fule code
```
\documentclass[12pt,a4paper,twoside,openany]{book}
\usepackage[left=2cm,right=1.5 cm,top=2cm,bottom=2cm]{geometry}
\usepackage{lipsum}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage[titletoc,toc,title]{appendix}
\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\itshape\nouppercase{\rightmark}}
\fancyhead[RE]{\itshape\nouppercase{\leftmark}}
\renewcommand{\chaptermark}[1]%
{\markboth{{\it \chaptername\,\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\it \thesection.\ #1}}
\lhead[\fancyplain{}{\thepage}]%
{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\leftmark}]%
{\fancyplain{}{\thepage}}
\cfoot{}
\sloppy
\apptocmd{\appendix}
{\addtocontents{toc}{%
\protect\addtolength\protect\cftchapnumwidth{-\mylength}%
\protect\renewcommand{\protect\cftchappresnum}{Appendix~}%
\protect\settowidth\mylength{\bfseries\protect\cftchappresnum\protect\cftchapaftersnum}%
\protect\addtolength\protect\cftchapnumwidth{\mylength}}%
}{}{}
\newlength\mylength
\renewcommand{\cftchapaftersnum}{.}
\renewcommand\cftchappresnum{Chapter~}
\settowidth\mylength{\bfseries\cftchappresnum\cftchapaftersnum}
\addtolength\cftchapnumwidth{\mylength}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
,unicode,bookmarksnumbered
}
\begin{document}
\chapter{Chapter one}
\lipsum[1-5]
\chapter{Chapter two}
\lipsum[5-10]
\appendix
\renewcommand\chaptername{Appendix}
\chapter{Appendix}
\section{One section}
\lipsum[11-30]
\end{document}
```
