[Tex/LaTex] Remove space before appendix chapter

appendicesbook-design

I would like to remove the 50pts of vertical space before the chapter when it is an appendix (leaving the default space for normal chapters). Here is a mwe

% !Mode:: "TeX:UTF-8"
\documentclass[a4paper,12pt,oneside]{book} 

\usepackage{fontspec}                    
\usepackage{polyglossia}             
\usepackage{titlesec}                       
\usepackage{appendix}  

\begin{document}

\chapter{Normal chapter}
\chapter{Normal chapter}

\appendix

\chapter{Appendix chapter}
\chapter{Appendix chapter}

\end{document}

I tried to comment the space in the book class declaration by adding this in the preamble

%remove vspace before chapter
\makeatletter
\def\@makechapterhead#1{%
  %\vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother 

but doing so will remove the space for all chapters. Is it possible to add an if-else condition to the code to remove the space only if it is an appendix?

Best Answer

A solution with the apptools and titlesec packages:

% !Mode:: "TeX:UTF-8"
\documentclass[a4paper,12pt,oneside]{book}

\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{titlesec}
\usepackage{appendix, apptools}
\AtAppendix{%
\titleformat{\chapter}[display]{\vspace*{-50pt}\bfseries\huge}{\chaptername~\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{0pt}{0pt}}%

\begin{document}

\chapter{Normal chapter}
\chapter{Normal chapter}
\appendix
\chapter{Appendix chapter}
\chapter{Appendix chapter}

\end{document} 

enter image description here enter image description here