3

This question has two parts.

Part 1

First, I'm interested to create two TOCs, with a reference in the first shorter TOC the longer and more detailed TOC. Without the reference appearing in the second one. It seems strange to make a reference to 'Detailed Table of Contents' in the Detailed Table of Contents (as illustrated in my example, see below)

Part 2

Second, how can I make the reference to 'Detailed Table of Contents' and to 'References' indent like the other (numbered sections)? I would like the D in Detailed to be above the F in First, and the same with References.

I have made this rather elaborate example below (+ code).

enter image description here enter image description here enter image description here

 \documentclass[11pt, a5paper]{article}

\begin{filecontents*}{\jobname.bib}
@book{Veblen1899,
    author = {Veblen, Thorstein},
    Isbn = {978-81-87879-29-9},
    publisher = {Aakar Books},
    title = {The Theory of the Leisure Class},
    subtitle = {An Economic Study of Institutions},
    Year = {[1899] 2005}}

\end{filecontents*}

\usepackage[english]{babel}

\usepackage[backend=bibtex,
style=authoryear, %
natbib=true,]{biblatex}

\usepackage{filecontents}

\addbibresource{\jobname.bib}

\DefineBibliographyStrings{english}{%
  bibliography = {References},
}

\usepackage{hyperref}
            \hypersetup{
          pdfborderstyle={/S/U/W 1}, % thanks, http://tex.stackexchange.com/a/26085/22939
         }

% This package allows you to create another table of contents, with a different depth.
\usepackage{shorttoc}

% change the title of ToC
\addto\captionsenglish{% Replace "english" with the language you use
  \renewcommand{\contentsname}%
    {Detailed Table of Contents}%
}

\begin{document}
\pagenumbering{roman}
\setcounter{secnumdepth}{1}


% short TOC from the shorttoc package{}
\clearpage
\vspace*{\fill}
\shorttoc{Contents}{2}


\newpage
\clearpage
\vspace*{\fill}
\addcontentsline{toc}{section}{Detailed Table of Contents} 
\tableofcontents


\newpage
\pagenumbering{arabic}
\section{First section}
\subsection{First subsection in First section}
\subsection{Second subsection in First section}
\subsubsection{First subsubsection in First section}
\section{Second section}
\subsubsection{First subsubsection in Second section}
\subsubsection{Second subsubsection in Second section}
\subsubsection{Third subsubsection in Second section}
\section{Third section}
\subsection{First subsection in Third section}
\subsubsection{First subsubsection in Third section}
However \citet{Veblen1899} demonstrates that
\printbibliography[heading=bibintoc] % thansk http://tex.stackexchange.com/a/67155/22939
\end{document}
  • Can you reinstate the question to the original form? Now also the second part should be answered. – egreg May 5 '14 at 8:57
  • @egreg, I'm confused. You answered the second part. Why restore the question? – Eric Fail May 5 '14 at 9:19
  • Because the question is not really clear with the striked out part. – egreg May 5 '14 at 9:22
  • @egreg, I have done it this way before, and seen others do it, and it worked out great. It offers people an opportunity to see that the questing is evolving and, at the same time, show what parts remain. I have made a small clarification at the top. Do you think that helps make it clearer that the questing is partially answered? – Eric Fail May 5 '14 at 9:34
4

Use \numberline{}; however, the link will cover also the blank part. Similarly, define a new bibheading style. I'm not sure this is really nice. Don't forget \phantomsection, anyway.

\begin{filecontents*}{\jobname.bib}
@book{Veblen1899,
    author = {Veblen, Thorstein},
    Isbn = {978-81-87879-29-9},
    publisher = {Aakar Books},
    title = {The Theory of the Leisure Class},
    subtitle = {An Economic Study of Institutions},
    Year = {[1899] 2005}}
\end{filecontents*}

\documentclass[11pt, a5paper]{article}

\usepackage[english]{babel}

\usepackage[
  backend=bibtex,
  style=authoryear,
  natbib=true,
]{biblatex}

% This package allows you to create another table of contents, with a different depth.
\usepackage{shorttoc}

\usepackage{hyperref}
\hypersetup{
  pdfborderstyle={/S/U/W 1}, % thanks, http://tex.stackexchange.com/a/26085/22939
}

\addbibresource{\jobname.bib}

\DefineBibliographyStrings{english}{%
  bibliography = {References},
}

\defbibheading{bibintocindent}[\refname]{%
  \section*{#1}%
  \addcontentsline{toc}{section}{\protect\numberline{}#1}%
  \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}

% change the title of ToC
\addto\captionsenglish{% Replace "english" with the language you use
  \renewcommand{\contentsname}{Detailed Table of Contents}%
}

\begin{document}
\pagenumbering{roman}
\setcounter{secnumdepth}{1}


% short TOC from the shorttoc package{}
\vspace*{\fill}
\shorttoc{Contents}{2}


\clearpage
\vspace*{\fill}
\phantomsection
\addcontentsline{toc}{section}{\protect\numberline{}Detailed Table of Contents} 
\tableofcontents


\clearpage
\pagenumbering{arabic}
\section{First section}
\subsection{First subsection in First section}
\subsection{Second subsection in First section}
\subsubsection{First subsubsection in First section}
\section{Second section}
\subsubsection{First subsubsection in Second section}
\subsubsection{Second subsubsection in Second section}
\subsubsection{Third subsubsection in Second section}
\section{Third section}
\subsection{First subsection in Third section}
\subsubsection{First subsubsection in Third section}
However \citet{Veblen1899} demonstrates that

\printbibliography[heading=bibintocindent]

\end{document}

enter image description here

In order to remove the “Detailed Table of Contents” line, you can do as follows:

  1. add \newif\ifdetailed before \begin{document};

  2. change the \addtocontents block before `\tableofcontents into

    \phantomsection
    \addtocontents{toc}{\protect\ifdetailed\protect\else}
    \addcontentsline{toc}{section}{\protect\numberline{}Detailed Table of Contents}
    \addtocontents{toc}{\protect\fi}
    \detailedtrue
    \tableofcontents
    

enter image description here

  • Thank you for responding to my question. You solved the second part of the question, thanks. However, the line 'Detailed Table of Contents' still appear in both TOCs. Hopefully someone can expand on the answer. Again, thanks. – Eric Fail May 5 '14 at 7:47
  • Beautiful! Thanks so much for your solution. It's very very helpful! – Eric Fail May 5 '14 at 9:43

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.