![由于参考书目条目标签过长,导致目录中的页码错误](https://linux22.com/image/357311/%E7%94%B1%E4%BA%8E%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E6%9D%A1%E7%9B%AE%E6%A0%87%E7%AD%BE%E8%BF%87%E9%95%BF%EF%BC%8C%E5%AF%BC%E8%87%B4%E7%9B%AE%E5%BD%95%E4%B8%AD%E7%9A%84%E9%A1%B5%E7%A0%81%E9%94%99%E8%AF%AF%20.png)
我遇到一个奇怪的问题,从第二章开始的各章的页码都是错误的。在下面的例子中,章节Introduction
(第 1 章)的页码为2
,但Related Work
章节(第 2 章)的页码为4
而不是3
。后面的章节(不在示例中)的页码将 +1。我在 Windows 上工作,使用 TexWorks 0.6.1 (x64) 和软件包中附带的 MikTex 2.9 和 Biber。为了构建脚本,我执行了以下几行:
miktex-pdftex.exe -synctex=1 -undump=pdflatex main.tex biber.exe main miktex-pdftex.exe -synctex=1 -undump=pdflatex main.tex
我怀疑问题出在书目条目标签的长度。第一遍(在 biber 替换参考文献之前)生成的 PDF 中第 1 章在第 3 页结束。目前仍不清楚为什么第二遍不重建目录。这个问题还影响图表的页码。
非常感谢您的帮助。
最小脚本示例:
\documentclass[12pt,a4paper,oneside,openany,notitlepage]{book}
\usepackage[utf8]{inputenc}
%%% indent first paragraph in chapter
\usepackage{indentfirst}
%%% support setstrech command for line spacing
\usepackage{setspace}
%%% make numbering of figures continuous
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
%%% support theorem/definition/lemme proof
\usepackage{amsthm}
\theoremstyle{definition}
%%% control chapter title template: eliminate 'Chapter'
\usepackage{titlesec}
% keep showing 'Appendix' in chapter while eliminating 'Chapter' (https://tex.stackexchange.com/questions/247035/adding-chapter-prefix-for-appendix)
\makeatletter
\newcommand{\setappendix}{Appendix~\thechapter.~}
\newcommand{\setchapter}{\thechapter.~}
\titleformat{\chapter}{\normalfont\huge\bf}{%
\ifnum\pdfstrcmp{\@currenvir}{appendices}=0
\setappendix
\else
\setchapter
\fi}{20pt}{}
\makeatother
\titlespacing{\chapter}{0pt}{10pt}{30pt}
%%% define 'appendices' env
\usepackage[titletoc, title]{appendix}
%%% manage page number in footer
\usepackage{fancyhdr}
%%% support algorithms
\usepackage[boxed,noline,linesnumbered]{algorithm2e}
\SetKwComment{Comment}{$\triangleright$\ }{} % set style for algorithm comments
\SetAlCapSkip{1em} % set space between algorithm body and caption
%%% bibliography to support chicago style
\begin{filecontents}{references.bib}
@misc{VerylongBiblRef1,
title = {my life},
howpublished = {on stone},
month = Feb,
year = 2017
}\end{filecontents}
\usepackage[backend=biber, style=ieee]{biblatex}
\addbibresource{references.bib}
\begin{document}
\tableofcontents
{\setstretch{1.5}
\chapter{Introduction}
\label{ch:intro}
functionalities are implemented in many cloud products: commercial cloud services like Amazon AWS or Microsoft Azure \parencite{VerylongBiblRef1}, the Open Source cloud environments like OpenStack \parencite{VerylongBiblRef1} and also in more specialized cloud computation platforms like E-Learning \parencite{VerylongBiblRef1} or Docker \parencite{VerylongBiblRef1}.
The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf.
The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf.
The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf.
The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf.
The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf.
\chapter{Related Work}
\label{ch:related_work}
The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf. The quick onyx goblin jumps over the lazy dwarf.
\end{document}
PS 请注意,我需要脚本中出现的包来正确格式化文档。
答案1
答案确实是添加第三按照 Chris H 的建议此评论谢谢你,克里斯