Using line label references from the lineno package prevents lines from being broken at explicit hyphens in words adjacent to the label.

Consider the following MWE:





    Here is a word-with-some-explicit-hyphens-that-should-allow-breaking-at-one-of-them-at-the-end-of-the-line.

    Here is a \linelabel{a}word-with-some-explicit-hyphens-that-should-allow-breaking-at-one-of-them-at-the-end-of-the-line.


Using pdflatex we get the following output:pdflatex

Using lualatex we get the following output:lualatex

I tried to investigate what is causing this in the lineno package to see if its a package issue of a luatex issue. The end of the \linelabel command is \vadjust{\penalty-\@Mllbcodepen}, where the penalty is defined as \mathchardef\@Mllbcodepen=11111. The package patches the output routine and writes the line numbers to the auxiliary file when the penalty with this value is seen. Removing the \vadjust{\penalty-\@Mllbcodepen} results in proper line-breaking under lualatex (although obviously the line numbers are never written to the auxiliary file in this case), so something with that penalty is preventing proper line breaking. But this is as far as I could get with my analysis.

I would like to know how to use the lineno package and its \linelabel command with lualatex and still have the expected linebreaking.

closed as off-topic by brokemongoose, Claudio Fiandrino, Martin Schröder, Andrew Swann, user13907 Mar 18 '15 at 13:48

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • It only happens if the \vadjust is "part" of the word. That means Here is a \vadjust{\penalty123}word-with-some-explicit-hyphens... doesn't break, but it works if you add a space. Imho you should make a bug report at the luatex bug tracker. As a work-around you could make sure that there is a space between label and word: Here is a\linelabel{a}\ word-with... – Ulrike Fischer Mar 16 '15 at 10:25
  • Ah, it does look like a LuaTeX bug. I thought I had tried some regular penalties (not the -11111 used by lineno) and didn't had the issue, but I guess I was wrong. The bug and a more simple MWE are reported here: tracker.luatex.org/view.php?id=929 – brokemongoose Mar 16 '15 at 15:22
  • 4
    I'm voting to close this question as off-topic because it is due to a bug in the hyphenation algorithm of LuaTeX that was fixed (but not yet released). The post meta.tex.stackexchange.com/questions/6001/… said to vote to close bug-related questions as off-topic. – brokemongoose Mar 18 '15 at 12:44