mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* #72: In pngmath, make it possible to give a full path to LaTeX and
dvipng on Windows. For that to work, the ``pngmath_latex`` and ``pngmath_dvipng`` options are no longer split into command and additional arguments; use ``pngmath_latex_args`` and ``pngmath_dvipng_args`` to give additional arguments.
This commit is contained in:
parent
9e9766a41a
commit
1dc46e6583
6
CHANGES
6
CHANGES
@ -1,6 +1,12 @@
|
|||||||
Release 0.5.1 (in development)
|
Release 0.5.1 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* #72: In pngmath, make it possible to give a full path to LaTeX and
|
||||||
|
dvipng on Windows. For that to work, the ``pngmath_latex`` and
|
||||||
|
``pngmath_dvipng`` options are no longer split into command and
|
||||||
|
additional arguments; use ``pngmath_latex_args`` and
|
||||||
|
``pngmath_dvipng_args`` to give additional arguments.
|
||||||
|
|
||||||
* Don't crash on failing doctests with non-ASCII characters.
|
* Don't crash on failing doctests with non-ASCII characters.
|
||||||
|
|
||||||
* Don't crash on writing status messages and warnings containing
|
* Don't crash on writing status messages and warnings containing
|
||||||
|
@ -110,9 +110,6 @@ There are various config values you can set to influence how the images are buil
|
|||||||
may need to set this to a full path if ``latex`` not in the executable search
|
may need to set this to a full path if ``latex`` not in the executable search
|
||||||
path.
|
path.
|
||||||
|
|
||||||
This string is split into words with :func:`shlex.split`, so that you can
|
|
||||||
include arguments as well if needed.
|
|
||||||
|
|
||||||
Since this setting is not portable from system to system, it is normally not
|
Since this setting is not portable from system to system, it is normally not
|
||||||
useful to set it in ``conf.py``; rather, giving it on the
|
useful to set it in ``conf.py``; rather, giving it on the
|
||||||
:program:`sphinx-build` command line via the :option:`-D` option should be
|
:program:`sphinx-build` command line via the :option:`-D` option should be
|
||||||
@ -120,12 +117,23 @@ There are various config values you can set to influence how the images are buil
|
|||||||
|
|
||||||
sphinx-build -b html -D pngmath_latex=C:\tex\latex.exe . _build/html
|
sphinx-build -b html -D pngmath_latex=C:\tex\latex.exe . _build/html
|
||||||
|
|
||||||
|
.. versionchanged:: 0.5.1
|
||||||
|
This value should only contain the path to the latex executable, not
|
||||||
|
further arguments; use :confval:`pngmath_latex_args` for that purpose.
|
||||||
|
|
||||||
.. confval:: pngmath_dvipng
|
.. confval:: pngmath_dvipng
|
||||||
|
|
||||||
The command name with which to invoke ``dvipng``. The default is
|
The command name with which to invoke ``dvipng``. The default is
|
||||||
``'dvipng'``; you may need to set this to a full path if ``dvipng`` is not in
|
``'dvipng'``; you may need to set this to a full path if ``dvipng`` is not in
|
||||||
the executable search path.
|
the executable search path.
|
||||||
|
|
||||||
|
.. confval:: pngmath_latex_args
|
||||||
|
|
||||||
|
Additional arguments to give to latex, as a list. The default is an empty
|
||||||
|
list.
|
||||||
|
|
||||||
|
.. versionadded:: 0.5.1
|
||||||
|
|
||||||
.. confval:: pngmath_latex_preamble
|
.. confval:: pngmath_latex_preamble
|
||||||
|
|
||||||
Additional LaTeX code to put into the preamble of the short LaTeX files that
|
Additional LaTeX code to put into the preamble of the short LaTeX files that
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import shlex
|
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import posixpath
|
import posixpath
|
||||||
@ -103,8 +102,10 @@ def render_math(self, math):
|
|||||||
# build latex command; old versions of latex don't have the
|
# build latex command; old versions of latex don't have the
|
||||||
# --output-directory option, so we have to manually chdir to the
|
# --output-directory option, so we have to manually chdir to the
|
||||||
# temp dir to run it.
|
# temp dir to run it.
|
||||||
ltx_args = shlex.split(self.builder.config.pngmath_latex)
|
ltx_args = [self.builder.config.pngmath_latex, '--interaction=nonstopmode']
|
||||||
ltx_args += ['--interaction=nonstopmode', 'math.tex']
|
# add custom args from the config file
|
||||||
|
ltx_args.extend(self.builder.config.pngmath_latex_args)
|
||||||
|
ltx_args.append('math.tex')
|
||||||
|
|
||||||
curdir = getcwd()
|
curdir = getcwd()
|
||||||
chdir(tempdir)
|
chdir(tempdir)
|
||||||
@ -131,7 +132,7 @@ def render_math(self, math):
|
|||||||
|
|
||||||
ensuredir(path.dirname(outfn))
|
ensuredir(path.dirname(outfn))
|
||||||
# use some standard dvipng arguments
|
# use some standard dvipng arguments
|
||||||
dvipng_args = shlex.split(self.builder.config.pngmath_dvipng)
|
dvipng_args = [self.builder.config.pngmath_dvipng]
|
||||||
dvipng_args += ['-o', outfn, '-T', 'tight', '-z9']
|
dvipng_args += ['-o', outfn, '-T', 'tight', '-z9']
|
||||||
# add custom ones from config value
|
# add custom ones from config value
|
||||||
dvipng_args.extend(self.builder.config.pngmath_dvipng_args)
|
dvipng_args.extend(self.builder.config.pngmath_dvipng_args)
|
||||||
@ -218,5 +219,6 @@ def setup(app):
|
|||||||
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', ['-gamma 1.5', '-D 110'], False)
|
app.add_config_value('pngmath_dvipng_args', ['-gamma 1.5', '-D 110'], False)
|
||||||
|
app.add_config_value('pngmath_latex_args', [], 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user