mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
The new `latex_additional_files
` config value can be used to
copy files (that Sphinx doesn't copy automatically, e.g. if they are referenced in custom LaTeX added in ``latex_elements``) to the build directory.
This commit is contained in:
parent
d3a7f004f0
commit
7073a5bd2c
6
CHANGES
6
CHANGES
@ -90,7 +90,6 @@ New features added
|
||||
- The default value for ``htmlhelp_basename`` is now the project
|
||||
title, cleaned up as a filename.
|
||||
|
||||
|
||||
- The new ``modindex_common_prefix`` config value can be used to
|
||||
ignore certain package names for module index sorting.
|
||||
|
||||
@ -99,6 +98,11 @@ New features added
|
||||
space before a footnote reference that is necessary for reST
|
||||
to recognize the reference.
|
||||
|
||||
- The new ``latex_additional_files`` config value can be used to
|
||||
copy files (that Sphinx doesn't copy automatically, e.g. if they
|
||||
are referenced in custom LaTeX added in ``latex_elements``) to
|
||||
the build directory.
|
||||
|
||||
* Builders:
|
||||
|
||||
- The HTML builder now stores a small file named ``.buildinfo`` in
|
||||
|
@ -652,6 +652,19 @@ These options influence LaTeX output.
|
||||
``'shorthandoff'``
|
||||
``'printmodindex'``
|
||||
|
||||
.. confval:: latex_additional_files
|
||||
|
||||
A list of file names, relative to the configuration directory, to copy to the
|
||||
build directory when building LaTeX output. This is useful to copy files
|
||||
that Sphinx doesn't copy automatically, e.g. if they are referenced in custom
|
||||
LaTeX added in ``latex_elements``. Image files that are referenced in source
|
||||
files (e.g. via ``.. image::``) are copied automatically.
|
||||
|
||||
You have to make sure yourself that the filenames don't collide with those of
|
||||
any automatically copied files.
|
||||
|
||||
.. versionadded:: 0.6
|
||||
|
||||
.. confval:: latex_preamble
|
||||
|
||||
Additional LaTeX markup for the preamble.
|
||||
|
@ -178,6 +178,15 @@ class LaTeXBuilder(Builder):
|
||||
path.join(self.outdir, dest))
|
||||
self.info()
|
||||
|
||||
# copy additional files
|
||||
if self.config.latex_additional_files:
|
||||
self.info(bold('copying additional files...'), nonl=1)
|
||||
for filename in self.config.latex_additional_files:
|
||||
self.info(' '+filename, nonl=1)
|
||||
shutil.copyfile(path.join(self.confdir, filename),
|
||||
path.join(self.outdir, path.basename(filename)))
|
||||
self.info()
|
||||
|
||||
# the logo is handled differently
|
||||
if self.config.latex_logo:
|
||||
logobase = path.basename(self.config.latex_logo)
|
||||
|
@ -102,6 +102,7 @@ class Config(object):
|
||||
latex_paper_size = ('letter', None),
|
||||
latex_font_size = ('10pt', None),
|
||||
latex_elements = ({}, None),
|
||||
latex_additional_files = ([], None),
|
||||
# now deprecated - use latex_elements
|
||||
latex_preamble = ('', None),
|
||||
)
|
||||
|
@ -42,6 +42,8 @@ latex_documents = [
|
||||
'Georg Brandl', 'manual'),
|
||||
]
|
||||
|
||||
latex_additional_files = ['svgimg.svg']
|
||||
|
||||
value_from_conf_py = 84
|
||||
|
||||
coverage_c_path = ['special/*.h']
|
||||
|
@ -187,6 +187,8 @@ def test_latex(app):
|
||||
assert latex_warnings == latex_warnings_exp, 'Warnings don\'t match:\n' + \
|
||||
'\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
|
||||
latex_warnings.splitlines()))
|
||||
# file from latex_additional_files
|
||||
assert (app.outdir / 'svgimg.svg').isfile()
|
||||
|
||||
# only run latex if all needed packages are there
|
||||
def kpsetest(filename):
|
||||
|
Loading…
Reference in New Issue
Block a user