I tried to produce a ToC like this:
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
So I added the listof
's, glossaries
and bibliography
to the ToC with success.
But now the ToC links went out of sync. Also the links in the listof
's do not match any longer.
Heres a mwe (without bibliography)
\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}
I compile the PDF this way:
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
What went wrong here? (I tried even to put \cleardoublepage\phantomsection
almost everywhere in different positions so far)
EDIT #1:
I stripped the guts out to a minimal mwe, where the back links in the glossaries are still wrong:
\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}
EDIT #2:
I'd like to share my compilation-batch file (I couldn't find a good one in the 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
\cleardoublepage\phantomsection
before\printglossary
? Thetoc
package option does\phantomsection
automatically at the start of each glossary (and\cleardoublepage
is automatically inserted regardless of thetoc
option for book-like classes).