From 399d41807d9587c2b84c6cf366b15af9ae5491b9 Mon Sep 17 00:00:00 2001 From: jfbu <2589111+jfbu@users.noreply.github.com> Date: Mon, 6 Dec 2021 17:45:58 +0100 Subject: [PATCH] Make sure option names in xelatex pdf output do not split at dashes Fix #9925 --- sphinx/texinputs/sphinxlatexliterals.sty | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sphinx/texinputs/sphinxlatexliterals.sty b/sphinx/texinputs/sphinxlatexliterals.sty index d2ba89ea73f..9a195c66f92 100644 --- a/sphinx/texinputs/sphinxlatexliterals.sty +++ b/sphinx/texinputs/sphinxlatexliterals.sty @@ -1,7 +1,7 @@ %% LITERAL BLOCKS % % change this info string if making any custom modification -\ProvidesFile{sphinxlatexliterals.sty}[2021/01/27 code-blocks and parsed literals] +\ProvidesFile{sphinxlatexliterals.sty}[2021/12/06 code-blocks and parsed literals] % Provides support for this output mark-up from Sphinx latex writer: % @@ -711,6 +711,9 @@ \ifspx@opt@parsedliteralwraps \sbox\sphinxcontinuationbox {\spx@opt@verbatimcontinued}% \sbox\sphinxvisiblespacebox {\spx@opt@verbatimvisiblespace}% +% this uses a monospace font and linebreaks at dashes will be inhibited with +% pdflatex; not so with xelatex (cf \defaultfontfeatures in latex writer) so: + \def\sphinxhyphen{\mbox{-}}% \sphinxbreaksattexescapedchars \sphinxbreaksviaactiveinparsedliteral \sphinxbreaksatspaceinparsedliteral @@ -762,6 +765,10 @@ \protected\def\sphinxupquote#1{{\def\@tempa{alltt}% \ifx\@tempa\@currenvir\else \ifspx@opt@inlineliteralwraps + % a priori, this is typeset using a monospace font (cf \sphinxcode in + % sphinxlatexstyletext.sty) so linebreaks at dashes are inhibited; + % but, for xelatex or in case of non-monospace font, let's do this: + \def\sphinxhyphen{\mbox{-}}% % break at . , ; ? ! / \sphinxbreaksviaactive % break also at \