# sphinx: different relative paths to same figure possible?

• Last Update :
• Techknowledgy :

Put your figures in a directory at the root level, and change your markup to find them relative to the root using a leading /.

..figure::/_static/figure1.png

Suggestion : 2

Instead, Sphinx offers a powerful way to linking to the different elements of the document, called cross-references. Some advantages of using them:,All targets seen so far can be referenced only from the same page. Sphinx provides some roles that allow you to reference any explicit target from any page.,The numref role is used to reference numbered elements of your documentation. For example, tables and images.,Cross-referencing with Sphinx Getting started Explicit targets Implicit targets Cross-referencing using roles The ref role The doc role The numref role Automatically label sections Invalid targets Finding the reference name Cross-referencing targets in other documentation sites

.._My target:

Explicit targets
~~~~~~~~~~~~~~~~

Reference My target
_.
(My_target) =
# # Explicit targets

Reference[](My_target).
.. _target to paragraph:

An easy way is just to use the final link of the page/section.
This works, but it has :ref:some disadvantages <target to paragraph>:
(target_to_paragraph) =

An easy way is just to use the final link of the page / section.
This works, but it has[some disadvantages](target_to_paragraph):
You can also create _in-line targets
within an element on your page,
allowing you to,
for example, reference text * within * a paragraph.
For example, to reference the previous section
you can use Explicit targets
_.

Suggestion : 3

Changed in version 1.3: As these files are not meant to be built, they are automatically added to exclude_patterns.,A list of paths that contain custom LaTeX themes as subdirectories. Relative paths are taken as relative to the configuration directory.,A list of paths that contain custom themes, either as subdirectories or as zip files. Relative paths are taken as relative to the configuration directory.,A list of paths that contain extra templates (or templates that overwrite builtin/theme-specific templates). Relative paths are taken as relative to the configuration directory.

import sys, os

sys.path.append(os.path.abspath('sphinxext'))

extensions = ['extname']
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'restructuredtext',
'.md': 'markdown',
}
source_parsers = {
'.md': 'recommonmark.parser.CommonMarkParser'
}
rst_epilog = ""
".. | psf | replace::Python Software Foundation ""
"
rst_prolog = ""
".. | psf | replace::Python Software Foundation ""
"
{
'languages': ['ja'],
'builders': ['man', 'text']
}

Suggestion : 4

To import the image as figure the syntax is rather the same:,Following the suggested tests in the link is advisable. It is nice to have the MathJax directory within the documentation directory.,It has to be notified that the specified path is relative to the source directory. This means that if directly the title of the image is given, it is in the same directory as the rst files.,How to link to Python modules, classes, functions, methods, attributes and statements from other Sphinx documentations? (Intersphinx linking)

$sphinx - quickstart  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 $ sphinx - build - b html sourcedir builddir
\$ make html
1
2
3
4
5
6

Suggestion : 5

Any paths provided in this configuration are expected to be absolute by default. If you want to provide relative paths, you will need to add absolute_paths: true to each relevant environment in config/thinking_sphinx.yml. These paths will then be translated to absolute paths from the root of the Rails application, within the generated Sphinx configuration.,It is possible to run the Sphinx daemon on a UNIX socket. To do this, you will need to specify the path to the socket in your config/thinking_sphinx.yml file per environment:,However, you can change this value. Firstly, in your config/thinking_sphinx.yml file, you need to set max_matches to your upper limit:,To configure Thinking Sphinx for any of these features, simply specify the path to the appropriate file in your config/thinking_sphinx.yml file:

development:
mysql41: 9312
test:
mysql41: 9313
production:
mysql41: 9312
production:
indices_location: "/var/www/my_app/shared/sphinx"
#...repeat
for other environments
if necessary
development:
configuration_file: "RAILS_ROOT/config/ENVIRONMENT.sphinx.conf"
log: "RAILS_ROOT/log/searchd.log"
query_log: "RAILS_ROOT/log/searchd.query.log"
pid_file: "RAILS_ROOT/log/searchd.ENVIRONMENT.pid"
#...repeat
for other environments
production:
address: 10.0 .0 .4
mysql41: 3200
#...repeat
for other environments
if necessary
production:
socket: "RAILS_ROOT/tmp/production.sphinx"
development:
mem_limit: 128 M
#...repeat
for other environments