Sphinx / reStructuredText:是否可以有一个html文档树,但是将其拆分为单独的latex / pdf文档

时间:2019-04-17 09:40:22

标签: python-sphinx restructuredtext

我正在使用Python-Sphinx进行更大的文档项目。我刚开始并设法克服了第一个障碍,并创建了一个文件夹结构,该文件夹结构面向各个子项目,对整个项目有贡献:

.../source/
    conf.py
    index.rst (braket file for everything)
    /OverViewDocumentation/
        overview.rst
    /Subprojects/
        /sub1/
            index.rst
            sub1Docu.rst
        /sub2/
            indexfile.rst
            sub2Docu.rst

我想看到的是,可以通过一个html结构访问此结构,但是叶子文档成为单独的LaTeX / PDF文档。

可以实现吗?

我的conf.py如下所示:

latex_documents = [
    (master_doc,
     'TexDoc1.tex',
     'Title1',
     'author1',
     'Custom docclass'),
    ('abolute\\path\\to\\other\\indexfile.rst',
     'TexDoc2.tex',
     'Title2',
     'author2',
     'Custom docclass'), 
]

但是我总是收到错误消息:

WARNING: "latex_documents" config value references unknown document <pathto>\indexfile

请注意,无论使用绝对路径还是相对路径,都会出现错误。

1 个答案:

答案 0 :(得分:0)

由于mzjn的提示,我找到了解决方案。

错误出在conf.py文件中。工作文件如下所示:

latex_documents = [
    (master_doc,
     'TexDoc1.tex',
     'Title1',
     'author1',
     'Custom docclass'),
    ('relative/path/to/other/indexfile',
     'TexDoc2.tex',
     'Title2',
     'author2',
     'Custom docclass'), 
]

在上面的文件中,我遇到以下问题

  • 使用反斜杠代替斜杠(我正在Windows系统上工作)
  • 使用绝对路径
  • indexfile
  • 使用显式文件扩展名