Refs: #6890
The comma character is not TeX-escaped because it is frequent in general
text and escaping it would make the LaTeX output larger for only dealing
with the problem of the LaTeX-ligature of ,, into a single character.
And one there is problem with the commas in options to Verbatim from
PygmentsBridge.
The hyphen character is escaped (not in ids and URIs!) to
\sphinxhyphen{} for both Unicode and non-Unicode engines. This is needed
to work around hyperref transforming -- and --- from section titles into
EN DASH resp. EM DASH in PDF bookmarks.
https://github.com/latex3/hyperref/issues/112
Note to expert LaTeX users: if Sphinx latex user with xelatex has
- turned off Smart Quotes for some reason,
- but does want TeX ligatures and thus overrode Sphinx
latex_elements['fontenc'] default (since #6888) to this effect,
then this should be added to LaTeX preamble:
\def\sphinxhyphen#1{-}% (\protected is now not needed)
\let\sphinxhyphenforbookmarks\sphinxhyphen
Closes: #6886
It is difficult to understand why fontspec _by default_ turns straight
double quotes " into ” i.e. right curly ones, calling this "TeX
ligature", but that's life and fortunately fontspec also provides a way
to turn this off. With this workaround also a straight ' in LaTeX file,
(i.e. a straight ' in source and smartquotes = False was used) will not
become a curly quote and this is an advantage compared to the pdflatex
situation.
We suppress TeX Ligatures also for \ttfamily (used in code-blocks) but
that appears to be already the case with fontspec although user manual
does not seem explicit (and no list of what exactly the TeX Ligatures
are is to be found in fontspec user documentation, one has to go into
its source code). (the fact that Pygmentize escapes the " to \char`\"
TeX mark-up would not by itself prevent the transformation into a curly
double quote, it is because fontspec does not apply this transform to
monospace typeface that it did not show).
This is because of case of an index directive or role in a table cell.
For the same reason tabulary is not compatible with code-cells,
it affects index entries. The escaping of | char by a LaTeX macro
needed to be by a "robus" or "protected" one, or by string like {"|}.
This was not the choice of previous commit, by oversight.
By reverting to \textbar{} (which is a "robust" command) we also
maintain maximal backwards compatibility for the sorting in the
index done by the makeindex program.
In case a code-block is in an environment already using the "framed"
package, measure the vertical size needed for the code lines and use a
nested "framed" only if short enough (i.e. at most 90% of text area on a
page).
Long nested contents will drop the inner frame. They lose the background
color as well as the continuation hints across pagebreaks. But the
caption if present is typeset normally. And highlighted lines and line
numbers are rendered with no alteration.
Short nested contents (should) render exactly as before this commit:
they use "framed" but this must be encapsulated in an unbreakable
"minipage". All decoration including caption are obeyed but of course
not the continuation hints are these never apply.
Default configuration is to allow the linebreak after the backslash.
It is possible at user side via 'preamble' key and some LaTeX code
to allow the linebreak before the backslash, but each of inline-literal,
code-block, and parsed-literal has its more or less cumbersome way for
that.
Closes: #6000, #6001
This commit handles only the \ character, which had been left aside
by accident so far. Inline-literals could break at more characters
but this is not yet done in this commit. In this context, in future
it could be useful to modify sphinx.util.texescape to use mark-up
such as \sphinxtextbackslash rather than naked \textbackslash and
similarly for some other characters. This could then be used to
allow linebreaks even in regular text paragraphs.
This can be reverted if adding the extra dependencies is deemed worth
it, but it means having to look at Debian packaging and currently means
adding texlive-lang-cyrillic as requirement
Closes: #6004
Comment: \begin{tabular}[@{}c@{}] does not work in case of multiple
authors separated by \and in latex_documents, because latex has this
definition of \and :
macro:->\end {tabular}\hskip 1em \@plus .17fil\begin {tabular}[t]{c}
which means we would need to modify it to read
macro:->\end {tabular}\hskip 1em \@plus .17fil\begin {tabular}[t]{@{}c@{}}
(or only one @{} at end) modifying space between two authors.