This addresses #2547. As the two Sphinx classes set secnumdepth to 2 by
default, the label for paragraphs with the numbering is still skipped by
default. But if user increases secnumdepth to 4 or higher it will show,
contrarily to earlier situation. Also formerly paragraph headings used
\small, which looks wrong because the body text did not use \small.
And subparagraphs were not at all configured with \titleformat, thus did
not use same font as other headings.
Also related to #1534. Convert code lines into flushleft paragraphs,
thus allowing linebreaks at spaces, and use pre-existing Pygments
mark-up to also allow line breaks at (type 1) characters {, <, #, %, $,
' and " and (type 2) _, }, ^, &, >, -, ~, ., ;, :, ?, !, / and the
comma. Characters of type 1 go to next line in case of break, those of
type 2 stay on same line.
- no new LaTeX package is used, but current use of fancyverb modified.
- code line numbering is not affected (extra lines are not numbered.
- spacing of top line and last line with respect of frame is improved.
- near bottom of page the wrapping of lines longer than text width,
which formerly continued into right margin, can produce one or more
extra lines at bottom of page. It looks impossible without extensive
rewrite of fancyvrb.sty or the switch to an altogether different
LaTeX package doing source code formatting to allow page breaks
there.
Allow page breaks in topic contents (e.g. local tables of contents) from
replacing \shadowbox of non anymore used package framebox by a custom
framed package environment.
Formerly, topic boxes extended into right margin; put only the shadow in
margin, locate the right frame exactly at the margin.
Use framed.sty also for framing admonitions of the warning type. Make
vertical spacing more coherent with the one for hint type notices.
Handle case with warning notices getting nested; the inner ones use a
minipage, only the outer one allows pagebreaks.
See http://ctan.org/pkg/luatex85 for more info. Old packages relying on
pdf naming of primitives will break under LuaTeX 0.85+, which will be
generally available starting with TeXLive 2016 release.
modified: sphinx/texinputs/sphinx.sty
Add a missing \setlength\parsep{0pt} in Verbatim. There was a little
extra white space below top frame for indented code-blocks because of
that.
modified: sphinx/texinputs/sphinx.sty
Although the definition was made locally, it meant that for example
macros of type \PYG... could not use internally \fbox whose meaning
had been modified. New code never modifies \fbox or \XC@fbox.
modified: sphinx/texinputs/sphinx.sty
On this opportunity the code and comments in sphinx.sty from commit
9d82cad (LaTeX captions of literal blocks now glued to framed verbatim)
have been re-organized, uses less macros. Only functional difference
should be the fix of #2447.
modified: sphinx/texinputs/sphinx.sty
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
Indeed, sphinx.sty redefines _environment_ Verbatim, and LaTeX's
environments always are scope-limiting for local assignments.
modified: sphinx/texinputs/sphinx.sty
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
and also perhaps https://github.com/sphinx-doc/sphinx/issues/2319
As now the caption is set in an environment it appears to possibly solve
also issue #2319 Table counter is overrided by code-block's in LaTeX
The parent commit used only \FirstFrameCommand of latex package
framed, but \FrameCommand also must be customized in case the
framed contents fit on a single page. This is fixed here.
modified: sphinx/texinputs/sphinx.sty
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