\documentclass[10pt, twoside]{book}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%%%% Pacchetti
\usepackage{FileAusiliari/Layout} % Contiene i pacchetti e le impostazioni per il layout
\usepackage{FileAusiliari/Pacchetti} % Pacchetti aggiuntivi di vario tipo (senza tikz)
\usepackage{FileAusiliari/TikZ} % Ambiente tikzpicture
\usepackage{FileAusiliari/Definizioni} % Definizioni di colori, variabili globali ecc.
\usepackage{FileAusiliari/Environments} % Impostazioni TOC, bibliografia e indice analitico + environments vari per il contenuto del documento
\usepackage{FileAusiliari/Custom} % Tutto ciò che è personalizzabile normalmente dall'utente (tranne i colori per collegamenti ipertestuali, citazioni, link, che sono da modificare in Referencing)
\input{FileAusiliari/Referencing.tex} % Collegamenti ipertestuali e indice analitico
\usepackage{FileAusiliari/Comandi} % Comandi vari
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% TITOLO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{FileAusiliari/Titolo}
\input{FileAusiliari/Titolo2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% FRONTMATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\frontmatter
\pagestyle{fancyfront}
%%%%% INDICE
\begingroup
{
\let\cleardoublepage\relax
%%%%% Nome Indice (NASCOSTO E CREATO A PARTE)
\renewcommand\contentsname{}
\begin{tikzpicture}[remember picture, overlay]
\clip (-80,-95) rectangle (40,10);
\pgftext[x=.8\textwidth, y=0.2cm]{\HUGE\bfseries
Indice} % Titolo indice
\end{tikzpicture}
\vspace{-1cm}
\tableofcontents
\vspace{.25cm}
}
%%%%% INTRODUZIONE
\input{FileAusiliari/Introduzione}
\endgroup
%%%%% ERRATA
\iffalse
\titleformat{\chapter}
[hang]
{\huge}
{}
{0em}
{}
[\large {\begin{tikzpicture} [remember picture, overlay]
\pgftext[right,x=14.75cm,y=0.2cm]{\color{black}\Huge\bfseries
Errata corrige \& Aggiunte};
\end{tikzpicture}}]
\chapter*{}\normalfont \addcontentsline{toc}{part}{Errata corrige \& Aggiunte}
\begin{longtable}{p{2.55cm}p{1.45cm}p{9cm}}
Data di \newline correzione & Pagina&\\\hline
24/10/2023 & ? & ?
\end{longtable}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%% MAINMATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mainmatter
\pagestyle{fancymain}
\titleformat{\chapter}[display]{\bfseries\Large} {\filleft\MakeUppercase{\chaptertitlename} \HUGE\thechapter}{.5ex}{\titlerule\vspace{1ex}\filleft}[\vspace{3.5ex}]
\titlespacing*{\chapter}{0pt}{0.1\baselineskip}{0.5\baselineskip}
\fancyheadoffset[L]{\dimexpr\oddsidemargin-0in\relax}
\fancyheadoffset[R]{\dimexpr\oddsidemargin-0in\relax}
\normalfont
\normalsize
\newgeometry{top=35mm, bottom=35mm, left=15mm, right=15mm, headheight=0pt, headsep=0pt, marginparsep=0pt, marginparwidth=0pt, footskip=0pt, footnotesep=0pt}
\part*{\HUGE Parte 1}\label{Parte1}
\restoregeometry
%%%%% CAPITOLI
\input{Capitoli/Capitolo1}
\input{Capitoli/Capitolo2}
\input{Capitoli/Capitolo3}
%%%%% APPENDICI
\newgeometry{top=35mm, bottom=35mm, left=15mm, right=15mm, headheight=0pt, headsep=0pt, marginparsep=0pt, marginparwidth=0pt, footskip=0pt, footnotesep=0pt}
\part*{\HUGE Appendici}
\titleformat{\chapter}[display] {\bfseries\large\raggedright} {\vspace{-2.35cm} \MakeUppercase{\chaptertitlename}\ \Huge \thechapter} {.125ex} {\raggedleft\vspace{-1cm}\Huge\makebox[.5\textwidth]{}}
\titlespacing*{\chapter}{0pt}{6\baselineskip}{2.5\baselineskip}
\restoregeometry
% Capitoli
\titlecontents{chapter}[2.5pc]
{\addvspace{15pt}}
{\begin{tikzpicture}
\pgftext{\LArge\bfseries\bfseries\color{black}\hspace{-1cm} Appendice\ \thecontentslabel{\color{white}.}\hspace{.5cm} }
\end{tikzpicture}\Large }
{}
{\color{black}\titlerule\; \;\Large\bfseries Pagina \thecontentspage}
\pagestyle{fancyapp}
\begin{appendices}
\input{Appendici/AppendiceA}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% BACKMATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\backmatter
%%%%% BIBLIOGRAFIA
\pagestyle{fancyBibliografia}
\titleformat{\chapter}
[hang]
{\vspace{-2cm}\Huge}
{}
{0em}
{}
[\Large {\begin{tikzpicture} [remember picture, overlay]
\pgftext[right,x=14.75cm,y=0.2cm]{\HUGE\bfseries
Bibliografia}
\end{tikzpicture}}]
\nocite{*}
\bibliographystyle{amsalpha}
\bibliography{FileAusiliari/Bibliografia}
\addcontentsline{toc}{part}{Bibliografia}
\cleardoublepage
%INDICE ANALITICO
\pagestyle{fancyIndiceAnalitico}
\renewcommand{\indexname}{}
% SISTEMA IL PROBLEMA DEL LINK ALL'INDICE ANALITICO
\let\cleardoublepage\relax
\titleformat{\chapter}[hang]{}{}{0em}{}[]
\chapter*{}
\titleformat{\chapter}
[hang]
{\Huge}
{}
{0em}
{}
[\Large {\begin{tikzpicture} [remember picture, overlay]
\pgftext[right,x=14.75cm,y=0.2cm]{\HUGE\bfseries
Indice analitico}
\end{tikzpicture}}]
\titlespacing*{\chapter}{0pt}{0\baselineskip}{5\baselineskip}
\addcontentsline{toc}{part}{Indice analitico}
\vspace{-2cm}
\printindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{appendices}
\end{document}