2

Please, consider this code

\begin{filecontents*}{\jobname.bib}
@book{ hoyningen:1993,
  author         = "Hoyningen-Huene, Paul",
  title          = "Recontructing Scientific Revolutions",
  publisher      = "The University of Chicago Press",
  location       = "Chicago",
  year           = "1993",
}
\end{filecontents*}

\documentclass[a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{titlesec}
\usepackage[dotinlabels]{titletoc}
\contentsmargin{0pt}
\titlecontents{chapter}[4pc]{\addvspace{1pc}}
{\contentsmargin {0 pt}\makebox[0pt][r]{\quad\makebox[30pt][r]{\textsc{\romannumeral
\thecontentslabel\quad}}}}
{}
{}
{}

\contentsmargin{0pt}
\titlecontents{section}[4pc]
{\contentsmargin {0 pt}\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
{}
{}
{}

\contentsmargin{0pt}
\titlecontents{subsection}[4pc]
{\contentsmargin {0 pt}\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
{}
{}
{}

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

\usepackage[style=philosophy-verbose,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}

\tableofcontents

\chapter{Chapter One}
\section{Section one}
\section{Section two}

\chapter{Chapter Two}
\section{Section one}
\section{Section two}
\section{Section three}

\chapter{Chapter Three}
\section{Section one}
\section{Section two}

\chapter*{\bibname}
\addcontentsline{toc}{chapter}{\bibname}

\end{document}

In spite of my code, I'd like to have in any case the page number in the Table of contents for Bibliography. Is there a way to change locally the setting for that voice? Thanx!

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

ADDENDUM Almost perfect. I don't understand why, but I obtain enter image description here where the page number of Bibliography is a little too on the right... In my case I've to set {\llap{\makebox[\dimexpr30pt +1.75em\relax][l]{\thecontentspage}}}, but only by trials and errors...

3

This solution works independently of the page number of the bibliography...

  1. Remember to use

    \printbibliography[heading=bibintoc]
    

    instead of

    \chapter*{\bibname}
    \addcontentsline{toc}{chapter}{\bibname}
    

    to have your bibliography printed and in the ToC.

  2. Define the numberless-entry-format for \chapter in the same way you've defined it for the other sectioning commands:

    \titlecontents{chapter}[4pc]
    {\addvspace{1pc}}
    {\makebox[0pt][r]{\makebox[30pt][r]{\textsc{\romannumeral\thecontentslabel\quad}}}}
    {\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{}}}
    {}
    

MWE:

\begin{filecontents*}{\jobname.bib}
@book{ hoyningen:1993,
  author         = "Hoyningen-Huene, Paul",
  title          = "Recontructing Scientific Revolutions",
  publisher      = "The University of Chicago Press",
  location       = "Chicago",
  year           = "1993",
}
\end{filecontents*}

\documentclass[a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{titlesec}
\usepackage[dotinlabels]{titletoc}


\contentsmargin{0pt}

\titlecontents{chapter}[4pc]
{\addvspace{1pc}}
{\makebox[0pt][r]{\makebox[30pt][r]{\textsc{\romannumeral\thecontentslabel\quad}}}}
{\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{}}}
{}

\titlecontents{section}[4pc]
{}
{\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
{}
{}

\titlecontents{subsection}[4pc]
{}
{\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
{}
{}

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

\usepackage[style=philosophy-verbose,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}

\tableofcontents

\chapter{Chapter One}
\section{Section one}

\chapter{Chapter Two}
\section{Section one}

\chapter{Chapter Three}
\section{Section one}

\chapter{Chapter Four}
\section{Section one}

\chapter{Chapter Five}
\section{Section one}

\chapter{Chapter Six}
\section{Section one}

\chapter{Chapter Seven}
\section{Section one}

\chapter{Chapter Eight}
\section{Section one}

\chapter{Chapter Nine}
\section{Section one}

\printbibliography[heading=bibintoc]

\end{document}

Output:

enter image description here

Some remarks:

  1. If you set

    \contentsmargin{0pt}
    

    once and don't want to change it, you don't need to repeat it.

  2. You are using the second mandatory argument of \titlecontents as it was the third...

    In other words, you should write

    \titlecontents{section}[4pc]
    {}
    {\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
    {}
    {}
    

    instead of

    \titlecontents{section}[4pc]
    {\contentsmargin {0 pt}\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
    {}
    {}
    {}
    
  • Thanx for your solution, which works very fine and for the improvements of my code. regarding 1), in my original text I've \setcounter{secnumdepth}{-1} \chapter*{\bibname} \addcontentsline{toc}{chapter}{\bibname} \markboth{\scshape bibliografia}{\scshape bibliografia} \printbibliography[heading=testi,category=testi] \printbibliography[heading=generalia,category=generalia] \printbibliography[heading=antichita,category=antichita] and so on, I don't know if there is a better code here too – user41063 Dec 27 '14 at 19:13
  • @user41063 Glad it helped. About your specific setting, open a new question with a well constructed MWE. Me or someone more skilled than me will surely help you. :-) – karlkoeller Dec 27 '14 at 22:15
  • thanx both, you and Bernard – user41063 Dec 28 '14 at 22:50
3

You can define the formatting for numberless chapters:

\begin{filecontents*}{\jobname.bib}
@book{ hoyningen:1993,
  author = "Hoyningen-Huene, Paul",
  title = "Recontructing Scientific Revolutions",
  publisher = "The University of Chicago Press",
  location = "Chicago",
  year = "1993",
}
\end{filecontents*}

\documentclass[a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{titlesec}
\usepackage[dotinlabels]{titletoc}
\contentsmargin{0pt}
\titlecontents{chapter}[4pc]{\addvspace{1pc}}
{\makebox[0pt][r]{\quad\makebox[30pt][r]{\textsc{\romannumeral
\thecontentslabel\quad}}}}
{\llap{\makebox[\dimexpr30pt +1.5em\relax][l]{\thecontentspage}}}
{}


\titlecontents{section}[4pc]
{\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
{}
{}
{}

\titlecontents{subsection}[4pc]
{\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}}
{}
{}
{}

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

\usepackage[style=philosophy-verbose,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}

\tableofcontents

\chapter{Chapter One}
\section{Section one}
\section{Section two}

\chapter{Chapter Two}
\section{Section one}
\section{Section two}
\section{Section three}

\chapter{Chapter Three}
\section{Section one}
\section{Section two}

\clearpage
\addcontentsline{toc}{chapter}{\bibname}
\printbibliography

enter image description here \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.