Skip to content

Commit 90fd2a2

Browse files
authored
LaTeX: let long .. confval:: argument wrap at spaces in PDF (#13817)
1 parent 873ecec commit 90fd2a2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ Bugs fixed
108108
to improve `semantic HTML structure
109109
<https://html.spec.whatwg.org/multipage/text-level-semantics.html>`__.
110110
Patch by Mark Ostroth.
111+
* #13812 (discussion): LaTeX: long :rst:dir:`confval` value does not wrap at
112+
spaces in PDF.
113+
Patch by Jean-François B.
111114
* #10785: Autodoc: Allow type aliases defined in the project to be properly
112115
cross-referenced when used as type annotations. This makes it possible
113116
for objects documented as ``:py:data:`` to be hyperlinked in function signatures.

sphinx/texinputs/sphinxlatexliterals.sty

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%% LITERAL BLOCKS
22
%
33
% change this info string if making any custom modification
4-
\ProvidesPackage{sphinxlatexliterals}[2024/07/01 v7.4.0 code-blocks and parsed literals]
4+
\ProvidesPackage{sphinxlatexliterals}[2025/08/06 v8.3.0 code-blocks and parsed literals]
55

66
% Provides support for this output mark-up from Sphinx latex writer:
77
%
@@ -241,6 +241,8 @@
241241
% _, }, ^, &, >, -, ~, and \: stay at end of broken line.
242242
% Use of \textquotesingle for straight quote.
243243
% FIXME: convert this to package options ?
244+
% MEMO: "beforelist" and "afterlist" hold no relation with lists,
245+
% they are just "\do lists" in the inherited TeX sense.
244246
\newcommand*\sphinxbreaksbeforelist {%
245247
\do\PYGZob\{\do\PYGZlt\<\do\PYGZsh\#\do\PYGZpc\%% {, <, #, %,
246248
\do\PYGZdl\$\do\PYGZdq\"% $, "
@@ -278,6 +280,8 @@
278280
\catcode`##1\active}%
279281
\sphinxbreaksafteractivelist
280282
\lccode`\~`\~
283+
% visit_desc_name will insert non TeX-escaped ~ in the source
284+
\let~\spx@verbatim@space
281285
}
282286

283287
% If the linebreak is at a space, the latter will be displayed as visible
@@ -962,7 +966,13 @@
962966
\let\sphinxhyphen\sphinxhyphenininlineliteral
963967
\ifspx@opt@inlineliteralwraps
964968
% break at . , ; ? ! /
969+
% and also at ~ which will be handled like are spaces in verbatim
965970
\sphinxbreaksviaactive
971+
% but for this we need to set this box which is empty by default:
972+
% MEMO: it looks suboptimal to redo this each time but this is
973+
% to obey a \sphinxsetup via raw LaTeX to set verbatimvisiblespace,
974+
% a possibility which however will be used by 0% of Sphinx users...
975+
\sbox\sphinxvisiblespacebox {\spx@opt@verbatimvisiblespace}%
966976
% break also at \
967977
\setbox8=\hbox{\textbackslash}%
968978
\def\sphinx@textbackslash{\copy8}%

0 commit comments

Comments
 (0)