summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-11-16 18:44:46 +0100
committerGeorg Brandl <georg@python.org>2008-11-16 18:44:46 +0100
commit500ebb8cfb8c904f59e363bbbcdd75bbc48b8a4c (patch)
tree3188dac1f19460743e1a89ab78bcec74c6ed19df
parent4f7e02cf772cbfccae3bf6fadd169827f525f587 (diff)
downloadsphinx-500ebb8cfb8c904f59e363bbbcdd75bbc48b8a4c.tar.gz
A few math experience improvements, inspired by Fredrik Johansson.
-rw-r--r--doc/ext/math.rst14
-rw-r--r--sphinx/ext/pngmath.py8
-rw-r--r--sphinx/static/default.css4
-rw-r--r--sphinx/static/sphinxdoc.css12
4 files changed, 32 insertions, 6 deletions
diff --git a/doc/ext/math.rst b/doc/ext/math.rst
index 325dfd3a..6ac94b48 100644
--- a/doc/ext/math.rst
+++ b/doc/ext/math.rst
@@ -129,11 +129,21 @@ There are various config values you can set to influence how the images are buil
.. confval:: pngmath_dvipng_args
- Additional arguments to give to dvipng, as a list. This is empty by default.
- Arguments you might want to add here are e.g. ``['-bg', 'Transparent']``,
+ Additional arguments to give to dvipng, as a list. The default value is
+ ``['-gamma 1.5', '-D 110']`` which makes the image a bit darker and larger
+ then it is by default.
+
+ An arguments you might want to add here is e.g. ``'-bg Transparent'``,
which produces PNGs with a transparent background. This is not enabled by
default because some Internet Explorer versions don't like transparent PNGs.
+ .. note::
+
+ When you "add" an argument, you need to reproduce the default arguments if
+ you want to keep them; that is, like this::
+
+ pngmath_dvipng_args = ['-gamma 1.5', '-D 110', '-bg Transparent']
+
.. confval:: pngmath_use_preview
``dvipng`` has the ability to determine the "depth" of the rendered text: for
diff --git a/sphinx/ext/pngmath.py b/sphinx/ext/pngmath.py
index 53047903..08fb9389 100644
--- a/sphinx/ext/pngmath.py
+++ b/sphinx/ext/pngmath.py
@@ -172,8 +172,8 @@ def cleanup_tempdir(app, exc):
def html_visit_math(self, node):
fname, depth = render_math(self, '$'+node['latex']+'$')
- self.body.append('<img src="%s" alt="%s" %s/>' %
- (fname, self.encode(node['latex']),
+ self.body.append('<img class="math" src="%s" alt="%s" %s/>' %
+ (fname, self.encode(node['latex']).strip(),
depth and 'style="vertical-align: %dpx" ' % (-depth) or ''))
raise nodes.SkipNode
@@ -188,7 +188,7 @@ def html_visit_displaymath(self, node):
if node['number']:
self.body.append('<span class="eqno">(%s)</span>' % node['number'])
self.body.append('<img src="%s" alt="%s" />\n</div>' %
- (fname, self.encode(node['latex'])))
+ (fname, self.encode(node['latex']).strip()))
self.body.append('</p>')
raise nodes.SkipNode
@@ -198,6 +198,6 @@ def setup(app):
app.add_config_value('pngmath_dvipng', 'dvipng', False)
app.add_config_value('pngmath_latex', 'latex', False)
app.add_config_value('pngmath_use_preview', False, False)
- app.add_config_value('pngmath_dvipng_args', [], False)
+ app.add_config_value('pngmath_dvipng_args', ['-gamma 1.5', '-D 110'], False)
app.add_config_value('pngmath_latex_preamble', '', False)
app.connect('build-finished', cleanup_tempdir)
diff --git a/sphinx/static/default.css b/sphinx/static/default.css
index cd2bfc35..288fa487 100644
--- a/sphinx/static/default.css
+++ b/sphinx/static/default.css
@@ -832,6 +832,10 @@ form.comment textarea {
border: 3px solid red;
}
+img.math {
+ vertical-align: middle;
+}
+
div.math {
text-align: center;
}
diff --git a/sphinx/static/sphinxdoc.css b/sphinx/static/sphinxdoc.css
index 95743076..999bf48c 100644
--- a/sphinx/static/sphinxdoc.css
+++ b/sphinx/static/sphinxdoc.css
@@ -272,6 +272,14 @@ div.sidebar {
float: right;
}
+div.quotebar {
+ background-color: #f8f8f8;
+ max-width: 250px;
+ float: right;
+ padding: 2px 7px;
+ border: 1px solid #ccc;
+}
+
p.sidebar-title {
font-weight: bold;
}
@@ -532,6 +540,10 @@ ul.keywordmatches li.goodmatch a {
font-weight: bold;
}
+img.math {
+ vertical-align: center;
+}
+
div.math {
text-align: center;
}