3

This has probably been asked before, but how can I make hyperref play nicely on articles (using the KOMA scrartcl class) that have Parts but no Chapters? It complains with:

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 90.

The bookmarks get messed up, with the next section becoming "promoted" to one level up. Interestingly enough, this doesn't occur using the stock article class.

% vim: ft=tex tw=0

% arara: lualatex: { synctex: true, shell: true }
% arara: lualatex: { synctex: true, shell: true }

\documentclass{scrartcl}
\usepackage{scrlayer-scrpage}

\usepackage[math]{blindtext}

\title{A minimum working example}

\usepackage{hyperref}
\hypersetup{
  pdfauthor={Robbie Smith},
  pdftitle={A minimum working example},
  pdfcreator={An infinite number of gremlins hitting random keys on typewriters...},
  pdfpagemode=UseOutlines,
  colorlinks=false,
  hypertexnames=false,
  hidelinks}
\usepackage[all]{hypcap}

\begin{document}

\maketitle

\tableofcontents
\clearpage

\part{Design and Testing}

\section{Objective}

\blindtext

\section{Summary}
\label{sec:summary}

\blindtext

\section{Geometric design}
\label{sec:geometry}

\blindtext

\subsection{Final geometic design}
\label{ssec:geo:final}

The final geometric design is provided in the table below. Formulae references
are to the calculations in the above sections.

\blindtext

\section{Fabrication}
\label{sec:fabrication}

\blindtext

\section{Testing}
\label{sec:testing}

\blindtext

\section{Proposed improvements}
\label{sec:improvements}

\blindtext

\section{Conclusions}
\label{sec:conclusions}

\blindtext

\appendix
\setcounter{table}{0}
\setcounter{figure}{0}
\renewcommand*{\thetable}{\thesection.\arabic{table}}
\renewcommand*{\thefigure}{\thesection.\arabic{figure}}

\part{Preliminary Designs}
\label{part:preliminary-designs}

The preliminary designs were developed prior to building and testing.

\section{First Iteration}

\blindtext

\subsection{Something something}

\blindtext

\section{Second Iteration}

\blindtext

\section{Third Iteration}

\blindtext

\end{document}

The log for compiling with lualatex via latexmk is included below:

$ latexmk mwe.tex
Latexmk: This is Latexmk, John Collins, 17 Jan. 2018, version: 4.55.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
   pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'lualatex --synctex=1 --shell-escape  -recorder  "mwe.tex"'
------------
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
 system commands enabled.
(./mwe.tex
LaTeX2e <2018-04-01> patch level 3
(using write cache: /opt/texlive/2018/texmf-var/luatex-cache/generic)(using rea
d cache: /opt/texlive/2018/texmf-var/luatex-cache/generic /home/faraday/.config
/texlive/2018/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.104 seconds
Babel <3.20> and hyphenation patterns for 1 language(s) loaded.
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2018/03/30 v3.25 KOMA-Script document class (article)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrbase.sty
(/opt/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlfile.sty)))
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrsize11pt.clo(load luc: /
opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc
)) (/opt/texlive/2018/texmf-dist/tex/latex/koma-script/typearea.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlayer-scrpage.sty
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlayer.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/blindtext/blindtext.sty
(/opt/texlive/2018/texmf-dist/tex/latex/tools/xspace.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/opt/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/opt/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/opt/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/opt/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/hypcap.sty) (./mwe.aux)
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))(load lu
c: /opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl/lmsans10-regular.
luc)(load luc: /opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl/lmsan
s10-bold.luc)(load luc: /opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/
otl/lmroman12-regular.luc)

LaTeX Warning: No \author given.

(load luc: /opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl/lmromansl
ant10-regular.luc) [1{/opt/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdfte
x.map}]
part I.

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 33.

[2] [3]
part II.

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 86.


Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 90.

[4] [5] (./mwe.aux)

Package rerunfilecheck Warning: File `mwe.out' has changed.
(rerunfilecheck)                Rerun to get outlines right
(rerunfilecheck)                or use package `bookmark'.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

)
 380 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 50 glue_spec, 3 attribute_lis
t, 1 write nodes
   avail lists: 2:260,3:85,4:5,5:181,6:37,7:3890,8:37,9:154,10:4,11:314
</opt/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf></
opt/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf></op
t/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmsans10-bold.otf>
Output written on mwe.pdf (5 pages, 21070 bytes).
SyncTeX written on mwe.synctex.gz.
Transcript written on mwe.log.
=== TeX engine is 'LuaTeX'
Latexmk: References changed.
Latexmk: References changed.
Latexmk: Log file says output to 'mwe.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'mwe.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'lualatex --synctex=1 --shell-escape  -recorder  "mwe.tex"'
------------
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
 system commands enabled.
(./mwe.tex
LaTeX2e <2018-04-01> patch level 3
(using write cache: /opt/texlive/2018/texmf-var/luatex-cache/generic)(using rea
d cache: /opt/texlive/2018/texmf-var/luatex-cache/generic /home/faraday/.config
/texlive/2018/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.103 seconds
Babel <3.20> and hyphenation patterns for 1 language(s) loaded.
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2018/03/30 v3.25 KOMA-Script document class (article)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrbase.sty
(/opt/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlfile.sty)))
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrsize11pt.clo(load luc: /
opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc
)) (/opt/texlive/2018/texmf-dist/tex/latex/koma-script/typearea.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlayer-scrpage.sty
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlayer.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/blindtext/blindtext.sty
(/opt/texlive/2018/texmf-dist/tex/latex/tools/xspace.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/opt/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/opt/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/opt/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/opt/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/hypcap.sty) (./mwe.aux)
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./mwe.out) (./mwe.out)(load luc: /opt/texlive/2018/texmf-var/luatex-cache/gene
ric/fonts/otl/lmsans10-regular.luc)(load luc: /opt/texlive/2018/texmf-var/luate
x-cache/generic/fonts/otl/lmsans10-bold.luc)(load luc: /opt/texlive/2018/texmf-
var/luatex-cache/generic/fonts/otl/lmroman12-regular.luc)

LaTeX Warning: No \author given.

(./mwe.toc)(load luc: /opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/ot
l/lmromanslant10-regular.luc) [1{/opt/texlive/2018/texmf-var/fonts/map/pdftex/u
pdmap/pdftex.map}]
part I.

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 33.

[2] [3]
part II.

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 86.


Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 90.

[4] [5] (./mwe.aux))
 400 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 54 glue_spec, 3 attribute_lis
t, 1 write nodes
   avail lists: 2:563,3:140,4:5,5:181,6:58,7:3894,8:49,9:203,10:4,11:314
</opt/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf></
opt/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf></op
t/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmsans10-bold.otf>
Output written on mwe.pdf (5 pages, 23032 bytes).
SyncTeX written on mwe.synctex.gz.
Transcript written on mwe.log.
=== TeX engine is 'LuaTeX'
Latexmk: Log file says output to 'mwe.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'mwe.aux'
      'mwe.out'
      'mwe.toc'
------------
Run number 3 of rule 'pdflatex'
------------
------------
Running 'lualatex --synctex=1 --shell-escape  -recorder  "mwe.tex"'
------------
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
 system commands enabled.
(./mwe.tex
LaTeX2e <2018-04-01> patch level 3
(using write cache: /opt/texlive/2018/texmf-var/luatex-cache/generic)(using rea
d cache: /opt/texlive/2018/texmf-var/luatex-cache/generic /home/faraday/.config
/texlive/2018/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.096 seconds
Babel <3.20> and hyphenation patterns for 1 language(s) loaded.
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2018/03/30 v3.25 KOMA-Script document class (article)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrbase.sty
(/opt/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlfile.sty)))
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrsize11pt.clo(load luc: /
opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc
)) (/opt/texlive/2018/texmf-dist/tex/latex/koma-script/typearea.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlayer-scrpage.sty
(/opt/texlive/2018/texmf-dist/tex/latex/koma-script/scrlayer.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/blindtext/blindtext.sty
(/opt/texlive/2018/texmf-dist/tex/latex/tools/xspace.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/opt/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/opt/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/opt/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/opt/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/opt/texlive/2018/texmf-dist/tex/latex/oberdiek/hypcap.sty) (./mwe.aux)
(/opt/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/opt/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./mwe.out) (./mwe.out)(load luc: /opt/texlive/2018/texmf-var/luatex-cache/gene
ric/fonts/otl/lmsans10-regular.luc)(load luc: /opt/texlive/2018/texmf-var/luate
x-cache/generic/fonts/otl/lmsans10-bold.luc)(load luc: /opt/texlive/2018/texmf-
var/luatex-cache/generic/fonts/otl/lmroman12-regular.luc)

LaTeX Warning: No \author given.

(./mwe.toc)(load luc: /opt/texlive/2018/texmf-var/luatex-cache/generic/fonts/ot
l/lmromanslant10-regular.luc) [1{/opt/texlive/2018/texmf-var/fonts/map/pdftex/u
pdmap/pdftex.map}]
part I.

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 33.

[2] [3]
part II.

Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 86.


Package hyperref Warning: Difference (2) between bookmark levels is greater
(hyperref)                than one, level fixed on input line 90.

[4] [5] (./mwe.aux))
 400 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 54 glue_spec, 3 attribute_lis
t, 1 write nodes
   avail lists: 2:563,3:140,4:5,5:181,6:58,7:3894,8:49,9:203,10:4,11:314
</opt/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf></
opt/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf></op
t/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmsans10-bold.otf>
Output written on mwe.pdf (5 pages, 23032 bytes).
SyncTeX written on mwe.synctex.gz.
Transcript written on mwe.log.
=== TeX engine is 'LuaTeX'
Latexmk: Log file says output to 'mwe.pdf'
Latexmk: All targets (mwe.pdf) are up-to-date

2 Answers 2

6

The warnings are related to KOMA-Script. The "MWE" works fine with KOMA-Script 2015/10/03 v3.19a (scrartcl.cls).

The latest version 2018/03/30 v3.25 redefines \toclevel@part from 0 to −1, leaving a gap of 2 between the levels "part" and "section".

The first two warnings are caused by this gap from "part" to "section". Package hyperref fixes this by giving the section after part the level 0. The the following \subsection with level 2 throws the third warning.

Fix:

\documentclass{scrartcl}
\usepackage{hyperref}
\makeatletter
\renewcommand*{\toclevel@part}{0}
\makeatother

Recommended is package bookmark. It also fixes the issue, because its improved algorithm supports level gaps (and the fix above is not needed). Also, it updates the bookmarks faster (often a second run is not needed).

4
  • Sorry, the warning line number was from my original document which I stripped down to make the MWE. It's actually line 90, so I've updated the question accordingly.
    – Robbie
    May 21, 2018 at 5:45
  • That's really odd. I've attached the log from mine to the question, and I get three warnings from hyperref, on line 33, 86, and 90.
    – Robbie
    May 21, 2018 at 6:03
  • Loading the bookmark package fixed it, thank you :)
    – Robbie
    May 21, 2018 at 6:26
  • @Robbie I can now reproduce the warnings with a newer KOMA-Script (2018/03/30 v3.25). It changes the bookmark level for parts. Therefore, I have rewritten the answer. May 21, 2018 at 6:56
1

This problem does not longer happen with KOMA-Script v3.26 because scrartcl now automatically loads bookmarks if hyperref is loaded. It also has a workaround for the case, that loading of bookmark is prevented, so even:

% vim: ft=tex tw=0

% arara: lualatex: { synctex: true, shell: true }
% arara: lualatex: { synctex: true, shell: true }

\documentclass[bookmarkpackage=false]{scrartcl}
\usepackage{scrlayer-scrpage}

\usepackage[math]{blindtext}

\title{A minimum working example}

\usepackage{hyperref}
\hypersetup{
  pdfauthor={Robbie Smith},
  pdftitle={A minimum working example},
  pdfcreator={An infinite number of gremlins hitting random keys on typewriters...},
  pdfpagemode=UseOutlines,
  colorlinks=false,
  hypertexnames=false,
  hidelinks}
\usepackage[all]{hypcap}

\begin{document}

\maketitle

\tableofcontents
\clearpage

\part{Design and Testing}

\section{Objective}

\blindtext

\section{Summary}
\label{sec:summary}

\blindtext

\section{Geometric design}
\label{sec:geometry}

\blindtext

\subsection{Final geometic design}
\label{ssec:geo:final}

The final geometric design is provided in the table below. Formulae references
are to the calculations in the above sections.

\blindtext

\section{Fabrication}
\label{sec:fabrication}

\blindtext

\section{Testing}
\label{sec:testing}

\blindtext

\section{Proposed improvements}
\label{sec:improvements}

\blindtext

\section{Conclusions}
\label{sec:conclusions}

\blindtext

\appendix
\setcounter{table}{0}
\setcounter{figure}{0}
\renewcommand*{\thetable}{\thesection.\arabic{table}}
\renewcommand*{\thefigure}{\thesection.\arabic{figure}}

\part{Preliminary Designs}
\label{part:preliminary-designs}

The preliminary designs were developed prior to building and testing.

\section{First Iteration}

\blindtext

\subsection{Something something}

\blindtext

\section{Second Iteration}

\blindtext

\section{Third Iteration}

\blindtext

\end{document}

does result in correct bookmarks:

The bookmarks

and without a hyperref warning. But in this case scrartcl itself warns:

Class scrartcl Warning: Trying emergency fix for bookmark level gap,
(scrartcl)              because toclevel of `part' (-1)
(scrartcl)              is more than 1 lower than currently lowest
(scrartcl)              known level (1).
(scrartcl)              Note: This fix can fail and you should load
(scrartcl)              package `bookmark' to avoid usage of this
(scrartcl)              fix on input line 24.

After removing option bookmarkpackage=false the warning disappears. But now, auxhook writes an information to the log-file:

Package auxhook Info: \AddLineBeginMainAux comes a little late,
(auxhook)             because the main .aux file is already opened on input lin
e 164.

So the recommended solution is still to add a \usepackage{bookmark} after loading hyperref.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .