From 5b9ad3687e3315a46e19e1b3fd31b74967244afb Mon Sep 17 00:00:00 2001 From: jfbu Date: Mon, 2 Dec 2019 15:00:44 +0100 Subject: [DOC] LaTeX: Fix preamble Memo: latex_preamble got removed from Sphinx at 1.6.1, and old LaTeX package expdlist requires a fix else it breaks LaTeX if a description list is in a table cell, and it causes anyhow many LaTeX complaints about Underfull box (badness 10000). The fix for these complaints is copied over from https://github.com/scipy/scipy/commit/c881fdea7a7ef7c518b789 and it turns out it is also a fix for the crash in case a description list is in a table.. --- doc/source/conf.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'doc/source/conf.py') diff --git a/doc/source/conf.py b/doc/source/conf.py index 83cecc917..09770535b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -178,15 +178,28 @@ latex_elements = { } # Additional stuff for the LaTeX preamble. -latex_preamble = r''' -\usepackage{amsmath} -\DeclareUnicodeCharacter{00A0}{\nobreakspace} - +latex_elements['preamble'] = r''' % In the parameters section, place a newline after the Parameters % header \usepackage{expdlist} \let\latexdescription=\description \def\description{\latexdescription{}{} \breaklabel} +% but expdlist old LaTeX package requires fixes: +% 1) remove extra space +\usepackage{etoolbox} +\makeatletter +\patchcmd\@item{{\@breaklabel} }{{\@breaklabel}}{}{} +\makeatother +% 2) fix bug in expdlist's way of breaking the line after long item label +\makeatletter +\def\breaklabel{% + \def\@breaklabel{% + \leavevmode\par + % now a hack because Sphinx inserts \leavevmode after term node + \def\leavevmode{\def\leavevmode{\unhbox\voidb@x}}% + }% +} +\makeatother % Make Examples/etc section headers smaller and more compact \makeatletter -- cgit v1.2.1