Avoid Three Consecutive Hyphens
Set \doublehyphendemerits
to a higher value. The default is 10000.
\documentclass{book}
\usepackage{luacode}
\begin{document}
\doublehyphendemerits=1000000
\frenchspacing%%Ignore Double Spaces
\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*}
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].
\end{document}
Using microtype
I get the following:
\documentclass{book}
\usepackage{microtype}
\usepackage{luacode}
\begin{document}
\frenchspacing%%Ignore Double Spaces
\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}
Both of the answers so far, by Skillmon and egreg, are excellent advice. There is one more important tip to make the line-breaking algorithm produce fewer hyphens.
\emergencystretch 3em
In LaTeX3, this will try to set troublesome paragraphs, such as the one you’re trying to avoid, with much longer spaces instead of bad hyphenation. Unlike the older \sloppy
, this will not make good paragraphs look worse. You can restore the defaults with \fussy
.