22

Just curious if anyone knows how to customize the sphinx output when using the latexpdf target? I've seen lots of custom stuff for html output, but cant seem to find any example of custom pdf output.

Specifically, I'd be interested in customizing the title page, headers, footers, and possibly adding a few pages of front matter before the contents.

Has anyone seen any examples of this kind of customization, or do people pretty much just use the "stock" sphinx output when generating pdfs? Thanks!

4

1 に答える 1

20

はい、ラテックススタイリングのより良いまたはより明確なドキュメントがいいと思います。いくつかの例があります。

これは、パッケージの使用に関するスフィンクスメーリングリストの質問です。

sphinxは、ベースとして使用されるレポートドキュメントクラスを正しく覚えていれば、sphinxmanual.clsまたはsphinxhowto.clsというファイルに独自のラテックスドキュメントクラスを持っています。次に、パッケージである2つのスタイルファイルがあります。\ usepackage {mylatexstilefile}を作成するときに呼び出されるのは、これらのファイルの内容です。

ラテックスパッケージの使用に関する質問 http://groups.google.com/group/sphinx-dev/browse_thread/thread/890dab5e53fff004

これが私のconf.pyです。

preamb_old = ur'''
  %\documentclass{memoir}
  \makeatletter
  \fancypagestyle{normal}{
    \fancyhf{}
    \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
    \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
    \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
    \fancyhead[LE,RO]{{\py@HeaderFamily \@title}} % here's the change
    \renewcommand{\headrulewidth}{0.4pt}
    \renewcommand{\footrulewidth}{0.4pt}
  }
  \makeatother
  %\color {blue}
  %\normalcolor {dark blue}
  \pagecolor [RGB]{255, 247, 226}
  \definecolor{VerbatimColor}{rgb}{0.95,0.85,0.65}
  \definecolor{VerbatimBorderColor}{rgb}{0.5,0.95,0.1}
'''

f = open('graph/static/latexstyling.tex', 'r+')
PREAMBLE = f.read();


latex_elements = {
   'papersize':'a4paper',
   'pointsize':'11pt',
   'classoptions': ',openany',
   'babel': '\\usepackage[english]{babel}',
   'preamble': PREAMBLE

}

preamble_oldはもう使用していませんが、これはconf.pyで直接ラテックスプリアンブルを変更した例です。

開始点として、sphinxドキュメントのlatex_elementsとlatex_additional_filesを確認してください。

于 2011-01-31T20:14:04.320 に答える