Skip to content

Commit be35747

Browse files
author
y-p
committed
BLD/DOC: add latex_forced target to doc make.py
1 parent ffac147 commit be35747

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

doc/make.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
To build the docs you must have all optional dependencies for pandas
77
installed. See the installation instructions for a list of these.
88
9-
Note: currently latex builds do not work because of table formats that are not
10-
supported in the latex generation.
9+
<del>Note: currently latex builds do not work because of table formats that are not
10+
supported in the latex generation.</del>
11+
12+
2014-01-30: Latex has some issues but 'latex_forced' works ok for 0.13.0-400 or so
1113
1214
Usage
1315
-----
@@ -134,7 +136,33 @@ def latex():
134136

135137
# Call the makefile produced by sphinx...
136138
if os.system('make'):
137-
raise SystemExit("Rendering LaTeX failed.")
139+
print("Rendering LaTeX failed.")
140+
print("You may still be able to get a usable PDF file by going into 'build/latex'")
141+
print("and executing 'pdflatex pandas.tex' for the requisite number of passes.")
142+
print("Or using the 'latex_forced' target")
143+
raise SystemExit
144+
145+
os.chdir('../..')
146+
else:
147+
print('latex build has not been tested on windows')
148+
149+
def latex_forced():
150+
check_build()
151+
if sys.platform != 'win32':
152+
# LaTeX format.
153+
if os.system('sphinx-build -b latex -d build/doctrees '
154+
'source build/latex'):
155+
raise SystemExit("Building LaTeX failed.")
156+
# Produce pdf.
157+
158+
os.chdir('build/latex')
159+
160+
# Manually call pdflatex, 3 passes should ensure latex fixes up
161+
# all the required cross-references and such.
162+
os.system('pdflatex -interaction=nonstopmode pandas.tex')
163+
os.system('pdflatex -interaction=nonstopmode pandas.tex')
164+
os.system('pdflatex -interaction=nonstopmode pandas.tex')
165+
raise SystemExit("You should check the file 'build/latex/pandas.pdf' for problems.")
138166

139167
os.chdir('../..')
140168
else:
@@ -257,6 +285,7 @@ def _get_config():
257285
'upload_dev_pdf': upload_dev_pdf,
258286
'upload_stable_pdf': upload_stable_pdf,
259287
'latex': latex,
288+
'latex_forced': latex_forced,
260289
'clean': clean,
261290
'auto_dev': auto_dev_build,
262291
'auto_debug': lambda: auto_dev_build(True),

0 commit comments

Comments
 (0)