I'm using hyperref package to do cross-referencing, but I'm encountering some problems and it is related to \usepackage{titlesec,titleps} , for instance:
\documentclass[a4paper,12pt,twoside]{report}
\usepackage{hyperref}
\usepackage{titlesec,titleps} %If I remove the \titleclass for \part it works fine!
\titleclass{\part}{top}\titleformat{\part}{\centering\normalfont\Huge\bfseries}{}{0pt}{}
\titleformat{\section}{\normalfont\bfseries}{\thesection\hspace{3pt}$\vert$}{3pt}{}
\titleformat{\subsection}{\normalfont\slshape}{\thesubsection\hspace{3pt}$\vert$}{3pt}{}
\titleformat{\subsubsection}{\normalfont}{\thesubsubsection\hspace{3pt}$\vert$}{3pt}{}
\titleformat{\paragraph}{\normalfont\slshape}{\theparagraph\hspace{3pt}$\vert$}{3pt}{}{}
\titleformat{\subparagraph}{\normalfont}{\thesubparagraph\hspace{3pt}$\vert$}{3pt}{}{}
\begin{document}
\part{Part One}
\label{P1}
\chapter{Chapter One}
\label{C1}
\section{Section One}
\label{S1}
Here the cross-reference for \autoref{C1} "\nameref{C1}" and \autoref{S1} "\nameref{S1}" work fine, but not for \autoref{P1} "\nameref{P1}".
As also for \autoref{C2} "\nameref{C2}" and \autoref{S2} "\nameref{S2}", but not for \autoref{P2} "\nameref{P2}".\\
\part{Part Two}
\label{P2}
\chapter{Chapter Two}
\label{C2}
\section{Section Two}
\label{S2}
\end{document}
So if I cross-reference to \nameref{P2} from anywhere in "Part One" it gives the name of the "Section One" (the last before Part Two, if I remove that section it goes to the one before it), while the "Part II" from the \autoref{P2} is right. If I refer to \nameref{P1} in "Part One" it gives me the error "??".
Is there a way to know what is going on? Thanks for your help and attention!