我遇到一个奇怪的问题,从第二章开始的各章的页码都是错误的。在下面的例子中,章节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 的建议此评论谢谢你,克里斯