Georg Brandl committed 91833fd Merge

Automated merge with file:///home/gbr/devel/sphinx0.5

  • Participants
  • Parent commits 19c16e9, 0d4a3e4

Comments (0)

Files changed (3)

 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 writing status messages and warnings containing

File doc/ext/math.rst

    may need to set this to a full path if ``latex`` not in the executable search
-   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
    useful to set it in ````; rather, giving it on the
    :program:`sphinx-build` command line via the :option:`-D` option should be
       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
    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
    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
    Additional LaTeX code to put into the preamble of the short LaTeX files that

File sphinx/ext/

 import re
-import shlex
 import shutil
 import tempfile
 import posixpath
     # build latex command; old versions of latex don't have the
     # --output-directory option, so we have to manually chdir to the
     # temp dir to run it.
-    ltx_args = shlex.split(self.builder.config.pngmath_latex)
-    ltx_args += ['--interaction=nonstopmode', 'math.tex']
+    ltx_args = [self.builder.config.pngmath_latex, '--interaction=nonstopmode']
+    # add custom args from the config file
+    ltx_args.extend(self.builder.config.pngmath_latex_args)
+    ltx_args.append('math.tex')
     curdir = getcwd()
     # 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']
     # add custom ones from config value
     app.add_config_value('pngmath_latex', 'latex', 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_latex_args', [], False)
     app.add_config_value('pngmath_latex_preamble', '', False)
     app.connect('build-finished', cleanup_tempdir)