8000 Merge pull request #15028 from jfbu/latex_fix_preamble · numpy/numpy@4bc7eda · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bc7eda

Browse files
authored
Merge pull request #15028 from jfbu/latex_fix_preamble
[DOC] LaTeX: fix preamble (closes #15026)
2 parents bd1adc3 + aed6f9b commit 4bc7eda

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ latex-build: generate
217217
mkdir -p build/latex build/doctrees
218218
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex $(FILES)
219219
$(PYTHON) postprocess.py tex build/latex/*.tex
220-
perl -pi -e 's/\t(latex.*|pdflatex) (.*)/\t-$$1 -interaction batchmode $$2/' build/latex/Makefile
220+
perl -pi -e 's/LATEXOPTS =/LATEXOPTS ?= --halt-on-error/' build/latex/Makefile
221221
@echo
222222
@echo "Build finished; the LaTeX files are in build/latex."
223223
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \

doc/source/conf.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,28 @@ def setup(app):
178178
}
179179

180180
# Additional stuff for the LaTeX preamble.
181-
latex_preamble = r'''
182-
\usepackage{amsmath}
183-
\DeclareUnicodeCharacter{00A0}{\nobreakspace}
184-
181+
latex_elements['preamble'] = r'''
185182
% In the parameters section, place a newline after the Parameters
186183
% header
187184
\usepackage{expdlist}
188185
\let\latexdescription=\description
189186
\def\description{\latexdescription{}{} \breaklabel}
187+
% but expdlist old LaTeX package requires fixes:
188+
% 1) remove extra space
189+
\usepackage{etoolbox}
190+
\makeatletter
191+
\patchcmd\@item{{\@breaklabel} }{{\@breaklabel}}{}{}
192+
\makeatother
193+
% 2) fix bug in expdlist's way of breaking the line after long item label
194+
\makeatletter
195+
\def\breaklabel{%
196+
\def\@breaklabel{%
197+
\leavevmode\par
198+
% now a hack because Sphinx inserts \leavevmode after term node
199+
\def\leavevmode{\def\leavevmode{\unhbox\voidb@x}}%
200+
}%
201+
}
202+
\makeatother
190203
191204
% Make Examples/etc section headers smaller and more compact
192205
\makeatletter

doc/source/docs/howto_build_docs.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Building the NumPy API and reference docs
55
=========================================
66

77
We currently use Sphinx_ for generating the API and reference
8-
documentation for NumPy. You will need Sphinx 1.8.3 <= 1.8.5.
8+
documentation for NumPy. You will need Sphinx >= 2.0.0.
99

1010
If you only want to get the documentation, note that pre-built
1111
versions can be found at
@@ -57,7 +57,9 @@ To build the PDF documentation, do instead::
5757
make latex
5858
make -C build/latex all-pdf
5959

60-
You will need to have Latex installed for this.
60+
You will need to have Latex installed for this, inclusive of support for
61+
Greek letters. For example, on Ubuntu xenial ``texlive-lang-greek`` and
62+
``cm-super`` are needed. Also ``latexmk`` is needed on non-Windows systems.
6163

6264
Instead of the above, you can also do::
6365

0 commit comments

Comments
 (0)
0