The potential linebreaks at commas in code lines were not inserted due
to latex kernel macro ``\@noligs`` which is issued by fancyvrb.sty
during its line processing. From the default `` `<>,'- ``, only the
backtick is left to be handled by ``\@noligs`` because the others are
either already replaced by a macro by Pygments, or (only the comma) made
active by sphinx.sty to insert potential linebreaks.
This came from the spurious space tokens following a fullwidth rule at
top of ``\maketitle`` in ``sphinxhowto.cls`` and ``sphinxmanual.cls``.
The ``\newline\null\par`` incantation recreates the extra empty line
which originated in these spurious space tokens, but it avoids the
Underfull latex warning. Nothing is changed to layout from this fix.
Adds some ``\relax``/``\unskip`` and removes spaces from ``visit_entry``
generated latex code. Earlier, multirow cell inherited one extra space
token at begin and one at end, making left or right alignment with other
cells fail because the native LaTeX space removal mechanism for table
cells could not apply there.
Memo: the ``\eqparbox`` part of ``visit_entry`` from e41f831f is left
untouched; separate analysis required.
Seems longer lines are more frequent since 1.4. I hard-wrapped at 80
chars the ones I committed which sometimes exceeded 100 chars. Other
long lines remain (one has 108 chars).
latex: let sphinx.sty use own \spx@ifundefined for some tests.
the first commit is more aggressive, I leave it in commit history in case it could be useful in future.
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.
Allow code-blocks at maximal nesting depth of lists/quotes in LaTeX
(which by default is 6), by patching fancyvrb's original Verbatim way of
checking list depth which resulted in a loss of 1 possible level.
Memo 1: latex can have by default a maximum of 4 nested enumerated
lists, 4 nested labeled lists, and in total 6 nested lists. This
includes quoted blocks as they use the `\list` macro.
Memo 2: fancyvrb's rationale for using the \@list... macros (in its
\FV@ListNesting) is to set vertical positioning. To set a Verbatim at
level N it uses vertical parameters for list level N+1, hence can't work
at max level. But in Sphinx, this happens inside a \vbox for framing,
hence the vertical positioning set by fancyvrb turns out to be inoperant
anyhow. The execution of \@list<level> also sets the \leftmargin, but
fancyvrb resets it to zero later (#1=\z@ in \FV@ListNesting). To sum up,
fancyvrb's \FV@ListNesting does nothing but has the after effect to
raise an error if the code-block is at level equal to max - 1.
The effect of this commit is to make inoperant fancyvrb's check of
nesting depth, hence now the code-block can appear at maximal depth.
This is second commit improving in Sphinx the maximal depth for
code-blocks in nested lists or quote blocks. It used to be 4 (with
LaTeX's defaults for lists), it is now at 6 (or at the max depth
allowed by the document class).
This is \list --> \trivlist replacement in Sphinx wrapper of original
Verbatim from package fancyvrb. This gains one level for allowed
location of a code-block in nested lists/quotes.
Move \@newlistfalse from 18eb553b to earlier location, else LaTeX's \par
will created obsecure "missing item error" if Verbatim code-block is
enclosed in warning notice, and warning notice is in quote block ...
The subtle cause of the bug was that original Verbatim environment was
used inside a minipage environment, and fancyvrb's code for checking
when \end{Verbatim} is reached does not work if \@currenvir is minipage.
As latest Sphinx controls Verbatim up to finest details, it got possible
to arrange for framing to be drawn _after_ the code lines. This provides
work-around for issue with some pdf viewer at some resolutions on some
devices.
This cleans up comments from sphinxmanual.cls.
Memo: the logic behind the earlier sphinxmanual.cls is obscure, besides
the fact that it didn't work correctly if conf.py used openany option.
The parent commit corrected the implementation, but not the logic.
Were it not for the log message about added blank page, there would be
no need to patch \tableofcontents, because by default it will use
\chapter* which does the right thing. Similarly after the end of
abstract, a \chapter or \part (or \tableofcontents, once abstract is
properly handled by LaTeX writer (*)), currently one seems to be
contrived to use raw directive and the abstract is then after
\tableofcontents) will do the right thing in case of openany. Also the
\maketitle wrongly ended with \cleardoublepage, which was corrected in parent
commit, but better would be that it does nothing. Indeed it is not
logical for \maketitle, abstract or \tableofcontents to worry about what
comes next. Anything which comes next should be a \part or \chapter
which will do the right thing.
(*) currently one seems to be contrived to use raw directive and the
abstract is then after \tableofcontents) will do the right thing in case
of openany.
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