mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
A few math experience improvements, inspired by Fredrik Johansson.
This commit is contained in:
parent
7d2f674ff2
commit
b1579af47e
@ -129,11 +129,21 @@ There are various config values you can set to influence how the images are buil
|
|||||||
|
|
||||||
.. confval:: pngmath_dvipng_args
|
.. confval:: pngmath_dvipng_args
|
||||||
|
|
||||||
Additional arguments to give to dvipng, as a list. This is empty by default.
|
Additional arguments to give to dvipng, as a list. The default value is
|
||||||
Arguments you might want to add here are e.g. ``['-bg', 'Transparent']``,
|
``['-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
|
which produces PNGs with a transparent background. This is not enabled by
|
||||||
default because some Internet Explorer versions don't like transparent PNGs.
|
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
|
.. confval:: pngmath_use_preview
|
||||||
|
|
||||||
``dvipng`` has the ability to determine the "depth" of the rendered text: for
|
``dvipng`` has the ability to determine the "depth" of the rendered text: for
|
||||||
|
@ -172,8 +172,8 @@ def cleanup_tempdir(app, exc):
|
|||||||
|
|
||||||
def html_visit_math(self, node):
|
def html_visit_math(self, node):
|
||||||
fname, depth = render_math(self, '$'+node['latex']+'$')
|
fname, depth = render_math(self, '$'+node['latex']+'$')
|
||||||
self.body.append('<img src="%s" alt="%s" %s/>' %
|
self.body.append('<img class="math" src="%s" alt="%s" %s/>' %
|
||||||
(fname, self.encode(node['latex']),
|
(fname, self.encode(node['latex']).strip(),
|
||||||
depth and 'style="vertical-align: %dpx" ' % (-depth) or ''))
|
depth and 'style="vertical-align: %dpx" ' % (-depth) or ''))
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ def html_visit_displaymath(self, node):
|
|||||||
if node['number']:
|
if node['number']:
|
||||||
self.body.append('<span class="eqno">(%s)</span>' % node['number'])
|
self.body.append('<span class="eqno">(%s)</span>' % node['number'])
|
||||||
self.body.append('<img src="%s" alt="%s" />\n</div>' %
|
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>')
|
self.body.append('</p>')
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
@ -198,6 +198,6 @@ def setup(app):
|
|||||||
app.add_config_value('pngmath_dvipng', 'dvipng', False)
|
app.add_config_value('pngmath_dvipng', 'dvipng', False)
|
||||||
app.add_config_value('pngmath_latex', 'latex', False)
|
app.add_config_value('pngmath_latex', 'latex', False)
|
||||||
app.add_config_value('pngmath_use_preview', False, 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.add_config_value('pngmath_latex_preamble', '', False)
|
||||||
app.connect('build-finished', cleanup_tempdir)
|
app.connect('build-finished', cleanup_tempdir)
|
||||||
|
@ -832,6 +832,10 @@ form.comment textarea {
|
|||||||
border: 3px solid red;
|
border: 3px solid red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img.math {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
div.math {
|
div.math {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,14 @@ div.sidebar {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.quotebar {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
max-width: 250px;
|
||||||
|
float: right;
|
||||||
|
padding: 2px 7px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
p.sidebar-title {
|
p.sidebar-title {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -532,6 +540,10 @@ ul.keywordmatches li.goodmatch a {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img.math {
|
||||||
|
vertical-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
div.math {
|
div.math {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user