title: Is it possible to create nested pdf documentation with sphinx+intersphinx?
body: <p>I have a project B thats needs project A to work, so I'd like to embed documentation of A in the one of B, and, this document must be pdf (not html).</p>
  <p>The project A looks like :</p>
  <pre><code>~&gt; more conf.py
  # Configuration file for the Sphinx documentation builder.
  #
  # This file only contains a selection of the most common options. For a full
  # list see the documentation:
  # https://www.sphinx-doc.org/en/master/usage/configuration.html
  
  # -- Path setup --------------------------------------------------------------
  
  # If extensions (or modules to document with autodoc) are in another directory,
  # add these directories to sys.path here. If the directory is relative to the
  # documentation root, use os.path.abspath to make it absolute, like shown here.
  #
  import os
  import sys
  sys.path.insert(0, os.path.abspath('.'))
  
  
  # -- Project information -----------------------------------------------------
  
  project = 'projectA'
  copyright = '2021, JD'
  author = 'JD'
  
  
  # -- General configuration ---------------------------------------------------
  
  # Add any Sphinx extension module names here, as strings. They can be
  # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  # ones.
  extensions = [
      'sphinx.ext.autodoc'
  ]
  
  # Add any paths that contain templates here, relative to this directory.
  templates_path = ['_templates']
  
  # List of patterns, relative to source directory, that match files and
  # directories to ignore when looking for source files.
  # This pattern also affects html_static_path and html_extra_path.
  exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  
  ~&gt; more .\index.rst
  .. projectA documentation master file, created by
     sphinx-quickstart on Tue Jan 12 11:43:30 2021.
     You can adapt this file completely to your liking, but it should at least
     contain the root `toctree` directive.
  
  Welcome to projectA's documentation!
  ====================================
  
  .. toctree::
     :maxdepth: 2
     :caption: Contents:
  
     projectA
  
  ~&gt; more .\projectA.py
  #!/usr/bin/python
  &quot;&quot;&quot;This is the documentation of project A.&quot;&quot;&quot;
  
  class classA:
    &quot;&quot;&quot;This the class A.&quot;&quot;&quot;
  
    def methodA(self, who):
        &quot;&quot;&quot;This is stuff that A does.&quot;&quot;&quot;
        return
  
  ~&gt; more .\projectA.rst
  project A
  =========
  
  .. automodule:: projectA
  
  .. autoclass:: classA
  
    .. automethod:: methodA
  
  </code></pre>
  <p>The documentation of A is created without any problem.</p>
  <p>The project B is at the same level than projectA and is the same than projectA replacing A with B.</p>
  <pre><code>~&gt; tree -d
  intersphinx_example
  |_projectA
  |_projectB
  </code></pre>
  <p>But now, B wants to use intersphinx to include documentation of A into it's own documentation.</p>
  <pre><code>~/projectB&gt; git diff
  diff --git a/conf.py b/conf.py
  index 0a22df8..ac641cf 100644
  --- a/conf.py
  +++ b/conf.py
  @@ -28,9 +28,14 @@ author = 'JD'
   # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
   # ones.
   extensions = [
  +    'sphinx.ext.intersphinx',
       'sphinx.ext.autodoc'
   ]
  
  +intersphinx_mapping = {
  +    'projA': (os.path.join('..', 'projectA'), None),
  +}
  +
   # Add any paths that contain templates here, relative to this directory.
   templates_path = ['_templates']
  
  diff --git a/projectB.py b/projectB.py
  index b057498..b42d485 100644
  --- a/projectB.py
  +++ b/projectB.py
  @@ -1,10 +1,16 @@
   #!/usr/bin/python
  -&quot;&quot;&quot;This is the documentation of project B.&quot;&quot;&quot;
  +&quot;&quot;&quot;This is the documentation of project B: projectB needs :ref:`projA`.&quot;&quot;&quot;
  +
  +import os
  +import sys
  +sys.path.append(os.path.join(os.getcwd(), '..', 'projectA'))
  +from projectA import classA
  
   class classB:
     &quot;&quot;&quot;This the class B.&quot;&quot;&quot;
  
     def methodB(self, who):
  -      &quot;&quot;&quot;This is stuff that B does.&quot;&quot;&quot;
  +      &quot;&quot;&quot;This is stuff that B does: B need to use :ref:`projA.classA` &quot;&quot;&quot;
  +      a = classA()
         return
  
  </code></pre>
  <p>Generating the documentation in projectB does not work. There are at least 3 problems :</p>
  <ul>
  <li><p>intersphinx inventory '..\projectA/objects.inv' not fetchable : there is no objects.inv in projectA, how to get it ?</p>
  </li>
  <li><p>projectB.py:docstring of projectB:1: WARNING: undefined label: proja</p>
  </li>
  <li><p>projectB\projectB.py:docstring of projectB.classB.methodB:1: WARNING: undefined label: proja.classa</p>
  </li>
  </ul>
  <p>The documentation I aim to get is pdf. The projects (A and B) are python code on HD (no web) and have no html associated documentation.</p>
  <p>Is this kind of stuff (generating nested pdf documentation) possible with intersphinx ? Out of scope of it ?</p>
  <p><strong>UPDATE</strong></p>
  <p>Does not work either (with axect same erros) with:</p>
  <pre><code>~\projectB&gt; git diff
  diff --git a/conf.py b/conf.py
  index 0a22df8..bc99c77 100644
  --- a/conf.py
  +++ b/conf.py
  @@ -28,9 +28,14 @@ author = 'JD'
   # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
   # ones.
   extensions = [
  +    'sphinx.ext.intersphinx',
       'sphinx.ext.autodoc'
   ]
  
  +intersphinx_mapping = {
  +    'projA': (os.path.join('..', 'projectA', '_build'), None)
  +}
  +
  </code></pre>