diff --git a/doc/do_sphinx.py b/doc/do_sphinx.py index 77d7481..6a1455a 100644 --- a/doc/do_sphinx.py +++ b/doc/do_sphinx.py @@ -13,9 +13,43 @@ if sys.platform != 'win32': # Produce pdf. os.chdir('build/latex') - # Change chapter style to section style: allows chapters to start on the current page. Works much better for the short chapters we have. + # Change chapter style to section style: allows chapters to start on + # the current page. Works much better for the short chapters we have. + # This must go in the class file rather than the preamble, so we modify + # manual.cls at runtime. + chapter_cmds=r''' +% Local changes. +\renewcommand\chapter{ + \thispagestyle{plain} + \global\@topnum\z@ + \@afterindentfalse + \secdef\@chapter\@schapter +} +\def\@makechapterhead#1{ + \vspace*{10\p@} + {\raggedright \reset@font \Huge \bfseries \thechapter \quad #1} + \par\nobreak + \hrulefill + \par\nobreak + \vspace*{10\p@} +} +\def\@makeschapterhead#1{ + \vspace*{10\p@} + {\raggedright \reset@font \Huge \bfseries #1} + \par\nobreak + \hrulefill + \par\nobreak + \vspace*{10\p@} +} +''' + + unmodified=True for line in fileinput.FileInput('manual.cls',inplace=1): - line=line.replace('py@OldChapter=\chapter','py@OldChapter=\section') + if 'Support for module synopsis' in line and unmodified: + line=chapter_cmds+line + elif 'makechapterhead' in line: + # Already have altered manual.cls: don't need to again. + unmodified=False print line, # Copying the makefile produced by sphinx... diff --git a/doc/source/conf.py b/doc/source/conf.py index 24ac6de..0270b6e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -123,7 +123,7 @@ latex_font_size = '10pt' latex_documents = [('ipython','ipython.tex','IPython Documentation','IPython developers','manual')] # Additional stuff for the LaTeX preamble. -latex_preamble = '\\def\\thesection{\\arabic{section}}' +#latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = []