-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
131 lines (88 loc) · 3.22 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
******************************************************************
``sphinxcontrib-texfigure`` -- TeX Figure extension for Sphinx
******************************************************************
Overview
========
``sphinxcontrib-texfigure`` is a Sphinx_ extension for generating
figures and diagrams from TeX files.
For an example of a diagram this extension could produce, please see
http://htsql.org/doc/overview.html#htsql-in-a-nutshell. For more
examples, see ``demo`` directory in the source distribution.
This extension is similar in scope to `sphinxcontrib-tikz`_ extension,
but with different approach to input and options.
This software is written by Kirill Simonov (`Prometheus Research, LLC`_)
and released under BSD license.
Prerequisites
=============
The following executables are used for rasterizing TeX documents:
* ``pdflatex``
* ``pdftoppm``
* ``pnmcrop``
* ``pnmtopng``
On a Debian_ or a `Debian-derived`_ system, they could be installed
with::
# apt-get install texlive
# apt-get install poppler-utils
# apt-get install netpbm
If you want to generate diagrams with TikZ_, install::
# apt-get install texlive-pictures
Usage
=====
To enable this extension, add the following line to ``conf.py``::
extensions.append('sphinxcontrib.texfigure')
Use ``texfigure`` directive to convert a TeX/LaTeX document to an image.
For example::
.. texfigure:: hello-world.tex
This directive will render *Hello, World!* in a box assuming that
``hello-world.tex`` contains the following LaTeX document::
\documentclass{article}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\node[draw] {Hello, World!};
\end{tikzpicture}
\end{document}
Use option ``align`` to specify horizontal alignment, ``alt`` to specify
text content of the image::
.. texfigure:: hello-world.tex
:align: center
:alt: Hello, World!
Reference
=========
Directives
----------
``texfigure``
Renders a figure from a TeX document.
The parameter of the directive must be the path to a TeX/LaTeX file.
This directive has no body.
Options:
``align``
Horizontal alignment (``left``, ``center``, or ``right``)
``alt``
Alternative text content of the image.
Configuration parameters
------------------------
``texfigure_pdftex`` (default: ``pdflatex``)
Path to ``pdftex`` or ``pdflatex`` executable.
``texfigure_pdftoppm`` (default: ``pdftoppm``)
Path to ``pdftoppm`` executable.
``texfigure_pnmcrop`` (default: ``pnmcrop``)
Path to ``pnmcrop`` executable.
``texfigure_pnmtopng`` (default: ``pnmtopng``)
Path to ``pnmtopng`` executable.
``texfigure_texinputs`` (default: ``[]``)
List of directories where TeX searches for input files.
``texfigure_resolution`` (default: ``110``)
Image resolution, in DPI.
CSS classes
-----------
``texfigure``
Applies to the generated image.
.. _Sphinx: http://sphinx-doc.org/
.. _sphinxcontrib-tikz: https://pypi.python.org/pypi/sphinxcontrib-tikz
.. _Prometheus Research, LLC: http://prometheusresearch.com/
.. _Debian: http://debian.org/
.. _Debian-derived: http://ubuntu.com/
.. _TikZ: http://www.texample.net/tikz/
.. vim: set spell spelllang=en textwidth=72: