I need to suppress occurrences of 3 consecutive lines of text that end in hyphenated words. How to solve this?
My LaTeX Source Code is:
\documentclass{book}
\usepackage{luacode}
\begin{document}
\frenchspacing %% no extra space after punctuation marks
\begin{luacode*}
local domobject = require "luaxml-domobject"
sample = [[
<datas>
<p>The investigations of cylindrically symmetric spacetimes can be traced back as far as to 1919 when Levi-Civita (LC) discovered a class of solutions of Einstein’s vacuums field equations, corresponding static cylindrical spacetime referring [218]. The extension of the LC spacetimes to the stationary one was independent by Lanczos in 1924 [213] and Lewis in 1932 [219]. In 1925, Beck studied a class of exact solutions and interpreted them as representing the propagation of cylindrical gravitational waves (GWs) [24]. This class of solutions was later rediscovered by Einstein and Rosen in their seminal work on the studies of the nonlinearity of GWs in 1937 [137], and in the same year van Stockum solved the problem of a rigidly rotating infinitely long cylinder of dust, and found explicitly the corresponding metric [308]. In 1957, Bonnor [43] and Weber and Wheeler [327] studied the Einstein–Rosen waves in great details, and since then, cylindrically symmetric spacetimes have been extensively investigated with various motivations [167, 294].</p>
</datas>]]
local dom = domobject.parse(sample)
tex.sprint(dom:query_selector("p")[1]:get_text())
\end{luacode*}
\end{document}
My Output PDF is:
\doublehyphendemerits=1000000
(the default value is10000
) avoids the triple consecutive hyphens for the normal paragraph, but not for the one typeset withluacode*
. Strange. – egreg Dec 23 '20 at 10:03microtype
can help here. – Skillmon Dec 23 '20 at 10:15mbox
? – Ingmar Dec 23 '20 at 10:18luacode*
version doesn't like the input to be split across lines. – egreg Dec 23 '20 at 11:11