diff options
author | jfbu <jfbu@free.fr> | 2019-12-02 15:00:44 +0100 |
---|---|---|
committer | jfbu <jfbu@free.fr> | 2019-12-02 20:05:05 +0100 |
commit | 5b9ad3687e3315a46e19e1b3fd31b74967244afb (patch) | |
tree | 7013080fbe71ad96ce9a1dd437f211a66f7a7b53 | |
parent | b83f10ef7ee766bf30ccfa563b6cc8f7fd38a4c8 (diff) | |
download | numpy-5b9ad3687e3315a46e19e1b3fd31b74967244afb.tar.gz |
[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..
-rw-r--r-- | doc/source/conf.py | 21 |
1 files changed, 17 insertions, 4 deletions
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 |