The cause of the issue was a clash about ``\titleref`` macro being already
defined in memoir class context. To avoid similar problems, this makes
the text styling macros
``\strong``, ``\code``, ``\bfcode``, ``\email``, ``\tablecontinued``,
``\titleref``, ``\menuselection``, ``\accelerator``, ``\crossref``,
``\termref``, ``\optional``,
also available with ``\sphinx`` prefix, with a conf.py boolean option to
let sphinx.sty only define ``\sphinx``-prefixed macros. As default value
is False, backwards compatibility is maintained.
On this occasion, some internal non-public macros have been renamed with
prefix ``\spx@``. The command
find . -name '*.sty' -exec grep -l \\\\spx@ {} \;
has been executed in TeXLive 2015 and 2016 installations to check no
package defines macros starting with ``\spx@``.
Some internal macros having public names (because they are written by
latex.py into the body of the latex document) have been renamed to have
``\sphinx`` prefix. The macros in sphinx.sty starting with \py@, or \DU,
or \PYG have not been modified. Similarly ``\release``, ``\version``,
``\releasename``, etc... have not been renamed.
As conf.py has now numfig = True, needed to modify accordingly test for
links in html output.
This topic branch fixes#2405, #2414, and also makes for latex(pdf)
functional hyperlinks to named references, but only for literal blocks
(code-block or literalinclude).
modified: tests/roots/test-directive-code/caption.rst
modified: tests/roots/test-directive-code/conf.py
new file: tests/roots/test-directive-code/namedblocks.rst
modified: tests/test_directive_code.py
This is tango between latex.py and sphinx.sty to handle PDF hyperlinks
to literal-blocks (both code-block and literalinclude) either with name
or caption (then numref can be used) or both.
modified: sphinx/texinputs/sphinx.sty
modified: sphinx/writers/latex.py
This test file is now back to original.
modified: tests/test_directive_code.py
The `\label` is now inserted into the caption on top of the Verbatim,
and `\ref` will work as expected. No need for `\phantomsection`.
modified: sphinx/writers/latex.py
modified: tests/test_directive_code.py
This could fix https://github.com/sphinx-doc/sphinx/issues/2262
The 1.3.5 Verbatim environment from sphinx.sty has many places allowing
a page break after the caption: from the \smallskip, from the list
environment, and from the \MakeFramed: indeed framed package
documentation explains that it encourages page breaks above it.
The only way to avoid the pagebreaks is to put the caption inside the
environment whic is started by \MakeFramed. However, as this environment
typesets multiple times its contents, we must inhibit within it the
increase of counters (only the literal-block counter is concerned), this
is done thanks to a switch provided by the package amsmath which is
already loaded by sphinx.sty.
modified: sphinx/texinputs/sphinx.sty
modified: sphinx/writers/latex.py
modified: tests/test_directive_code.py