我嘗試製作這樣的目錄:
I Symbol Glossary
II Acronyms
1. Chapter 1
1.1 Section 1
2. Chapter 2...
...
III List of Figures
IV List of Tables
V Bibliography
所以我成功地將listof
's,glossaries
和加入bibliography
目錄。但現在目錄連結不同步了。此外, 中的連結listof
不再符合。 Heres a mwe(沒有參考書目)
\RequirePackage[l2tabu,orthodox]{nag}
\documentclass
[
pdftex ,
a4paper ,
oneside ,
12pt ,
halfparskip ,
headsepline ,
footsepline ,
listof=totocnumbered ,
bibliography=totocnumbered ,
numbers=noenddot ,
]{scrbook}
\usepackage[]{amsmath,amssymb}
\usepackage[]{graphicx}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[]{color}
\usepackage
[
a4paper ,
top=3.6cm ,
bottom=3.6cm ,
left=3.6cm ,
right=3.6cm ,
]{geometry}
\usepackage[]{microtype}
\usepackage{setspace}
\usepackage[]{ftnxtra}
\usepackage{hyperref}
\usepackage
[
nomain ,
toc ,
indexonlyfirst ,
numberedsection ,
]{glossaries}
\usepackage
[
block=par ,
backend=biber ,
safeinputenc ,
backref ,
]{biblatex}
\onehalfspacing
\KOMAoptions{draft=on}
\setlength\parindent{0pt}
\definecolor{blue}{rgb}{ 0.0 , 0.0 , 1.0 }
\hypersetup
{
colorlinks = true ,
linkcolor = blue ,
citecolor = blue ,
filecolor = blue ,
menucolor = blue ,
urlcolor = blue ,
bookmarksnumbered = true ,
}
\newglossary[sym.glg]{sym}{sym.gls}{sym.glo}{Symbolverzeichnis}
\newglossary[acr.glg]{acr}{acr.gls}{acr.glo}{Abkürzungsverzeichnis}
\makeglossaries
\newglossaryentry{bla2}
{
text = {bla2} ,
name = {bla2} ,
plural = {bla2} ,
description = {bla2bla2bla2bla2bla2} ,
type = {acr} ,
sort = {bla2} ,
}
\newglossaryentry{bla1}
{
text = {bla1} ,
name = {bla1} ,
plural = {bla1} ,
description = {bla1bla1bla1bla1bla1} ,
type = {sym} ,
sort = {bla1} ,
}
% \addbibresource{eli_bib.bib}
\title{\textbf{Title}}
\begin{document}
\pagenumbering{arabic}
\maketitle
\thispagestyle{empty}
\renewcommand{\contentsname}{Inhaltsverzeichnis}
\renewcommand\thechapter{\Roman{chapter}}
\cleardoublepage\phantomsection
\tableofcontents
\cleardoublepage\phantomsection
\printglossary[type=acr,title=Abkürzungsverzeichnis]
\cleardoublepage\phantomsection
\printglossary[type=sym,title=Symbolverzeichnis]
\renewcommand\thechapter{\arabic{chapter}}
\setcounter{chapter}{0}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\gls{bla1} blablabla \gls{bla2}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\chapter{test}\section{test}
\renewcommand\thechapter{\Roman{chapter}}
\setcounter{chapter}{3}
\cleardoublepage\phantomsection
\listoftables
\cleardoublepage\phantomsection
\listoffigures
\cleardoublepage\phantomsection
\printbibliography[title=Literaturverzeichnis]
\end{document}
我這樣編譯PDF:
pdflatex -interaction=batchmode -draftmode %doc%.tex
makeindex -s %doc%.ist -t %doc%.sym.glg -o %doc%.sym.gls %doc%.sym.glo
makeindex -s %doc%.ist -t %doc%.acr.glg -o %doc%.acr.gls %doc%.acr.glo
biber %doc%
pdflatex -interaction=batchmode -draftmode %doc%.tex
pdflatex -interaction=batchmode -synctex=1 %doc%.tex
這裡出了什麼問題? (\cleardoublepage\phantomsection
到目前為止,我甚至嘗試將幾乎所有地方放在不同的位置)
編輯#1:
我把內容剝離到最小限度,詞彙表中的反向連結仍然是錯誤的:
\documentclass[oneside]{scrbook}
\usepackage[ngerman]{babel}
\usepackage{color,hyperref}
\usepackage[nomain]{glossaries}
\newglossary[sym.glg]{sym}{sym.gls}{sym.glo}{Symbolverzeichnis}
\newglossary[acr.glg]{acr}{acr.gls}{acr.glo}{Abkürzungsverzeichnis}
\makeglossaries
\newglossaryentry{bla2}{name={bla2},description={bla2bla2bla2bla2bla2},type={acr}}
\newglossaryentry{bla1}{name={bla1},description={bla1bla1bla1bla1bla1},type={sym}}
\begin{document}
\printglossary[type=acr]\printglossary[type=sym]
\chapter{test}\section{test}\chapter{test}\section{test}
\gls{bla1} blablabla \gls{bla2}
\chapter{test}\section{test}\chapter{test}\section{test}
\end{document}
編輯#2:
我想分享我的編譯批次檔(我在 www 中找不到好的文件):
:: sumatrapdf.exe is in miktex/miktex/bin
:: biber.exe in miktex/miktex/bin
:: sumatrapdf: einstellungen > optionen : 'pfad/zu/sublime_text.exe %f:%l:100000' eintragen
:: call this batch file like: 'tex.bat myTexFile' (myTexFile without any extension)
@echo off
setlocal
set document=%~n1
set miktexpath=C:/bin/programme/miktex/miktex/bin
set path=%path%;%miktexpath%;
call :deletetemporaries
call :compile
goto final
:compile
echo ! Begin Compilation
call :buildtex
if errorlevel 1 (
call :syntaxerror
) else (
call :buildglossaries
call :buildbib
call :buildtex
call :buildglossaries
call :buildpdf
call :showpdf
call :deletetemporaries
)
:deletetemporaries
echo ! Delete temporaries
del /s *glg >nul 2>&1
del /s *gls >nul 2>&1
del /s *glo >nul 2>&1
del /s *blg >nul 2>&1
del /s *bbl >nul 2>&1
del /s *toc >nul 2>&1
del /s *out >nul 2>&1
del /s *log >nul 2>&1
del /s *lot >nul 2>&1
del /s *lof >nul 2>&1
del /s *ist >nul 2>&1
del /s *bcf >nul 2>&1
del /s *aux >nul 2>&1
del /s *run.xml >nul 2>&1
goto end
:buildglossaries
makeindex -s %document%.ist -t %document%.sym.glg -o %document%.sym.gls %document%.sym.glo 2>nul
makeindex -s %document%.ist -t %document%.acr.glg -o %document%.acr.gls %document%.acr.glo 2>nul
makeindex -s %document%.ist -t %document%.idx.glg -o %document%.idx.gls %document%.idx.glo 2>nul
goto end
:buildpdf
pdflatex -interaction=batchmode -synctex=1 %document%.tex 1>nul
echo.
goto end
:buildtex
pdflatex -interaction=batchmode -draftmode %document%.tex 1>nul
goto end
:buildbib
biber %document% 2>nul
goto end
:syntaxerror
pdflatex -draftmode %document%.tex
echo ! Compilation failed
goto end
:showpdf
SumatraPDF -reuse-instance %document%.pdf 1>nul
goto end
:final
echo ! Compile done
echo.
exit
:end
goto:eof
答案1
術語表和其他清單的插入會導致頁碼發生變化,因此您需要執行以下操作:
pdflatex
makeglossaries
pdflatex
makeglossaries
pdflatex
讓它們保持最新狀態。
第一個makeglossaries
產生術語表,但使用第一次 LaTeX 運行中的頁碼,因此您需要另一個 LaTeX 運行來更新頁碼,然後重新運行makeglossaries
以更新反向引用並重新運行 LaTeX 來更新文件。
答案2
您會收到類似以下內容的訊息
pdfTeX warning (ext4): destination with the same identifier (name{chapter.4
}) has been already used, duplicate ignored
這不應該被忽視。它們是由具有相同編號的章節引起的。
您可以透過添加來解決它
\renewcommand\theHchapter{\thechapter}
做完之後\renewcommand{\thechapter}{\Roman{chapter}}
。透過這種方式,hyperref
章節將使用唯一的內部識別碼並同步返回。