![如何更改本地 titletoc](https://linux22.com/image/477334/%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%E6%9C%AC%E5%9C%B0%20titletoc.png)
请考虑此代码
\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}
尽管我的代码有问题,但无论如何我都希望在参考书目目录中显示页码。有没有办法改变本地那个声音的设置是什么?谢谢!
=======================================================================
附录 几乎完美。我不明白为什么,但我发现
参考书目的页码有点太靠右了... 在我的情况下,我必须设置
{\llap{\makebox[\dimexpr30pt +1.75em\relax][l]{\thecontentspage}}}
,但只能通过反复试验...
答案1
此解决方案与参考书目的页码无关......
记得使用
\printbibliography[heading=bibintoc]
代替
\chapter*{\bibname} \addcontentsline{toc}{chapter}{\bibname}
将您的参考书目打印出来并放在目录中。
\chapter
以与其他分段命令相同的方式定义 numberless-entry-format :\titlecontents{chapter}[4pc] {\addvspace{1pc}} {\makebox[0pt][r]{\makebox[30pt][r]{\textsc{\romannumeral\thecontentslabel\quad}}}} {\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{}}} {}
梅威瑟:
\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}
输出:
一些评论:
如果你设置
\contentsmargin{0pt}
一次之后就不想改变,就不需要再重复。
您正在使用第二个强制参数,
\titlecontents
因为它是第三个......换句话说,你应该写
\titlecontents{section}[4pc] {} {\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}} {} {}
代替
\titlecontents{section}[4pc] {\contentsmargin {0 pt}\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][r]{\textsc{\thecontentslabel.\quad}}}} {} {} {}
答案2
您可以定义无数章节的格式:
\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
\结束{文档}