Biblatex – Aligning Bibliography and Unnumbered Chapters in Table of Contents

biblatextable of contentstitletocvertical alignment

I have the following MWE in which I have a bibliography (using biblatex) and an ununmbered chapter that I want to have them aligned, in the table of contents, not with the chapter numbers, but with the chapter titles.

I have already customized the alignment of the chapters, sections, subsections and subsubsections using the \dottedcontents command from titletoc, but have no idea how to make them work for the bibliography title and the unnumbered chapter. I tried using \dottedcontents{numberless-entry-format}[4pc]{}{4pc}{0.3pc} but with no luck.

The MWE:

\documentclass[a4paper, 12pt]{book}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}

\begin{filecontents}{mwe.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\usepackage[style=abnt, justify, extrayear]{biblatex}
\addbibresource{mwe.bib}

\usepackage[a4paper, top=3cm, bottom=2cm, left=3cm, right=2cm]{geometry}

\usepackage{titletoc}
\dottedcontents{chapter}[4pc]{}{4pc}{0.3pc}
\dottedcontents{section}[4pc]{}{4pc}{0.3pc}
\dottedcontents{subsection}[4pc]{}{4pc}{0.3pc}
\dottedcontents{subsubsection}[4pc]{}{4pc}{0.3pc}
\dottedcontents{numberless-entry-format}[4pc]{}{4pc}{0.3pc}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\title{MWE}
\author{Me}
\date{November 2021}

\begin{document}

\maketitle
\tableofcontents

\chapter{Introduction}

Just to cite the bibliography \cite{A01}.

\section{1st section}

\chapter{2nd chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}

\chapter*{No numbers!}
\addcontentsline{toc}{chapter}{No numbers!}


\printbibliography[
    heading=bibintoc, 
    title={My Bibliography}
    ]

\end{document}

The TOC in question:
TOC without alignment

The idea is to have the "No…" and "My…" aligned with "Sub…", which is 4pc.

I'll gladly appreaciate any help, since I've been googling this all day long and I'm starting to open the same links as I did earlier today.

Best Answer

enter image description here

Inspired by the answer of Ulrike Fischer, you need to place the following in your preamble

\titlecontents{chapter}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{section}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{subsection}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{subsubsection}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{numberless-entry-format}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}

MWE

\documentclass[a4paper, 12pt]{book}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}

\begin{filecontents}{mwe.bib}
    @misc{A01,
        author = {Author, A.},
        year = {2001},
        title = {Alpha},
    }
\end{filecontents}

\usepackage[style=abnt, justify, extrayear]{biblatex}
\addbibresource{mwe.bib}

\usepackage[a4paper, top=3cm, bottom=2cm, left=3cm, right=2cm]{geometry}

\usepackage{titletoc}
\titlecontents{chapter}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{section}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{subsection}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{subsubsection}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{numberless-entry-format}[4pc]{}{\contentslabel{4pc}}{}{\titlerule*[0.3pc]{.}\contentspage}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\title{MWE}
\author{Me}
\date{November 2021}

\begin{document}
    
    \maketitle
    \tableofcontents
    
    \chapter{Introduction}
    
    Just to cite the bibliography \cite{A01}.
    
    \section{1st section}
    
    \chapter{2nd chapter}
    \section{Section}
    \subsection{Subsection}
    \subsubsection{Subsubsection}
    
    \chapter*{No numbers!}
    \addcontentsline{toc}{chapter}{No numbers!}
    
    
    \printbibliography[
    heading=bibintoc, 
    title={My Bibliography}
    ]
    
\end{document}