1
|
#! /usr/bin/python
|
2
|
|
3
|
"""A minimal reST frontend, to create appropriate LaTeX files."""
|
4
|
|
5
|
try:
|
6
|
import locale
|
7
|
locale.setlocale(locale.LC_ALL, '')
|
8
|
except:
|
9
|
pass
|
10
|
|
11
|
from docutils.core import publish_cmdline, Publisher
|
12
|
|
13
|
def set_io(self, source_path=None, destination_path=None):
|
14
|
Publisher.set_io_orig(self, source_path, destination_path='/dev/null')
|
15
|
|
16
|
Publisher.set_io_orig, Publisher.set_io = Publisher.set_io, set_io
|
17
|
|
18
|
output = publish_cmdline(writer_name='latex',
|
19
|
settings_overrides = {
|
20
|
'documentclass': 'report',
|
21
|
'documentoptions': '11pt,a4paper,titlepage',
|
22
|
'use_latex_toc': True,
|
23
|
'use_latex_docinfo': True,
|
24
|
'stylesheet': 'custom.tex'})
|
25
|
|
26
|
output = output.replace('\\includegraphics',
|
27
|
'\\includegraphics[width=.9\\textwidth,height=15cm,clip,keepaspectratio]')
|
28
|
output = output.replace('\\begin{figure}[htbp]', '\\begin{figure}[H]')
|
29
|
print output
|