目录和详细目录无重复和缩进

目录和详细目录无重复和缩进

这个问题分为两部分。

第1部分

首先,我想创建两个目录,第一个较短的目录中有引用,第二个目录中有较长且更详细的引用。第二个目录中没有引用。在详细目录中引用“详细目录”似乎很奇怪(如我的示例所示,见下文)

第2部分

其次,我怎样才能使“详细目录”和“参考文献”的引用像其他(编号部分)一样缩进?我希望“详细”中的“D”位于“第一”中的“F”上方,“参考文献”也是如此。

我在下面制作了这个相当复杂的例子(+代码)。

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

 \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}

答案1

使用\numberline{};但是,链接也会覆盖空白部分。同样,定义一个新的 bibheading 样式。我不确定这是否真的好。\phantomsection无论如何,别忘了 。

\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}

在此处输入图片描述

为了删除“详细目录”行,您可以执行以下操作:

  1. \newif\ifdetailed在 之前添加\begin{document}

  2. \addtocontents将`\tableofcontents 之前的块更改为

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

在此处输入图片描述

相关内容