# [Tex/LaTex] Page number on the left with book class

Using book class, is it possible (if I'm not wrong, not with tocloft) to put page numbers in the left side? It would be something as

  5       Introduction
19     I Title first chapter
54    II Title second chapter
107   III Title third chapter


I considered the following tread: Page number before Chapter title in the Table of Contents with memoir, which however is only for memoir class, and the following one: Formatting the title of the TOC, which however is a mixed question about index and particular format. I need "only" to produce the above format for a classical ToC.

=====================================================

Here a working code, but only for chapter, not for section:

\documentclass[a4paper]{book} \usepackage{fontspec}
\usepackage{polyglossia} \setmainlanguage{english}
\usepackage{titletoc} \contentsmargin{0pt}
\titlecontents{chapter}[4pc]
{\contentsmargin{0pt}\makebox[0pt][r]{\thecontentspage

\begin{document} \tableofcontents

\chapter{Some text some text some text some text some text }

\chapter{Some text some text some text some text some text }

\chapter{Some text some text some text some text some text }

\end{document}

=====================================================

Consider this code, whose realization I'm strongly interested in

\documentclass[a4paper]{report} \usepackage{fontspec}
\usepackage{polyglossia} \setmainlanguage{english}%{italian}
%\PolyglossiaSetup{italian}{indentfirst=false}

\usepackage{titlesec}
\renewcommand{\thechapter}{\scshape\roman{chapter}}
\titleformat{\chapter}[display]
{\normalfont\fontsize{10pt}{12pt}\selectfont}{\scshape\thechapter}{0pt}{}
%%{\normalfont\fontsize{10pt}{12pt}\selectfont}{\chaptertitlename\space
\thechapter}{11pt}{} \renewcommand{\thesection}{\arabic{section}}
\titleformat{\section}
{\normalfont\fontsize{10pt}{12pt}\selectfont}{\thesection}{0pt}{}
\titleformat{\subsection}
{\normalfont\fontsize{10pt}{12pt}\selectfont\itshape}{}{0pt}{}
\titlespacing{\chapter}{0pt}{0pt}{3cm}

\usepackage{titletoc} \contentsmargin{0pt}
\titlecontents{chapter}[4pc]
{\contentsmargin{0pt}\makebox[0pt][r]{\thecontentspage}

\usepackage{titletoc} \contentsmargin{0pt}
\titlecontents{section}[4pc]
{\contentsmargin{0pt}\makebox[0pt][r]{\thecontentspage}

\begin{document} \tableofcontents

\chapter{Some title 1} Some text some text some text some text some
text

%\section{Some text title a} %Some text some text some text some text
some text

\chapter{Some title 2} Some text some text some text some text some
text

\chapter{Some title 3} Some text some text some text some text some
text

\end{document}

There is a bad interference between titlesec and titletoc, but I'm not able to solve with a correct interaction between these two packages…

Here's a solution that uses the titletoc package; the important part of the code is

% chapter formatting in toc
\titlecontents{chapter}
[0.0cm]             % left margin
{}                  % above code
{%                  % numbered format
{\llap{\thecontentspage\hspace{.5cm}}\thecontentslabel~}%
}%
{}         % unnumbered format
{}         % filler-page-format, e.g dots


Here's a complete MWE to play with.

% arara: pdflatex
% arara: pdflatex
\documentclass{book}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{titletoc}

% chapter formatting in toc
\titlecontents{chapter}
[0.0cm]             % left margin
{}                  % above code
{%                  % numbered format
{\llap{\thecontentspage\hspace{.5cm}}\thecontentslabel~}%
}%
{}         % unnumbered format
{}         % filler-page-format, e.g dots

\begin{document}
\tableofcontents

\chapter{mychapter}
\section{mysection}
\subsection{mysubsection}
\section{mysection}
\subsection{mysubsection}
\subsection{mysubsection}
\subsection{mysubsection}
\subsection{mysubsection}
\subsection{mysubsection}
\chapter{mychapter}
\section{mysection}
\subsection{mysubsection}
\section{mysection}
\subsection{mysubsection}
\subsection{mysubsection}
\subsection{mysubsection}
\subsection{mysubsection}
\subsection{mysubsection}
\chapter{mychapter}
\end{document}