Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF generation breaks with unstarred \enlargethispage and lualatex #1551

Open
LupinoTech opened this issue Nov 19, 2024 · 3 comments
Open

PDF generation breaks with unstarred \enlargethispage and lualatex #1551

LupinoTech opened this issue Nov 19, 2024 · 3 comments

Comments

@LupinoTech
Copy link

LupinoTech commented Nov 19, 2024

The following code breaks with luaLaTeX (texlive 2024) but not with pdflatex or plain latex:

\RequirePackage{latexbug}
\documentclass{article}
\usepackage[breaklinks=true]{hyperref}
\textheight50mm
\title{}
\author{}


\begin{document}
\hsize40mm
\parindent0pt
\null\vskip30mm
\enlargethispage{1sp}% tex error
% \enlargethispage*{1sp}% no tex error

Some multiline text with a rather long, breaking url \url{https://tex.stackexchange.com/questions/731156/the-bottom-margin-of-bibliography-frame-is-too-narrow}.

\end{document}

with the error message

! error:  (pdf backend): 'endlink' ended up in different nesting level than 'startlink'
!  ==> Fatal error occurred, no output PDF file produced!%                                                                                                                                                                                                                    

log file:
test.log

The starred variant of \enlargethispage seems to work fine, though.

@LupinoTech
Copy link
Author

I should add that the error occurs only when the link breaks across pages.

@u-fischer
Copy link
Member

It is not a hyperref bug. You get the same error if you use the primitive:

\documentclass{article}
\textheight50mm
\title{}
\author{}

\begin{document}
\hsize40mm
\parindent0pt
\null\vskip30mm
\enlargethispage{1sp}% tex error


Some multiline text with a rather long, breaking url 
\pdfextension startlink
    attr {/Border[0 0 1]}
    user{
        /Subtype/Link%
        /A<<%
         /Type/Action%
         /S/URI%
         /URI(blkub)%
         >>%
        } https://tex.stackexchange.com/questions/731156/the-bottom-margin-of-bibliography-frame-is-too-narrow
\pdfextension endlink

\end{document}

The problem is that LaTeX boxes the two pages in different ways. With pdflatex there is no problem as (at my request) pdftex changed the error to a warning:

pdfTeX warning: \pdfendlink ended up in different nesting level than \pdfstartlink

Sadly, luatex didn't want to follow (https://mailman.ntg.nl/archives/list/[email protected]/thread/VSHCA4WEQJJ5C3JJPVTPTYWYLDZ7TBHA/)

A similar problem was resolved in 2018 in #94 for another case of boxing, so perhaps some adjustments in the LaTeX output can be done here and I will transfer the issue to latex2e.

As a workaround add \enlargethispage{1sp} also on the next page, then box pages have the same boxing level. E.g.

\documentclass{article}
\usepackage[breaklinks=true]{hyperref}
\textheight50mm
\title{}
\author{}
\AddToHook{shipout/before}{\enlargethispage{1sp}}

\begin{document}
\hsize40mm
\parindent0pt
\null\vskip30mm
\enlargethispage{1sp}% tex error
% \enlargethispage*{1sp}% no tex error

Some multiline text with a rather long, breaking url \url{https://tex.stackexchange.com/questions/731156/the-bottom-margin-of-bibliography-frame-is-too-narrow}.

\end{document}

@u-fischer u-fischer transferred this issue from latex3/hyperref Nov 19, 2024
@LupinoTech
Copy link
Author

just for my understanding; does the \@kludgeins on the followup page need to have the same height as the one on the previous page? Or is 1sp "enough"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants