add tag
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?
![ScreenHunter 1153.png](/image?hash=fde4594002b527f1114e0abef083548ff89a4045803df33572849c2bee9b3339)
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}
```
![ScreenHunter 1154.png](/image?hash=2510bd0eb1d31594fb04ad13d4e2976199c784c540dffa333b02f8b24915f0c5)

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.