Skip to content

Some background to this error (warning)

As their names suggest, the \pdfstartlink and \pdfendlink commands are used to create hyperlinks within TeX/LaTeX-generated PDF files—for example, links to different pages within the PDF file or links to websites. These commands are so-called primitives: low-level commands built into TeX engines—they are not macros. As a consequence, most users do not encounter them directly but use them indirectly via macros (commands) provided by packages such as hyperref.

At the time of writing (December 2022) \pdfstartlink and \pdfendlink are supported by just two TeX engines: pdfTeX and LuaTeX (and LuaHBTeX). Historically, both pdfTeX and LuaTeX generated an error message of the form

\pdfendlink ended up in different nesting level than \pdfstartlink

in response to low-level problems related to the depth of box-nesting. Note that the text of this message originates deep within TeX engine software, it is not produced by any LaTeX package nor, of course, by Overleaf.

Starting with TeX Live 2021, pdfTeX and LuaTeX diverged in their handling of the underlying (box nesting) issue and now exhibit different behaviour:

  • pdfTeX now issues that message as a warning, it no longer triggers an error and compilation does not terminate;
  • LuaTeX (LuaHBTeX) continues to treat this issue as a fatal error, causing compilation to terminate—the wording of that error message differs slightly from the one given above.

Readers wishing to further explore the underlying cause of this error can:

At a practical level, what causes it?

At the user level, this warning (or error) can be triggered when using the hyperref package and a hyperlink—such as a citation, URL or cross-reference—breaks across two pages or two columns in a multi-column document; i.e., the link starts near the end of one page (or column) and ends on the next page (or column).

As discussed, pdfTeX (pdfLaTeX) with TeX Live 2021 or later no longer generates an error but, at the time of writing (December 2022), LuaLaTeX continues to do so. If you are using LuaLaTeX, a temporary workaround whilst working on your document is to disable hyperlinks by writing


just before your


Although this prevents hyperlinks from appearing in your document, it avoids the error whilst writing and, when you're ready to compile the final document, you can comment out or delete \hypersetup{draft}. If you are unlucky enough to still encounter this problem at the final-compilation stage, re-enable the draft and then go through your PDF to find the possible offender (citations, cross-references, floats at top of pages...), so that you can, hopefully..., find a way to edit/reword your text to avoid the problem.

Further information

If you encounter this issue as a fatal error it can require some detective work to track the precise cause. tex.stackexchange has several discussions but note that some of these pages pre-date pdfTeX's downgrading of the error to a warning:

Overleaf guides

LaTeX Basics


Figures and tables

References and Citations


Document structure





Field specific

Class files

Advanced TeX/LaTeX