Search code examples
latexpdf-generationpython-sphinxline-breaksrestructuredtext

How to render LaTeX/PDF with a forced line break on a definition list in reStructuredText


I want to render a pdf file in reStructuredText with a proper line break, such that:

Keyword
    Definition

This renders correctly with a Read the Docs template, but it doesn't produce the line break when using default settings and make latexpdf. Is there a simple function I can apply to the LaTeX output options in conf.py for this issue?

Note: I already submitted this question on TeX and was told to try Stack Overflow. The snippet above should be the shortest code required to reproduce my use case. As I said, these are the default settings as far as I know. I haven't made any significant changes. The lack of line break over definition lists seems to be the intended output for LaTeX pdf files.


Solution

  • Using the rinohtype PDF builder for Sphinx allows for fine control of style aspects such as these. The default style sheet actually inserts line breaks between a keyword and its definition in definition lists. Otherwise the style of the produced PDF is very similar to the output of the LaTeX builder. You can create your own style sheet and template configuration to customize the look of the PDF to your needs.

    (Full disclosure: I am the author of rinohtype)