阻止 Sphinx 断字

Stop Sphinx from Hyphenating

我有一个与 this 类似的问题,除了 Sphinx 和 RST。也就是说,我想防止文本在行尾被连字符。

例如我想要这个:

This is my long sent-
ence.

成为:

This is my long
sentence.

我该怎么做?

断字由 Sphinx 主题 "basic" 中的样式表 basic.css 实现。

div.body p, div.body dd, div.body li, div.body blockquote {
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    -webkit-hyphens: auto;
    hyphens: auto;
}

您可以用自己的样式覆盖这些样式。请参阅我对

的回答

您的主题可能有 JavaScript 或其他实现断字的样式。

对于 PDF 输出,请参阅 https://tex.stackexchange.com/a/5039

在阅读@steve-piercy 的指点后,我设法找到了解决问题的方法。我需要在我的项目中自定义 conf.py。我的 conf.py 具有以下设置:

# ...
# ...

# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #
    'papersize': 'a4paper',

    # The font size ('10pt', '11pt' or '12pt').
    #
    'pointsize': '12pt',

    # Additional stuff for the LaTeX preamble.
    #
    'preamble': r'''
    \usepackage[none]{hyphenat}
    '''

    # Latex figure (float) alignment
    #
    # 'figure_align': 'htbp',

}

# ...
# ...

我正在使用 Sphinx 1.8.2、MikTex 2.9 和 Strawberry Perl 5.28.1。 conf.py 中的这一新变化将下载新的 perl 包。