我需要抑制以连字符结尾的 3 行连续文本。如何解决?
我的 LaTeX 源代码是:
\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}
我的输出 PDF 是:
答案1
设置\doublehyphendemerits
为更高的值。默认值为 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}
答案2
使用microtype
我得到以下结果:
\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}
答案3
到目前为止,Skillmon 和 egreg 给出的两个答案都是非常好的建议。还有一个更重要的提示,可以让换行算法产生更少的连字符。
\emergencystretch 3em
在 LaTeX3 中,这将尝试设置麻烦的段落(例如您要避免的段落),使用更长的空格而不是错误的连字符。与旧版本不同\sloppy
,这不会使好的段落看起来更糟。您可以使用 恢复默认值\fussy
。