The following code is adapted from here The idea is to create a book with two parts (containing problems and solutions) which have equal (numbered) chapter and (unnumbered) section headings. In order to keep the toc small, the page numbers for both parts should appear side-by-side in the toc (due to the very similar structure in both parts). Furthermore, the sections (although not numbered) should appear in the toc and the page heads. Here are the problems left based on the MWE below:

• The page number for solution sections don't appear in the toc (only '??' appear)
• The page numbers of chapters and sections don't seem to be (vertically) aligned correctly, especially in the case where some solutions are on a page >= 100 (3-digits). This certainly comes from the \hspace between the page numbers of problems and their solutions in \titlecontents below. (It seems that a table-like toc would be the way to go to ensure right-alignment of the page numbers, but I didn't manage to get this to work).

How can these two issues be fixed?

\documentclass{scrbook}

\usepackage{lipsum}
\usepackage{scrlayer-scrpage}
\usepackage{titletoc}
\usepackage{hyperref}

% TOC
% {section}, [left], {above}, {before with label (left side)}, {before wo label
% (left side)}, {filler and page}, [after]
{\hfill\contentspage\hspace{5.4em}\pageref{\thecontentslabel}\hspace*{-1.4em}}

\begin{document}
\pdfbookmark[0]{\contentsname}{toc}
\tableofcontents% without number; add bookmark on level 0
\chapter{Chapter A problems}\label{chap:1}
\lipsum[1-100]
\lipsum[101-200]

\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}% remove toc entries after this line
\chapter{Chapter A solutions}\label{2}
\lipsum[201-300]

• Why using titletoc with a KOMA class? – Gonzalo Medina Oct 2 '15 at 0:02
• Because of the \titlecontents commands (?) – Marius Hofert Oct 2 '15 at 4:15
• Well, of course. My comment was meant to indicate that titletoc might not be fully compatible with KOMA classes (titlesec is not). With KOMA classes, I think, one should use tocstyle (from the same author of the classes). – Gonzalo Medina Oct 2 '15 at 14:10