# Putting full paragraph path in page header

I have a document of a deep structure, in sense Part, Chapter....Paragraph which are all used, I want to make full paragraph path to be displayed in the header of each page, something like:

I managed to do that in MS Word some time ago, but how can that be done in LaTeX ? and please note that it may need more than one line to display it fully.

-

Here's a solution using the titleps package and its extramarks option:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage[extramarks]{titleps}
\usepackage{lipsum}

\setcounter{secnumdepth}{4}

\settitlemarks*{chapter,section,subsection,subsubsection,paragraph}
\newpagestyle{main}[\small\sffamily]{
\parbox{\textwidth}{%
\thechapter~\chaptertitle\space%
\ifnum\value{section}>0 \guillemotright\ \else\fi%
\thesection~\sectiontitle\space%
\ifnum\value{subsection}>0 \guillemotright\ \else\fi%
\thesubsection~\subsectiontitle\space%
\ifnum\value{subsubsection}>0 \guillemotright\ \else\fi%
\thesubsubsection~\subsubsectiontitle\space
\ifnum\value{paragraph}>0 \guillemotright\ \else\fi%
\theparagraph~\paragraphtitle%
}
}{}{}}
\pagestyle{main}
\makeatletter
\let\ps@plain\ps@main
\makeatother

\newcommand\subsectionbreak{\clearpage}

\begin{document}

\chapter{Test Chapter One}
\section{Test Section One One}
\lipsum[1-5]
\subsection{Test Subsection One One One}
\lipsum[1-5]
\subsection{Test Subsection One One Two}
\lipsum[1-5]
\subsubsection{Test Subsection One One Two One}
\lipsum[1-5]
\paragraph{Test Paragraph One One Two One One}
\lipsum[1-5]

\end{document}


Some images taken from some of the pages to see the headers:

and

As a personal note, I don't think it's a good idea to use such longer headers.

-
Thx, basically it worked, but not in my document unfortunately, because it will not display the header at beginning of the new chapter page, and I'm using "\renewcommand\subsection{\newpage\stdsubsection}" to force new page for each subsection (the nature of my reference I'm writing requires that and such headers), can we fix that? – TMS Sep 20 '12 at 13:28
@TMS please see my updated answer. I \let the plain style to be main, so first pages of chapters will also show the headers; I used a redefinition of \subsectionbreak (from the titlesec package) to allow each subsection to start on a new page. – Gonzalo Medina Sep 20 '12 at 13:56